/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablets and small desktops */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 65px; /* Adjust based on navbar height */
        left: 0;
        width: 100%;
        background-color: var(--primary-color);
        flex-direction: column;
        padding: 30px 20px;
        gap: 20px;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
        z-index: 1100; /* Higher than navbar and hero */
        text-align: center;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-menu.active {
        display: flex;
    }

    .hamburger {
        display: flex;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }

    .hero {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        padding: 0 15px !important;
        height: auto !important;
        min-height: 400px !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow: hidden !important;
        margin: 0 !important;
    }

    .hero-content {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 1 !important;
        margin: 0 auto !important;
        transform: none !important;
        box-sizing: border-box !important;
    }

    .hero h1 {
        font-size: 2.2em;
        line-height: 1.1;
        margin-bottom: 10px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Page Hero Adjustments */
    .page-hero {
        padding: 40px 15px !important;
    }

    .page-hero h1 {
        font-size: 2em !important;
    }

    /* Responsive Table Wrapper */
    .table-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 30px;
        border-radius: 10px;
        box-shadow: var(--shadow-sm);
    }

    .stats-table, .standings-table {
        min-width: 100%; /* Allow shrinking but use wrapper for scroll */
    }

    /* Stack tables on very small screens or handle overflow better */
    .table-wrapper {
        border: 1px solid var(--border-color);
    }

    .stats-table th, .stats-table td {
        padding: 10px 8px;
        font-size: 0.85em;
    }

    /* Hide less important columns on mobile if needed */
    @media (max-width: 480px) {
        .stats-table th:nth-child(5), 
        .stats-table td:nth-child(5),
        .stats-table th:nth-child(6),
        .stats-table td:nth-child(6) {
            display: none;
        }
    }

    .featured h2,
    .latest-matches h2,
    .teams-overview h2 {
        font-size: 2em;
    }

    .stat-card h3 {
        font-size: 2em;
    }

    .cta-content h2 {
        font-size: 2em;
    }

    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }

    .cta-buttons .btn {
        width: 100%;
        max-width: 300px;
    }

    .match-body {
        flex-direction: column;
        gap: 15px;
    }

    .vs {
        transform: rotate(0deg);
    }

    .teams-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    /* About Page Specifics */
    .about-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .timeline::before {
        left: 20px;
    }

    .timeline-item {
        grid-template-columns: 1fr;
        gap: 20px;
        padding-left: 50px;
    }

    .timeline-item:nth-child(odd) .timeline-content,
    .timeline-item:nth-child(even) .timeline-content {
        grid-column: 1;
    }

    .timeline-marker {
        left: 20px;
    }

    .values-grid, .org-grid {
        grid-template-columns: 1fr;
    }

    /* Schedule Page Mobile Refinement */
    .match-item {
        flex-direction: column;
        text-align: center;
        padding: 15px 12px;
    }

    .match-date {
        margin-bottom: 10px;
        width: 100%;
        max-width: 80px;
        margin-left: auto;
        margin-right: auto;
        padding: 5px;
    }

    .match-teams {
        flex-direction: column;
        gap: 8px;
    }

    .team-name {
        padding: 8px 15px;
        font-size: 0.95em;
    }

    .vs-text {
        padding: 3px 0;
        font-size: 0.85em;
    }

    .match-meta {
        justify-content: center;
        margin-top: 8px;
        font-size: 0.9em;
    }

    .match-status-badge {
        margin-top: 10px;
        align-self: center;
        padding: 4px 12px;
        font-size: 0.8em;
    }
}

/* Mobile devices */
@media (max-width: 480px) {
    .nav-logo span {
        display: none;
    }

    .nav-logo {
        font-size: 14px;
    }

    .hero {
        height: 350px;
    }

    .hero h1 {
        font-size: 1.6em;
        line-height: 1.2;
        padding: 0;
        margin-bottom: 5px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .hero p {
        font-size: 0.85em;
        padding: 0 10px;
        line-height: 1.4;
    }

    .page-hero h1 {
        font-size: 1.8em !important;
    }

    .featured,
    .latest-matches,
    .teams-overview,
    .cta-section {
        padding: 40px 15px;
    }

    .schedule-filters {
        padding: 0 20px;
        justify-content: center;
    }

    .featured h2,
    .latest-matches h2,
    .teams-overview h2 {
        font-size: 1.5em;
    }

    .featured-grid,
    .matches-grid,
    .teams-grid,
    .news-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card-large {
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card h3 {
        font-size: 1.5em;
    }

    .cta-content h2 {
        font-size: 1.5em;
    }

    .cta-content p {
        font-size: 0.95em;
    }

    /* Team & Champion Cards */
    .team-detail-card, .champion-card {
        margin: 0 -10px;
        border-radius: 0;
    }

    .champion-info h2 {
        font-size: 1.5em !important;
    }

    .footer-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .footer-section {
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }

    .match-card,
    .news-card {
        margin: 0 -15px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .news-content {
        padding: 15px;
    }

    .featured-card {
        padding: 20px 15px;
    }

    .cta-buttons {
        gap: 10px;
    }

    .nav-container {
        padding: 0 10px;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .hero h1 {
        font-size: 1.5em;
    }

    .featured-card h3 {
        font-size: 1.2em;
    }

    .featured-card p {
        font-size: 0.9em;
    }

    .cta-buttons .btn {
        padding: 10px 20px;
        font-size: 0.9em;
    }

    .stat-card h3 {
        font-size: 1.3em;
    }

    .stat-card p {
        font-size: 0.95em;
    }
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .cta-section {
        display: none;
    }

    body {
        background-color: white;
    }

    .container {
        max-width: 100%;
    }
}

/* High resolution displays */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }

    .featured-grid,
    .teams-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .matches-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}


/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn:hover,
    .featured-card:hover {
        transform: none;
    }

    .btn,
    .featured-card {
        transform: translate(0);
    }
}
