/* ============================================================
   USC-PLAN — Responsive Styles (Mobile & Tablet)
   ============================================================ */

/* Mobile Navbar Component */
.mobile-navbar {
    display: none;
}

/* === Tablet & Mobile Common / Overrides: <= 1024px === */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 24px 20px; }
    
    .mobile-navbar {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 10px 16px;
        background: var(--color-white);
        border-bottom: 1px solid var(--color-border);
        margin: -24px -20px 20px !important;
        box-shadow: var(--shadow-sm);
        position: sticky;
        top: 0;
        z-index: 80;
    }

    [data-theme="dark"] .mobile-navbar {
        background: #161B22;
        border-bottom-color: #30363D;
    }

    .mobile-navbar-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
    }

    .mobile-event-name {
        font-weight: 700;
        font-size: 0.9375rem;
        color: var(--color-text);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 200px;
    }

    .mobile-navbar-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }

    .mobile-navbar-actions .theme-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: var(--radius-md);
        background: var(--color-bg);
        border: 1px solid var(--color-border);
        cursor: pointer;
    }

    [data-theme="dark"] .mobile-navbar-actions .theme-toggle {
        background: #0D1117;
        border-color: #30363D;
    }

    .mobile-hamburger-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: var(--radius-md);
        background: var(--color-primary-light);
        border: 1px solid rgba(var(--color-primary-rgb), 0.2);
        color: var(--color-primary);
        cursor: pointer;
        transition: all var(--transition-fast);
    }

    [data-theme="dark"] .mobile-hamburger-btn {
        background: rgba(59, 130, 246, 0.15);
        border-color: rgba(59, 130, 246, 0.3);
        color: #60A5FA;
    }

    .hamburger { display: block !important; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .two-columns { grid-template-columns: 1fr; }
    .settings-row { grid-template-columns: 1fr; gap: 16px; }
    .hero h1 { font-size: 2rem; }
    .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .desktop-only { display: none !important; }

    .schedule-days-container {
        gap: 20px;
    }
    .schedule-day-column {
        flex: 1 1 calc(50% - 10px);
        min-width: 260px;
    }

    .modal {
        max-width: 92vw;
        max-height: 85vh;
    }

    .map-pin-title {
        opacity: 0;
        font-size: 0.6875rem;
        padding: 2px 6px;
    }
    .map-pin.active .map-pin-title {
        opacity: 1 !important;
        pointer-events: auto;
    }

    .page-header {
        gap: 12px;
    }
    .page-header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .tabs {
        overflow-x: visible;
    }

    .timeslot-filter-search {
        flex: 1 1 auto !important;
        height: auto !important;
        width: 100% !important;
    }
}

