/**
 * Team Exciting - Responsive Design Fixes
 * Behebt alle Mobile/Tablet/Desktop Probleme
 *
 * @package TeamExciting
 * @version 2.0
 */

/* ============================================
   MOBILE FIRST APPROACH
   ============================================ */

/* Base Styles (Mobile) */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden;
    min-height: 100vh;
}

/* Admin Bar Fix */
@media screen {
    html {
        margin-top: 32px !important;
    }

    .site-content {
        padding-top: 20px;
    }
}

@media screen and (max-width: 782px) {
    html {
        margin-top: 46px !important;
    }

    .site-content {
        padding-top: 15px;
    }
}

/* ============================================
   GATHERS PAGE - RESPONSIVE
   ============================================ */

/* Hero Section */
.te-gathers-hero h1 {
    font-size: clamp(28px, 5vw + 1rem, 72px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.te-gathers-hero p {
    font-size: clamp(16px, 2vw + 0.5rem, 24px);
    line-height: 1.6;
}

/* Hero Stats - Mobile */
.te-hero-stats {
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
}

@media (min-width: 768px) {
    .te-hero-stats {
        flex-direction: row;
        gap: 40px;
        align-items: center;
        justify-content: center;
    }
}

.te-hero-stat {
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

/* Tabs Navigation */
.te-tabs {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    justify-content: center;
}

.te-tab-btn {
    padding: 12px 20px;
    font-size: 14px;
    min-height: 44px; /* Apple HIG minimum tap target */
    min-width: 44px;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .te-tab-btn {
        padding: 18px 40px;
        font-size: 17px;
    }
}

/* Search Bar */
.te-search-bar {
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 768px) {
    .te-search-bar {
        flex-direction: row;
        gap: 15px;
    }
}

.te-search-input {
    min-width: 100%;
    width: 100%;
}

@media (min-width: 768px) {
    .te-search-input {
        min-width: 300px;
        width: auto;
        flex: 1;
    }
}

.te-refresh-btn {
    width: 100%;
    justify-content: center;
}

@media (min-width: 768px) {
    .te-refresh-btn {
        width: auto;
    }
}

/* Gathers Grid - Responsive */
.te-gathers-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 0 10px;
}

@media (min-width: 640px) {
    .te-gathers-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
        gap: 25px;
        padding: 0;
    }
}

@media (min-width: 1024px) {
    .te-gathers-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
        gap: 30px;
    }
}

/* Gather Cards - Mobile */
.te-gather-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.te-gather-card:active {
    transform: scale(0.98);
}

@media (min-width: 768px) {
    .te-gather-card:hover {
        transform: translateY(-8px);
    }

    .te-gather-card:active {
        transform: translateY(-6px);
    }
}

/* Card Header - Responsive */
.te-gather-card-header {
    flex-wrap: wrap;
    gap: 10px;
}

.te-game-badge {
    font-size: 14px;
}

@media (min-width: 768px) {
    .te-game-badge {
        font-size: 16px;
    }
}

.te-game-icon {
    width: 32px;
    height: 32px;
}

@media (min-width: 768px) {
    .te-game-icon {
        width: 40px;
        height: 40px;
    }
}

/* Status Badge */
.te-status-badge {
    padding: 6px 12px;
    font-size: 11px;
}

