/* Mobile styles */
@media (max-width: 768px) {
    /* Side Menu */
    .side-menu {
        display: none; /* Hide the large side menu on mobile */
    }

    /* 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;
    }

    /* ==========================================
       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;
    }

}

