/**
 * PGATC Stats Website - Responsive Styles
 *
 * Mobile-first responsive design with breakpoints:
 * - Small (sm): 576px
 * - Medium (md): 768px
 * - Large (lg): 992px
 * - Extra Large (xl): 1200px
 */

/* ============================================================================
   MOBILE FIRST BASE (< 576px)
   ============================================================================ */

/* Page content adjustments for mobile */
.page-content {
    margin: 0;
}

/* Typography adjustments for mobile */
.page-title {
    font-size: var(--text-2xl);
}

.banner-title {
    font-size: var(--text-2xl);
}

.section-title {
    font-size: var(--text-xl);
}

/* Stack grids on mobile */
.grid-cols-2,
.grid-cols-3,
.grid-cols-4 {
    grid-template-columns: 1fr;
}

/* Full width cards on mobile */
.nav-card {
    width: 100%;
}

/* Stack header on mobile */
.header-container {
    flex-direction: column;
    gap: var(--space-4);
}

.header-nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

/* Mobile-friendly table */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Card-style table on mobile */
.table-mobile-cards {
    display: block;
}

.table-mobile-cards thead {
    display: none;
}

.table-mobile-cards tbody {
    display: block;
}

.table-mobile-cards tr {
    display: block;
    background-color: var(--color-white);
    margin-bottom: var(--space-4);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-4);
}

.table-mobile-cards td {
    display: flex;
    justify-content: space-between;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-gray-100);
}

.table-mobile-cards td:last-child {
    border-bottom: none;
}

.table-mobile-cards td::before {
    content: attr(data-label);
    font-weight: var(--font-semibold);
    color: var(--color-gray-600);
    margin-right: var(--space-4);
}

/* Touch-friendly button sizes */
.btn {
    min-height: 44px;
    min-width: 44px;
}

/* Full-width buttons on mobile */
.btn-mobile-full {
    width: 100%;
    justify-content: center;
}

/* Stack club buttons */
.club-buttons-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

/* Adjust stat cards for mobile */
.stat-card {
    padding: var(--space-4);
}

.stat-card-value {
    font-size: var(--text-2xl);
}

/* Footer stacked on mobile */
.footer-content {
    flex-direction: column;
    text-align: center;
    gap: var(--space-6);
}

.footer-links {
    flex-direction: column;
    gap: var(--space-3);
}

/* Page header stacked */
.page-header-flex {
    flex-direction: column;
    align-items: flex-start;
}

.page-header-actions {
    width: 100%;
}

.page-header-actions .btn {
    flex: 1;
}

/* Search adjustments */
.search-input-group {
    flex-direction: column;
}

.search-input,
.search-button {
    border-radius: var(--border-radius-md);
}

.search-input {
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
}

.search-button {
    border-radius: 0 0 var(--border-radius-md) var(--border-radius-md);
}

/* Hide on mobile */
.hide-mobile {
    display: none !important;
}

/* ============================================================================
   SMALL SCREENS (>= 576px)
   ============================================================================ */

@media (min-width: 576px) {
    /* Show small screen elements */
    .show-sm {
        display: block !important;
    }

    .hide-sm {
        display: none !important;
    }

    /* 2-column grids */
    .grid-cols-2,
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Search inline */
    .search-input-group {
        flex-direction: row;
    }

    .search-input {
        border-radius: var(--border-radius-md) 0 0 var(--border-radius-md);
    }

    .search-button {
        border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
    }

    /* Club buttons 2-up */
    .club-buttons-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        justify-items: center;
    }
}

/* ============================================================================
   MEDIUM SCREENS (>= 768px)
   ============================================================================ */

