/* ── MOBILE-RESPONSIVE SHARED STYLES ── */

/* === NAV OVERRIDES === */
@media (max-width: 768px) {
    .nav { height: 56px !important; }
    .nav-inner { padding: 0 16px !important; }
    .page { padding-top: calc(56px + 16px) !important; padding-left: 16px !important; padding-right: 16px !important; }

    /* Hide desktop nav links on mobile */
    .nav-links { display: none !important; }

    /* Hamburger button */
    .hamburger-btn {
        display: flex !important;
        width: 44px;
        height: 44px;
        border-radius: 10px;
        border: 1px solid var(--border);
        background: var(--surface-2);
        color: var(--text);
        cursor: pointer;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        flex-shrink: 0;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        transition: border-color 0.15s, background 0.15s;
        padding: 0;
    }
    .hamburger-btn:active {
        background: var(--accent-dim);
        border-color: var(--accent);
    }
}

/* Desktop: hide hamburger */
.hamburger-btn { display: none !important; }

/* === MOBILE NAV OVERLAY === */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s;
}
.nav-overlay.open {
    display: block;
    opacity: 1;
}

/* Nav drawer */
.nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--surface);
    border-left: 1px solid var(--border);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.25s ease-in-out;
    display: flex;
    flex-direction: column;
    padding: 20px 0 24px;
    overflow-y: auto;
}
.nav-overlay.open .nav-drawer {
    transform: translateX(0);
}
.nav-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.nav-drawer-shop {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.nav-drawer-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.nav-drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.nav-drawer-links {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
}
.nav-drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 12px;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
}
.nav-drawer-link:active {
    background: var(--accent-dim);
    color: var(--accent);
}
.nav-drawer-link.active {
    color: var(--accent);
    background: var(--accent-dim);
}
.nav-drawer-link .link-icon { font-size: 18px; width: 24px; text-align: center; }
.nav-drawer-link .link-text { flex: 1; }
.nav-drawer-divider { height: 1px; background: var(--border); margin: 8px 20px; }
.nav-drawer-bottom { margin-top: auto; padding: 12px 12px 0; }
.nav-drawer-signout {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 12px;
    border-radius: 10px;
    color: var(--red);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    min-height: 44px;
    transition: background 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.nav-drawer-signout:active { background: rgba(239,68,68,0.1); }

/* === BOTTOM NAV === */
@media (max-width: 768px) {
    body { padding-bottom: 72px !important; }

    .bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 199;
        background: rgba(10,10,10,0.92);
        backdrop-filter: blur(16px);
        border-top: 1px solid var(--border);
        padding: 6px 0;
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    }
    .bottom-nav-inner {
        display: flex;
        width: 100%;
        justify-content: space-around;
        align-items: center;
    }
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: 8px 12px;
        border-radius: 12px;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 10px;
        font-weight: 500;
        transition: color 0.15s;
        min-width: 60px;
        min-height: 44px;
        justify-content: center;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    .bottom-nav-item:active { background: var(--surface-2); }
    .bottom-nav-item.active { color: var(--accent); }
    .bottom-nav-item .bn-icon { font-size: 20px; line-height: 1; }
}
.bottom-nav { display: none; }

/* === RESPONSIVE GRIDS === */
@media (max-width: 768px) {
    .stats-row { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
}
@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr !important; }
    .page { padding-left: 12px !important; padding-right: 12px !important; }
}

/* === BOOKING URL BANNER === */
@media (max-width: 600px) {
    .booking-url-banner { flex-direction: column !important; align-items: flex-start !important; }
    .booking-url-actions { width: 100% !important; }
    .booking-url-actions .url-action-btn { flex: 1 !important; justify-content: center !important; }
}

/* === TABLES → CARD STACK (375px iPhone SE) === */
@media (max-width: 600px) {
    /* Force horizontal scroll on all tables but style it well */
    .appt-table-scroll,
    .invoice-table,
    .reminders-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .appt-table-scroll table,
    .invoice-table table,
    .reminders-table table {
        min-width: 600px;
    }
}

/* === BAY GRID MOBILE === */
@media (max-width: 600px) {
    .bay-grid { min-width: 800px; }
    .bay-schedule-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* === TOUCH TARGETS === */
@media (max-width: 768px) {
    /* Ensure all interactive elements are at least 44px */
    .action-btn,
    .tab,
    .filter-btn,
    .btn,
    button:not(.nav-drawer-close):not(.hamburger-btn) {
        min-height: 44px;
        min-width: 44px;
    }
    .fab {
        bottom: 88px !important;
        right: 16px !important;
    }
}

/* === MODAL MOBILE === */
@media (max-width: 600px) {
    .modal { max-width: 100% !important; border-radius: 16px 16px 0 0 !important; max-height: 95vh; }
    .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
    .modal-overlay.open .modal { transform: translateY(0) !important; }
}

/* === PAGE HEADER MOBILE === */
@media (max-width: 480px) {
    .page-title { font-size: 22px !important; }
    .page-header { flex-direction: column !important; align-items: flex-start !important; }
}

/* === FORM ROWS === */
@media (max-width: 480px) {
    .form-row { grid-template-columns: 1fr !important; }
}

/* === INVOICE CARDS (375px) === */
@media (max-width: 600px) {
    .invoice-table-wrap {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        overflow: hidden;
    }
    .invoice-list-cards {
        display: none;
    }
}

/* === DATE BAR MOBILE === */
@media (max-width: 480px) {
    .date-bar {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    .date-display { font-size: 18px !important; }
}

/* === SETUP WIZARD MOBILE === */
@media (max-width: 600px) {
    .wizard-progress { flex-wrap: wrap !important; gap: 8px !important; }
    .wizard-card { padding: 20px !important; }
}

/* === HIDE WEB-ONLY ELEMENTS ON MOBILE === */
@media (max-width: 768px) {
    .web-only { display: none !important; }
}

/* === BAY STATUS LEGEND === */
@media (max-width: 480px) {
    .bay-schedule-header .legend { display: none !important; }
}

/* === MODAL BODY PADDING === */
@media (max-width: 600px) {
    .modal-head { padding: 16px !important; }
    .modal-body { padding: 16px !important; }
}

/* === FILTER ROW MOBILE === */
@media (max-width: 480px) {
    .filter-row { gap: 6px !important; }
    .filter-btn { padding: 5px 10px !important; font-size: 12px !important; }
}

/* === STAT CARDS ON MOBILE === */
@media (max-width: 480px) {
    .stat-card { padding: 16px !important; }
    .stat-value { font-size: 26px !important; }
}

/* === SLUG MODAL MOBILE === */
@media (max-width: 480px) {
    .modal-box { padding: 20px !important; }
    .modal-title { font-size: 1rem !important; }
    .slug-prefix { font-size: 0.7rem !important; padding: 10px 8px !important; }
}