@media (min-width: 768px) {
    .te-status-badge {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* Card Body */
.te-gather-title {
    font-size: 18px;
    line-height: 1.3;
}

@media (min-width: 768px) {
    .te-gather-title {
        font-size: 22px;
    }
}

.te-gather-description {
    font-size: 14px;
    max-height: 80px;
}

@media (min-width: 768px) {
    .te-gather-description {
        font-size: 15px;
        max-height: 60px;
    }
}

/* Meta Items */
.te-gather-meta {
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 640px) {
    .te-gather-meta {
        flex-direction: row;
        gap: 20px;
    }
}

/* Participants Avatars */
.te-participants-avatars {
    flex-wrap: wrap;
    gap: 5px;
}

.te-avatar {
    width: 36px;
    height: 36px;
    margin-left: 0;
}

@media (min-width: 768px) {
    .te-avatar {
        width: 42px;
        height: 42px;
        margin-left: -10px;
    }

    .te-avatar:first-child {
        margin-left: 0;
    }
}

/* Card Footer Buttons */
.te-gather-actions {
    flex-direction: column;
    gap: 8px;
}

@media (min-width: 640px) {
    .te-gather-actions {
        flex-direction: row;
        gap: 12px;
    }
}

.te-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
    min-height: 44px;
}

@media (min-width: 768px) {
    .te-btn {
        width: auto;
        flex: 1;
        padding: 14px 28px;
        font-size: 15px;
    }
}

/* ============================================
   CREATE FORM - RESPONSIVE
   ============================================ */

.te-create-form-container {
    padding: 25px 15px;
    margin: 0 10px;
}

@media (min-width: 768px) {
    .te-create-form-container {
        padding: 40px 30px;
        margin: 0 auto;
    }
}

@media (min-width: 1024px) {
    .te-create-form-container {
        padding: 50px;
    }
}

.te-create-form-header h2 {
    font-size: 28px;
}

@media (min-width: 768px) {
    .te-create-form-header h2 {
        font-size: 42px;
    }
}

/* Games Grid */
.te-games-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    max-height: 300px;
}

@media (min-width: 640px) {
    .te-games-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
        max-height: 350px;
    }
}

@media (min-width: 1024px) {
    .te-games-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
        max-height: 400px;
    }
}

.te-game-card {
    padding: 15px 10px;
}

@media (min-width: 768px) {
    .te-game-card {
        padding: 20px;
    }
}

/* ============================================
   TOURNAMENT SUB-NAVIGATION
   ============================================ */

.tournament-subnav-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tournament-subnav-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    padding: 10px;
    min-width: min-content;
}

@media (min-width: 1024px) {
    .tournament-subnav-list {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
}

.tournament-subnav-link {
    padding: 10px 15px;
    font-size: 13px;
    white-space: nowrap;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (min-width: 768px) {
    .tournament-subnav-link {
        padding: 12px 20px;
        font-size: 14px;
    }
}

.tournament-subnav-icon {
    font-size: 18px;
}

@media (min-width: 768px) {
    .tournament-subnav-icon {
        font-size: 20px;
    }
}

/* ============================================
   SIDEBAR WIDGETS
   ============================================ */

.offcanvas-menu-wrap {
    width: 100% !important;
    max-width: 320px;
}

@media (min-width: 640px) {
    .offcanvas-menu-wrap {
        max-width: 380px;
    }
}

/* User Stats Grid */
.user-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (min-width: 400px) {
    .user-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   FOOTER
   ============================================ */

.footer-legal-links {
    flex-direction: column;
    gap: 10px;
    text-align: center;
}

@media (min-width: 768px) {
    .footer-legal-links {
        flex-direction: row;
        gap: 20px;
        text-align: left;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Hide on Mobile */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on Desktop */
@media (min-width: 768px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Text Alignment */
@media (max-width: 767px) {
    .text-center-mobile {
        text-align: center !important;
    }
}

/* Spacing Utilities */
.spacing-mobile-sm {
    padding: 10px;
}

@media (min-width: 768px) {
    .spacing-mobile-sm {
        padding: 20px;
    }
}

/* ============================================
   TOUCH IMPROVEMENTS
   ============================================ */

/* Größere Touch-Targets auf Mobile */
@media (max-width: 767px) {
    button,
    a.te-btn,
    .te-action-button,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 20px;
    }
}

/* Tap Highlighting entfernen */
* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-tap-highlight-color: transparent;
}

/* Smoother Scrolling */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .no-print,
    header,
    footer,
    .sidebar,
    .te-refresh-btn,
    .te-tab-btn,
    .tournament-subnav {
        display: none !important;
    }

    .te-gathers-grid {
        grid-template-columns: 1fr !important;
    }

    body {
        background: white !important;
        color: black !important;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus Styles */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--te-accent, #FFD700);
    outline-offset: 2px;
}

/* Skip Link */
.skip-link:focus {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100000;
    padding: 15px 20px;
    background: var(--te-primary-start, #667eea);
    color: white;
    text-decoration: none;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