/* === Mobile: < 768px === */
@media (max-width: 767px) {
    body { font-size: 15px; }
    .sidebar { width: 280px; }
    .main-content { padding: 16px; }
    
    .mobile-navbar {
        margin: -16px -16px 16px !important;
        padding: 10px 14px;
    }
    .mobile-event-name {
        max-width: 150px;
        font-size: 0.875rem;
    }

    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header-actions { width: 100%; }
    .page-header-actions .btn { flex: 1; justify-content: center; }

    .grid-2, .grid-3, .settings-row { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .steps-grid { grid-template-columns: 1fr; }
    .features-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    
    .stat-card { padding: 12px 8px; }
    .stat-card .stat-label { font-size: 0.75rem; line-height: 1.25; }

    .hero { padding: 48px 16px; }
    .hero h1 { font-size: 1.625rem; }
    .hero p { font-size: 1rem; }
    .hero-buttons { flex-direction: column; align-items: center; }
    .hero-buttons .btn { width: 100%; max-width: 280px; }

    .section { padding: 40px 16px; }
    .section-title { font-size: 1.375rem; margin-bottom: 32px; }

    .navbar { display: flex; padding: 0 8px; gap: 4px; }
    .navbar-brand span { display: none; }
    .navbar-links { gap: 4px; }
    .navbar-links a { padding: 4px 6px !important; font-size: 0.8rem !important; }
    .navbar-links .text-muted.text-small { display: none; }
    .navbar-links .btn { padding: 4px 6px !important; font-size: 0.8rem !important; }
    .navbar-links .theme-toggle { padding: 4px !important; width: 32px !important; height: 32px !important; display: inline-flex !important; align-items: center; justify-content: center; }

    .chatbot-trigger {
        bottom: 16px !important;
        right: 16px !important;
        width: 48px !important;
        height: 48px !important;
    }
    .chatbot-trigger svg {
        width: 22px !important;
        height: 22px !important;
    }

    /* Tables → card layout on mobile */
    .table-mobile-cards thead { display: none; }
    .table-mobile-cards tbody tr {
        display: block;
        background: var(--color-white);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        padding: 12px 16px;
        margin-bottom: 8px;
    }
    .table-mobile-cards tbody td {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        padding: 6px 0;
        border: none;
        border-bottom: 1px solid var(--color-border-light, #f1f5f9);
        font-size: 0.875rem;
    }
    .table-mobile-cards tbody td:last-child {
        border-bottom: none;
    }
    .table-mobile-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--color-text-muted);
        font-size: 0.8125rem;
        flex-shrink: 0;
    }

    .cond-tags {
        padding-left: 0;
        margin-top: 4px;
    }

    .table-actions {
        justify-content: flex-end;
        width: 100%;
        margin-top: 4px;
    }

    /* Schedule grid → card layout */
    .schedule-grid-mobile {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .schedule-grid-mobile .schedule-row {
        margin-bottom: 0;
    }

    .modal-overlay { padding: 12px; }
    .modal { max-width: 100%; margin: 0; border-radius: var(--radius-md); max-height: 85vh; }
    .modal-body { padding: 16px; }
    .modal-header { padding: 16px; }
    .modal-footer { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .modal-footer .btn { flex: 1; }

    .toast-container { bottom: 80px; right: 12px; left: 12px; }
    .toast { min-width: auto; width: 100%; }

    .tabs { gap: 0; overflow-x: visible; flex-wrap: wrap; }
    .tab { padding: 10px 14px; font-size: 0.8125rem; }

    .pwa-install-btn span {
        display: none !important;
    }
    .pwa-install-btn {
        padding: 6px 8px !important;
        margin-right: 0 !important;
    }

    .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .toolbar-actions { justify-content: stretch; }
    .toolbar-actions .btn { flex: 1; justify-content: center; font-size: 0.8125rem; }

    .auth-card { padding: 24px; }

    .stat-card .stat-value { font-size: 1.5rem; }

    .step-indicator-label { display: none; }
    .step-indicator-line { width: 24px; }

    .legend { flex-direction: column; gap: 8px; }

    .schedule-days-container {
        flex-direction: column;
        gap: 20px;
    }
    .schedule-day-column {
        flex: 1 1 100%;
        width: 100%;
    }
    .legend-text-container {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .modal-title-time {
        display: block !important;
        margin-left: 0 !important;
        margin-top: 4px;
        font-size: 0.85em;
    }
    /* Step indicator & Form toggles optimization for mobile */
    .step-indicator {
        gap: 4px;
        margin-bottom: 24px;
    }
    .step-indicator-item {
        gap: 6px;
    }
    .step-indicator-dot {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
    .step-indicator-label {
        font-size: 0.75rem;
    }
    .step-indicator-line {
        width: 16px;
    }
    .duration-toggle-btn {
        padding: 8px 10px;
        font-size: 0.8125rem;
    }
}

/* === Print === */
@media print {
    .sidebar, .navbar, .hamburger, .bottom-nav, .toolbar, .toast-container,
    .btn, .modal-overlay, .sidebar-overlay { display: none !important; }
    .main-content { margin-left: 0; padding: 0; max-width: 100%; }
    body { background: white; font-size: 12px; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    table { font-size: 11px; }
    a { color: inherit; text-decoration: none; }
}
