/* =====================================================
   THE FIT CLUB COURTS
   Fully Corrected Responsive Design Engine
===================================================== */

/* Global Anti-Overflow Safety Lock */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* ==============================================
   TABLET LANDSCAPE / PORTRAIT PROFILE (<= 992px)
================================================= */
@media (max-width: 992px) {
    .footer-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero h1 {
        font-size: 32px;
    }
}

/* ==============================================
   SMARTPHONE & NATIVE MOBILE DISPLAYS (<= 768px)
================================================= */
@media (max-width: 768px) {
    
    /* Layout & Viewport Lock (Prevents Right Shift) */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        position: relative;
    }

    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
        box-sizing: border-box !important;
    }

    .card {
        padding: 12px 8px !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    /* Header & Navigation */
    .main-header {
        min-height: 70px !important;
    }
    
    .nav-container {
        height: 70px !important;
        padding: 10px 0 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .logo-img {
        height: 48px !important;
    }

    /* Mobile Navigation Menu */
    #nav-menu {
        position: absolute !important;
        top: 70px !important;
        left: 0 !important;
        width: 100% !important;
        max-height: calc(100vh - 70px) !important;
        overflow-y: auto !important;
        background: #ffffff !important;
        box-shadow: 0 15px 25px rgba(0, 0, 0, 0.1) !important;
        border-top: 1px solid #eee !important;
        display: none !important; 
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 9999 !important;
        height: auto !important;
    }

    #nav-menu.active {
        display: block !important;
    }

    #nav-menu ul {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        align-items: stretch !important;
        padding: 10px 0 !important;
        margin: 0 !important;
        list-style: none !important;
        width: 100% !important;
        background: #ffffff !important;
    }

    #nav-menu ul li {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
    }

    #nav-menu ul li a {
        display: block !important;
        padding: 16px 24px !important;
        font-size: 16px !important;
        color: #111 !important;
        border-bottom: 1px solid #f5f5f5 !important;
        font-weight: 500 !important;
        text-decoration: none !important;
        text-align: left !important;
        transition: background 0.2s ease;
    }

    #nav-menu ul li a:hover {
        background: #f9f9f9 !important;
    }

    /* Dropdowns & Profile Panel */
    .has-dropdown .dropdown-menu {
        position: static !important;
        box-shadow: none !important;
        width: 100% !important;
        background: #fdfdfd !important;
        border-radius: 0 !important;
        border: none !important;
        padding: 0 !important;
    }

    .has-dropdown .dropdown-menu li a {
        padding-left: 40px !important;
        font-size: 15px !important;
        background: #fcfcfc !important;
    }

    .profile-item {
        padding: 14px 24px !important;
        border-bottom: 1px solid #f5f5f5 !important;
        display: block !important;
    }
    
    .user-profile-nav {
        background: #f5f5f5 !important;
        display: inline-flex !important;
    }
    
    .nav-user-name {
        display: inline-block !important;
    }

    .menu-toggle {
        display: block !important;
        font-size: 24px !important;
        color: #111 !important;
        padding: 10px !important;
        z-index: 10000 !important;
        cursor: pointer !important;
    }

    .footer-container {
        grid-template-columns: 1fr !important;
        text-align: center !important;
    }

    .hero h1 {
        font-size: 26px !important;
    }

    /* Calendar & Dynamic Booking Form Containers */
    #calendar-container,
    #booking-details-container {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    .calendar-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    .calendar-table {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
    }

    .calendar-table th, 
    .calendar-table td {
        padding: 4px 1px !important;
        box-sizing: border-box !important;
    }

    .calendar-day {
        padding: 4px 2px !important;
        min-height: 52px !important;
    }

    .calendar-day div:first-child {
        font-size: 13px !important;
    }

    .calendar-day div[onclick] {
        margin-top: 2px !important;
    }

    .calendar-day div[onclick] div {
        font-size: 8.5px !important;
        padding: 1px 0 !important;
        letter-spacing: -0.3px;
    }

    .time-slots-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    /* Open Play Rows & Inputs Full-Width Expansion */
    .player-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .player-row .player-name-input {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .radio-group {
        justify-content: flex-start;
    }
}

/* ==============================================
   MINIMAL WIREFRAME / ULTRA-SMALL SCREENS (<= 480px)
================================================= */
@media (max-width: 480px) {
    .btn {
        padding: 10px 18px;
        font-size: 14px;
    }

    .logo {
        font-size: 16px;
    }
}

/* ==============================================
   SMALL MOBILE DISPLAY BREAKPOINT (<= 400px)
================================================= */
@media (max-width: 400px) {
    .calendar-day {
        min-height: 50px !important;
    }

    .time-slots-grid {
        grid-template-columns: 1fr !important;
    }
}

/* =====================================================
   GENERAL CALENDAR WRAPPER (DEFAULT DESKTOP / TABLET)
===================================================== */
.calendar-wrapper {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.calendar-table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed;
    border-collapse: collapse;
}

.calendar-table td, 
.calendar-table th {
    box-sizing: border-box;
}