/* Desktop styles */
@media (min-width: 769px) {
    .nav-toggle {
        display: none !important;
    }
}

nav ul {
    display: flex;
    align-items: center;
}

/* Mobile styles */
@media (max-width: 768px) {
    /* Register page overrides */
    body:has(.register-container) nav ul,
    body:has(.register-form) nav ul,
    body:has(.registration-container) nav ul {
        display: none !important;
    }

    body:has(.register-container) main,
    body:has(.register-form) main,
    body:has(.registration-container) main {
        padding-top: 0 !important;
    }

    body.register-page .ribbon-nav-container,
    body.registration-page .ribbon-nav-container {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        position: absolute !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
    }

    body:has(.register-container) .nav-toggle,
    body:has(.register-form) .nav-toggle,
    body:has(.registration-container) .nav-toggle {
        display: none !important;
    }

    /* Side Menu */
    .side-menu {
        display: none; /* Hide the large side menu on mobile */
    }

    /* Navigation bar styling */
    nav, header {
        position: relative;
        width: 100%;
        z-index: 1000;
        background-color: #2b2b2b;
    }

    nav {
        min-height: 60px;
        padding: 10px 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 15px;
        height: 60px;
    }

    /* Hide ribbon navigation on login page */
    body:has(.login-form) .ribbon-nav-container {
        display: none !important;
    }

    /* Adjust main content padding on login page */
    body:has(.login-form) main {
        padding-top: 0 !important;
    }

    /* Position ribbon below nav */
    .ribbon-nav-container {
        position: relative;
        top: auto;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 990;
        margin-top: 0;
        background-color: #e0e0e0;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        display: block !important; /* Force display */
        visibility: visible !important; /* Ensure visibility */
    }

    /* Main content adjustments */
    main {
        padding-top: 0;
        margin-top: 0;
        margin-bottom: 0;
    }

    body:has(.faq-container) main {
        padding-top: 0 !important;
    }

    /* Feature image mobile optimization */
    .feature-image-container {
        width: 100%;
        margin: 2rem 0;
        padding: 0;
        box-sizing: border-box;
    }

    .feature-image {
        width: 100%;
        height: auto;
        display: block;
        object-fit: contain;
        border-radius: 8px;
    }

    /* ==========================================
       HAMBURGER MENU BUTTON STYLING
       ========================================== */
    
    .nav-toggle {
        display: block;
        color: white;
        font-size: 28px;
        cursor: pointer;
        z-index: 1001;
        padding: 8px 12px;
        border-radius: 6px;
        border: 2px solid transparent;
        background-color: transparent;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
        position: relative;
        flex-shrink: 0;
    }

    .nav-toggle:active {
        background-color: rgba(255, 255, 255, 0.15);
        border-color: rgba(255, 255, 255, 0.3);
        transform: scale(0.95);
    }

    .nav-toggle:active::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: 6px;
        background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
        animation: hamburger-ripple 0.6s ease-out;
    }

    @keyframes hamburger-ripple {
        0% {
            transform: scale(0.5);
            opacity: 1;
        }
        100% {
            transform: scale(2.5);
            opacity: 0;
        }
    }

    /* ==========================================
       MOBILE NAVIGATION DROPDOWN
       ========================================== */

    nav ul {
        position: absolute;
        top: 60px;
        right: 15px;
        left: auto;
        background: #2b2b2b;
        flex-direction: column;
        width: 220px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        z-index: 1000;
        padding: 0;
        max-height: 40vh;
        overflow-y: auto;
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
        margin: 0;
        border-radius: 0 0 8px 8px;
    }

    nav ul.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        display: flex;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    }

    nav ul li {
        width: 100%;
        text-align: left;
        padding: 0;
        margin: 0;
        border-bottom: 1px solid #444;
        list-style: none;
    }

    nav ul li:last-child {
        border-bottom: none;
    }

    /* ==========================================
       NAVIGATION LINK STYLING
       ========================================== */

    nav ul li a {
        padding: 12px 20px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        height: 100%;
        width: 100%;
        color: white;
        text-decoration: none;
        font-size: 15px;
        line-height: 1.4;
        transition: all 0.25s ease;
        position: relative;
        box-sizing: border-box;
    }

    nav ul li a:hover {
        background-color: rgba(255, 255, 255, 0.08);
    }

    nav ul li a:active {
        background-color: rgba(255, 255, 255, 0.15);
        transform: scale(0.98);
    }

    /* Active link highlighting - style current page navigation link */
    nav ul li a[href*="/"] {
        position: relative;
    }

    /* Subtle underline indicator for better visual feedback */
    nav ul li a::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 0;
        height: 2px;
        background-color: #c8a951;
        transition: width 0.3s ease;
    }

    nav ul li a:hover::after {
        width: 100%;
    }

    /* Button styling in nav (logout) */
    nav ul li form {
        padding: 10px 20px;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }

    nav ul li button,
    .logout {
        padding: 10px 16px;
        margin: 0;
        font-size: 14px;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        background: #6c757d;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        transition: all 0.25s ease;
        box-sizing: border-box;
    }

    nav ul li button:hover,
    .logout:hover {
        background: #5a6268;
    }

    nav ul li button:active,
    .logout:active {
        background: #4e555b;
        transform: scale(0.98);
    }

    /* ==========================================
       BRAND AND NAVIGATION CONTAINER
       ========================================== */

    .brand-container {
        display: flex;
        align-items: center;
        height: 100%;
        max-width: calc(100% - 60px);
        gap: 10px;
    }

    .brand-container img,
    .nav-header-container .brand-container img {
        width: 40px !important;
        height: 40px !important;
        margin-right: 0;
    }

    .brand-container span,
    .nav-header-container .brand-container span {
        font-family: 'Playfair Display', Georgia, serif;
        font-size: 1rem;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: white;
    }

    /* ==========================================
       RIBBON NAVIGATION
       ========================================== */

    .ribbon-nav-container {
        position: relative;
        top: auto;
        left: 0;
        right: 0;
        z-index: 999;
        background: #e0e0e0;
        margin-top: 0;
        padding-top: 0;
    }

    .ribbon-nav {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px;
        gap: 15px;
    }

    .ribbon-nav a {
        white-space: nowrap;
        padding: 8px 15px;
        transition: all 0.2s ease;
        border-radius: 4px;
    }

    .ribbon-nav a:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    /* ==========================================
       BOTTOM NAVIGATION
       ========================================== */

    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: white;
        border-top: 1px solid #eee;
        display: flex;
        justify-content: space-around;
        height: 50px;
        z-index: 1000;
    }

    .bottom-nav a {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #333333;
        text-decoration: none;
        font-size: 14px;
        padding: 5px;
        transition: all 0.2s ease;
    }

    .bottom-nav a:active {
        background-color: rgba(26, 86, 50, 0.1);
    }

    /* ==========================================
       CONTENT STYLING
       ========================================== */

    .main-content {
        padding: 15px;
        margin-bottom: 60px; /* Space for bottom nav */
    }

    .league-title {
        font-size: 24px;
        margin: 0 0 20px 0;
        padding: 0;
    }

    .countdown-container {
        background: white;
        border-radius: 8px;
        padding: 20px;
        margin-bottom: 20px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    /* ==========================================
       STANDINGS TABLE
       ========================================== */

    .standings-table {
        width: 100%;
        margin-bottom: 20px;
        background: white;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .standings-table th,
    .standings-table td {
        padding: 12px 8px;
        text-align: left;
        border-bottom: 1px solid #eee;
    }

    .standings-table th {
        background: #f5f5f5;
        font-weight: 500;
    }

    /* All Table Containers - Universal Styling */
    .schedule-container,
    .standings-container,
    .table-responsive,
    .league-overview table {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 20px;
        padding: 0;
        display: block;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    /* All Tables - Universal Styling */
    .schedule-container table,
    .standings-container table,
    .table-responsive table,
    .league-overview table {
        display: table;
        width: 100%;
        min-width: 600px;
        margin: 0;
        border-collapse: collapse;
    }

    /* League Details Page Specific Styling */
    .league-overview table.standings-table {
        min-width: 100%;
        width: 100%;
    }

    .league-overview .schedule-container table.standings-table {
        min-width: 650px; /* Ensure proper scrolling on smaller screens */
    }

    /* Player Column */
    .player-column {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .player-logo {
        width: 30px;
        height: 30px;
        border-radius: 50%;
    }

    /* Season Table */
    .season-table-container {
        background: white;
        border-radius: 8px;
        overflow: hidden;
        margin-bottom: 20px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .season-table {
        width: 100%;
    }

    .season-table th,
    .season-table td {
        padding: 12px 8px;
        text-align: left;
        border-bottom: 1px solid #eee;
    }

    .season-table th {
        background: #f5f5f5;
        font-weight: 500;
        white-space: nowrap;
    }

    /* Section Headers */
    .section-title {
        font-size: 20px;
        margin: 20px 0 15px 0;
    }

    /* ==========================================
       FOOTER
       ========================================== */

    footer {
        background-color: #333333;
        color: white;
        padding: 2rem 0;
        margin-top: 2rem;
        width: 100vw;
        position: relative;
        left: 0;
        right: 0;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
    }

    footer .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 15px;
    }

    .footer-content {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 2rem;
    }

    .footer-column {
        flex: 1;
        min-width: 250px;
    }

    .footer-column h4 {
        color: white;
        font-size: 1.1rem;
        margin-bottom: 1rem;
        font-weight: 500;
    }

    .footer-column p {
        color: #ccc;
        font-size: 0.9rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }

    .footer-column ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .footer-column ul li {
        margin-bottom: 0.5rem;
    }

    .footer-column ul li a {
        color: #ccc;
        text-decoration: none;
        font-size: 0.9rem;
        transition: color 0.2s;
    }

    .footer-column ul li a:hover {
        color: white;
    }

    .logo-container {
        margin-bottom: 1rem;
    }

    .footer-column {
        flex: 100%;
        text-align: left;
        margin-bottom: 1rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
    }

    footer p {
        font-size: 0.65rem;
        margin: 0;
        text-align: left;
    }

    footer .button {
        background: #1a5632;
        color: white;
        padding: 3px 6px;
        border-radius: 0.25rem;
        text-decoration: none;
        font-size: 0.65rem;
        border: none;
        cursor: pointer;
        transition: background-color 0.2s;
        margin-left: 8px;
        float: right;
    }

    footer .button:hover {
        background: #047857;
    }

    /* Ensure content doesn't get hidden behind footer */
    html, body {
        height: 100%;
        margin: 0;
        padding: 0;
        overflow-x: hidden;
    }

    body {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    main {
        flex: 1 0 auto;
    }

    footer,
    .site-footer {
        flex-shrink: 0;
        margin-top: auto;
        position: relative;
        width: 100%;
    }

    /* Contact Button */
    .contact-button {
        display: inline-block;
        padding: 10px 20px;
        background: #28a745;
        color: white;
        border-radius: 5px;
        text-decoration: none;
        margin: 10px auto;
    }

    /* Previous/Next Navigation */
    .matchup-nav {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: 15px 0;
        padding: 10px;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .matchup-nav button {
        padding: 8px 15px;
        border: none;
        border-radius: 5px;
        background: #1a5632;
        color: white;
        font-size: 14px;
        transition: all 0.2s ease;
    }

    .matchup-nav button:hover {
        background: #2d8a4e;
    }

    /* ==========================================
       TABLES - ADVANCED STYLING
       ========================================== */

    /* Mobile-specific table scrolling styles */
    .mobile-table-wrapper,
    .schedule-container,
    .standings-scroll-container,
    .mobile-schedule-container .scrollable-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 20px;
        background-color: white;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        padding: 0;
        display: block;
        position: relative;
        max-width: 100%;
    }

    /* Reduce min-width for better mobile experience */
    .league-standings-table {
        min-width: 650px !important;
    }

    /* League standings table text wrapping and hover effects */
    .league-standings-table th,
    .league-standings-table td {
        white-space: normal !important;
        word-wrap: break-word !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
        font-size: 14px;
        padding: 8px 4px !important;
        vertical-align: middle !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
        transition: background-color 0.2s ease !important;
    }

    /* Mobile hover effect for standings table */
    .league-standings-table tr {
        cursor: pointer !important;
    }

    .league-standings-table tr:active,
    .league-standings-table tr:hover {
        background-color: rgba(0, 0, 0, 0.05) !important;
    }

    /* Add touch feedback */
    .league-standings-table tr:active td {
        background-color: rgba(0, 0, 0, 0.1) !important;
    }

    /* Apply specific widths to standings columns for better mobile display */
    .league-standings-table th:nth-child(1),
    .league-standings-table td:nth-child(1) {
        width: 8% !important;
        min-width: 30px !important;
    }

    .league-standings-table th:nth-child(2),
    .league-standings-table td:nth-child(2) {
        width: 80px !important;
        min-width: 80px !important;
    }

    /* Common styling for table columns */
    .league-standings-table th:nth-child(3),  /* W-L-T */
    .league-standings-table td:nth-child(3),
    .league-standings-table th:nth-child(4),  /* Points */
    .league-standings-table td:nth-child(4),
    .league-standings-table th:nth-child(5),  /* Win % */
    .league-standings-table td:nth-child(5),
    .league-standings-table th:nth-child(6),  /* Avg Gross Score */
    .league-standings-table td:nth-child(6),
    .league-standings-table th:nth-child(7),  /* Avg Net Score */
    .league-standings-table td:nth-child(7),
    .league-standings-table th:nth-child(8),  /* Avg Opp Net Score */
    .league-standings-table td:nth-child(8) {
        max-width: 70px !important;
        min-width: 70px !important;
        width: 70px !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
        font-size: 14px !important;
        padding: 4px !important;
        line-height: 1.2 !important;
        border: none !important;
        border-bottom: 1px solid #eee !important;
        vertical-align: middle !important;
    }

    /* Target specifically the Avg Net Score and Avg Opp Net Score columns */
    .league-standings-table th:nth-child(6),
    .league-standings-table th:nth-child(7),
    .league-standings-table td:nth-child(6),
    .league-standings-table td:nth-child(7),
    table.league-standings-table th:nth-child(6),
    table.league-standings-table th:nth-child(7),
    table.league-standings-table td:nth-child(6),
    table.league-standings-table td:nth-child(7),
    .standings-scroll-container table.league-standings-table th:nth-child(6),
    .standings-scroll-container table.league-standings-table th:nth-child(7),
    .standings-scroll-container table.league-standings-table td:nth-child(6),
    .standings-scroll-container table.league-standings-table td:nth-child(7) {
        max-width: 70px !important;
        min-width: 70px !important;
        width: 70px !important;
        padding: 4px;
        line-height: 1.2 !important;
    }

    /* Use higher CSS specificity for mobile */
    .league-standings-table tr th:nth-child(6),
    .league-standings-table tr td:nth-child(6),
    .league-standings-table tr th:nth-child(7),
    .league-standings-table tr td:nth-child(7) {
        white-space: normal !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 70px !important;
        width: 70px !important;
        font-size: 14px;
        padding: 6px 4px;
        line-height: 1.2 !important;
    }

    /* Ensure column widths are explicitly defined for all columns in mobile view */
    .league-standings-table th:nth-child(1),
    .league-standings-table td:nth-child(1) {
        width: 10% !important;
        min-width: 40px !important;
    }

    .league-standings-table th:nth-child(2),
    .league-standings-table td:nth-child(2) {
        width: 26% !important;
        min-width: 100px !important;
        text-align: left !important;
    }

    .league-standings-table th:nth-child(3),
    .league-standings-table td:nth-child(3),
    .league-standings-table th:nth-child(4),
    .league-standings-table td:nth-child(4),
    .league-standings-table th:nth-child(5),
    .league-standings-table td:nth-child(5) {
        width: 12% !important;
        min-width: 50px !important;
    }

    /* Apply !important to all text properties to ensure they override any inline styles */
    .league-standings-table * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Additional display property to prevent any flexbox issues */
    .league-standings-table tr, 
    .league-standings-table th, 
    .league-standings-table td {
        display: table-cell !important;
    }

    .league-standings-table tr {
        display: table-row !important;
    }

    /* Additional fix for the opp-net-score-col */
    .opp-net-score-col {
        white-space: normal !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 70px !important;
        width: 70px !important;
        font-size: 14px;
        padding: 4px;
        hyphens: auto !important;
        min-height: 50px !important;
    }
}

@media (max-width: 768px) {
    .open-leagues-table thead {
        display: none;
    }
    .open-leagues-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 10px;
        background: #fafafa;
    }
    .open-leagues-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 8px !important;
        text-align: right !important;
        border-bottom: 1px solid #f0f0f0;
    }
    .open-leagues-table tbody td:last-child {
        border-bottom: none;
        justify-content: center;
        padding-top: 10px !important;
    }
    .open-leagues-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #333;
        text-align: left;
        margin-right: 10px;
    }

    .desktop-schedule {
        display: none !important;
    }

    .mobile-schedule {
        display: block !important;
    }

    .match-card {
        background: white;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 14px 16px;
        margin-bottom: 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }

    .match-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
    }

    .match-card-label {
        font-weight: 700;
        font-size: 14px;
        color: #1a5632;
    }

    .match-card-date {
        font-size: 13px;
        color: #666;
    }

    .match-card-players {
        font-size: 15px;
        color: #333;
        padding: 6px 0;
        border-top: 1px solid #eee;
        line-height: 1.4;
    }

    .match-card-actions {
        display: flex;
        gap: 8px;
        margin-top: 10px;
        flex-wrap: wrap;
    }

    .match-card-actions:empty {
        display: none;
    }

    .match-card-actions .button {
        padding: 8px 14px;
        border-radius: 5px;
        text-decoration: none;
        font-weight: 500;
        display: inline-block;
    }

    .match-card-row {
        padding: 10px 0;
        border-top: 1px solid #eee;
    }

    .match-card-row:last-child {
        padding-bottom: 0;
    }

    .match-card-row .match-card-players {
        border-top: none;
        padding-top: 0;
    }
}

.mobile-schedule {
    display: none;
}