@media (min-width: 768px) {
    /* Typography */
    .page-title {
        font-size: var(--text-3xl);
    }

    .banner-title {
        font-size: var(--text-3xl);
    }

    .section-title {
        font-size: var(--text-2xl);
    }

    /* Show medium screen elements */
    .show-md {
        display: block !important;
    }

    .hide-md {
        display: none !important;
    }

    /* Show on mobile only */
    .hide-mobile {
        display: block !important;
    }

    .show-mobile {
        display: none !important;
    }

    /* Header inline */
    .header-container {
        flex-direction: row;
    }

    .header-nav {
        width: auto;
    }

    /* 3-column grids */
    .grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Stats grid */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Two column layout */
    .two-column {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Footer inline */
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }

    .footer-links {
        flex-direction: row;
        gap: var(--space-6);
    }

    /* Page header inline */
    .page-header-flex {
        flex-direction: row;
        align-items: flex-start;
    }

    .page-header-actions {
        width: auto;
    }

    .page-header-actions .btn {
        flex: none;
    }

    /* Standard table display */
    .table-mobile-cards thead {
        display: table-header-group;
    }

    .table-mobile-cards tbody {
        display: table-row-group;
    }

    .table-mobile-cards tr {
        display: table-row;
        margin-bottom: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
    }

    .table-mobile-cards td {
        display: table-cell;
        padding: var(--space-3) var(--space-4);
    }

    .table-mobile-cards td::before {
        display: none;
    }

    /* Club buttons 4-up */
    .club-buttons-grid {
        grid-template-columns: repeat(4, 1fr);
        justify-items: center;
    }
}

/* ============================================================================
   LARGE SCREENS (>= 992px)
   ============================================================================ */

@media (min-width: 992px) {
    /* Typography */
    .banner-title {
        font-size: var(--text-4xl);
    }

    /* Show large screen elements */
    .show-lg {
        display: block !important;
    }

    .hide-lg {
        display: none !important;
    }

    /* 4-column grids */
    .grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Sidebar layout */
    .sidebar-layout {
        grid-template-columns: 280px 1fr;
    }

    /* Navigation cards larger */
    .nav-card {
        padding: var(--space-8);
    }

    .nav-card-icon {
        font-size: 3rem;
    }
}

/* ============================================================================
   EXTRA LARGE SCREENS (>= 1200px)
   ============================================================================ */

@media (min-width: 1200px) {
    /* Show extra large screen elements */
    .show-xl {
        display: block !important;
    }

    .hide-xl {
        display: none !important;
    }

    /* Larger container padding */
    .container {
        padding-left: var(--space-6);
        padding-right: var(--space-6);
    }

    /* Wider sidebar */
    .sidebar-layout {
        grid-template-columns: 320px 1fr;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    /* Reset colors for print */
    body {
        background: white;
        color: black;
    }

    /* Hide navigation and interactive elements */
    .header,
    .footer,
    .nav-back,
    .btn,
    .search-input-group {
        display: none !important;
    }

    /* Full width for content */
    .container {
        max-width: 100%;
        padding: 0;
    }

    /* Remove shadows and decorative elements */
    .card,
    .stat-card,
    .tournament-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    /* Page breaks */
    .table {
        page-break-inside: avoid;
    }

    tr {
        page-break-inside: avoid;
    }

    /* Links show URL */
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }

    a[href^="#"]::after,
    a[href^="javascript:"]::after {
        content: "";
    }
}

/* ============================================================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================================================ */

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --color-primary-600: #0000cc;
        --color-secondary-600: #006600;
        --color-gray-500: #555555;
    }

    .btn,
    .card,
    .table td,
    .table th {
        border-width: 2px;
    }
}

/* ============================================================================
   ORIENTATION SPECIFIC
   ============================================================================ */

/* Landscape phone optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .banner {
        padding: var(--space-4);
    }

    .banner-title {
        font-size: var(--text-xl);
    }

    .page-content {
        padding-top: var(--space-4);
        padding-bottom: var(--space-6);
    }
}

/* ============================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================================================ */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 48px;
        padding: var(--space-3) var(--space-5);
    }

    .tab {
        padding: var(--space-4) var(--space-5);
    }

    /* Remove hover effects that don't work well on touch */
    .card:hover,
    .tournament-card:hover,
    .nav-card:hover {
        transform: none;
    }

    /* Add active states instead */
    .card:active,
    .tournament-card:active,
    .nav-card:active {
        transform: scale(0.98);
    }

    /* Larger table tap targets */
    .table td {
        padding: var(--space-4);
    }
}
