/**
 * Splash360 Tour - Modern Arabic Egyptian Design System & Style Guide
 * Fully Responsive, RTL Native, Glassmorphism, Micro-Animations
 */

@import url('https://fonts.googleapis.com/css2?family=Alexandria:wght@300;400;500;600;700;800&display=swap');

/* =====================================================
   1. RESET & CORE VARIABLES (LIGHT & DARK THEMES)
   ===================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root, [data-theme="light"] {
    /* Brand Colors - Modern Technical SaaS Palette */
    --primary: #2563eb;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-glow: rgba(37, 99, 235, 0.25);
    --danger-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    
    --accent: #0284c7;
    --accent-hover: #0369a1;

    --success: #10b981;
    --success-light: #ecfdf5;
    
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    
    --danger: #ef4444;
    --danger-light: #fef2f2;

    /* Light Theme Surface & Text */
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.88);
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #2563eb;

    --text-main: #0f172a;
    --text-muted: #475569;
    --text-light: #64748b;
    --text-white: #ffffff;

    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 35px -10px rgba(15, 23, 42, 0.12);
    --shadow-glow: 0 0 25px rgba(37, 99, 235, 0.25);

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Dark Theme Surface & Text */
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: rgba(59, 130, 246, 0.18);
    --primary-glow: rgba(59, 130, 246, 0.4);

    --accent: #38bdf8;
    --accent-hover: #7dd3fc;

    --bg-main: #070a12;
    --bg-surface: #0f172a;
    --bg-card: #131c2e;
    --bg-glass: rgba(15, 23, 42, 0.85);
    --sidebar-bg: #090d16;
    --sidebar-hover: #1e293b;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;
    --text-white: #ffffff;

    --border-color: #1e293b;
    --border-light: #334155;

    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 35px -10px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.3);
}

body {
    font-family: 'Alexandria', system-ui, -apple-system, sans-serif;
    direction: rtl;
    text-align: right;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 0.92rem;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* =====================================================
   2. MAIN LAYOUT & SIDEBAR (RTL NATIVE)
   ===================================================== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    color: var(--text-white);
    padding: 24px 16px;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 12px 16px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.sidebar-brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.5px;
}

.sidebar-brand span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: #94a3b8;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.sidebar-menu a:hover {
    background: var(--sidebar-hover);
    color: var(--text-white);
    transform: translateX(-4px);
}

.sidebar-menu a.active {
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: var(--text-white);
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}

.sidebar-menu .menu-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.main-content {
    flex: 1;
    margin-right: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar Header */
.top-bar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 36px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 900;
}

[data-theme="dark"] .top-bar {
    background: rgba(9, 13, 22, 0.85);
}

.top-bar h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
}

.top-bar-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-main);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    font-size: 0.88rem;
    font-weight: 600;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.container {
    padding: 36px;
    padding-bottom: 40px;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

/* =====================================================
   3. HIGH-CONVERTING AUTH PAGES (LOGIN / REGISTER)
   ===================================================== */
.auth-body {
    background: radial-gradient(circle at top right, #1e1b4b 0%, #0f172a 50%, #020617 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.auth-body::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.25), transparent 70%);
    top: -150px;
    right: -150px;
    border-radius: 50%;
    filter: blur(60px);
    animation: floatBlob 8s infinite alternate ease-in-out;
}

.auth-body::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2), transparent 70%);
    bottom: -150px;
    left: -150px;
    border-radius: 50%;
    filter: blur(60px);
    animation: floatBlob 10s infinite alternate-reverse ease-in-out;
}

@keyframes floatBlob {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 40px) scale(1.1); }
}

.auth-wrapper {
    width: 100%;
    max-width: 520px;
    position: relative;
    z-index: 10;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.35);
    padding: 44px 38px;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-brand-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    box-shadow: 0 10px 25px var(--primary-glow);
}

.auth-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
}

.auth-header p {
    font-size: 0.92rem;
    color: var(--text-muted);
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #f8fafc;
    color: var(--text-main);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.auth-links {
    margin-top: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-links a {
    font-weight: 600;
}

/* =====================================================
   4. BUTTONS & UI BADGES
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.92rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #1d4ed8);
    color: var(--text-white);
    box-shadow: 0 8px 20px var(--primary-glow);
}

.btn-primary:hover {
    color: var(--text-white);
    box-shadow: 0 12px 25px var(--primary-glow);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: var(--text-white);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    color: var(--text-white);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: var(--text-white);
}

.btn-secondary {
    background: #e2e8f0;
    color: #334155;
}

.btn-secondary:hover {
    background: #cbd5e1;
    color: #1e293b;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-active, .badge-published {
    background: var(--success-light);
    color: #047857;
    border: 1px solid #a7f3d0;
}

.badge-pending, .badge-draft {
    background: var(--warning-light);
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-danger, .badge-inactive {
    background: var(--danger-light);
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-admin {
    background: #f3e8ff;
    color: #6b21a8;
    border: 1px solid #e9d5ff;
}

/* =====================================================
   5. CARDS & GRID LAYOUTS
   ===================================================== */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 28px;
    margin-bottom: 28px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 18px;
    margin-bottom: 22px;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }

.stat-info h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-info .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    margin-top: 4px;
}

/* =====================================================
   6. TABLES & LISTS
   ===================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    font-size: 0.92rem;
}

.table th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* Alert Flashes */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-size: 0.92rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #6ee7b7; }
.alert-error, .alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   7. IMMERSIVE 360 TOUR VIEWER STYLING (FULLSCREEN)
   ===================================================== */
.tour-viewport {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: #020617;
    z-index: 9999;
    overflow: hidden;
}

.tour-floating-header {
    position: absolute;
    top: 20px;
    right: 20px;
    left: 20px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    padding: 16px 28px;
    color: white;
    z-index: 10000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.tour-title-box h1 {
    font-size: 1.3rem;
    font-weight: 800;
    color: #ffffff;
}

.tour-title-box p {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 2px;
}

.tour-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Floating Bottom Thumbnails */
.tour-floating-carousel {
    position: absolute;
    bottom: 24px;
    right: 50%;
    transform: translateX(50%);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    padding: 12px 20px;
    z-index: 10000;
    display: flex;
    gap: 14px;
    max-width: 90vw;
    overflow-x: auto;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.carousel-thumb {
    position: relative;
    width: 110px;
    height: 75px;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    flex-shrink: 0;
}

.carousel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-thumb .thumb-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    color: white;
    font-size: 0.72rem;
    padding: 6px 4px 4px;
    text-align: center;
    font-weight: 600;
}

.carousel-thumb:hover, .carousel-thumb.active {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-4px);
}

/* Hotspot Popup */
.hotspot-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    z-index: 20000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hotspot-modal.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

/* =====================================================
   8. FULL RESPONSIVE MOBILE EXPERIENCE & APP BOTTOM NAV
   ===================================================== */

/* iOS safe area support for all fixed bottom bars */
.app-bottom-nav,
.mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Desktop defaults: mobile-only UI hidden */
.nav-toggle,
.app-bottom-nav,
.sidebar-overlay,
.sidebar-close {
    display: none;
}

html {
    -webkit-text-size-adjust: 100%;
}

@media (max-width: 992px) {
    /* ---------- SIDEBAR BECOMES OFF-CANVAS DRAWER ---------- */
    .sidebar {
        width: 288px;
        height: 100vh;
        height: 100dvh;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 1300;
        transform: translateX(100%);
        transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
        padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    }
    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(2, 6, 23, 0.62);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1290;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .sidebar-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-close {
        display: inline-flex;
        width: 36px;
        height: 36px;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 50%;
        color: #fff;
        font-size: 15px;
        cursor: pointer;
        flex-shrink: 0;
        margin-inline-start: auto;
        transition: var(--transition);
    }
    .sidebar-close:hover {
        background: var(--danger);
    }

    .sidebar-brand {
        padding: 8px 4px 20px;
        margin-bottom: 16px;
    }

    /* ---------- MAIN CONTENT ---------- */
    .main-content {
        margin-right: 0;
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .container {
        padding: 20px 16px calc(112px + env(safe-area-inset-bottom, 0px));
    }

    /* ---------- TOPBAR ---------- */
    .top-bar {
        padding: 12px 14px;
        gap: 10px;
        top: 0;
        z-index: 1200;
    }
    .top-bar-title h1 {
        font-size: 1.05rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .nav-toggle {
        display: inline-flex;
        width: 42px;
        height: 42px;
        align-items: center;
        justify-content: center;
        background: var(--primary-light);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        color: var(--text-main);
        font-size: 1.15rem;
        cursor: pointer;
        flex-shrink: 0;
        transition: var(--transition);
    }
    .nav-toggle:active {
        transform: scale(0.92);
    }
    .user-menu {
        gap: 8px;
    }
    .user-badge {
        padding: 6px 10px;
    }
    .user-badge span:last-child {
        display: none;
    }
    .top-bar .btn {
        padding: 9px 12px;
    }
    .top-bar .btn span:last-child {
        display: none;
    }

    /* ---------- APP BOTTOM NAVIGATION BAR ---------- */
    .app-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(66px + env(safe-area-inset-bottom, 0px));
        z-index: 1250;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(22px);
        -webkit-backdrop-filter: blur(22px);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -6px 28px rgba(15, 23, 42, 0.14);
        align-items: stretch;
        justify-content: space-around;
        padding: 0 6px;
    }
    [data-theme="dark"] .app-bottom-nav {
        background: rgba(10, 14, 24, 0.96);
        border-top-color: rgba(255, 255, 255, 0.09);
        box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.5);
    }

    /* regular item: icon pill + label, active = gradient pill highlight */
    .app-nav-item {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: var(--text-muted);
        font-size: 0.62rem;
        font-weight: 700;
        text-decoration: none;
        position: relative;
        padding: 4px 0 6px;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.2s ease;
    }
    .app-nav-item .nav-icon {
        font-size: 1.28rem;
        line-height: 1.1;
        padding: 5px 13px;
        border-radius: 999px;
        transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    }
    .app-nav-item span:last-child {
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .app-nav-item.active {
        color: var(--primary);
    }
    .app-nav-item.active .nav-icon {
        background: var(--primary-light);
        transform: translateY(-1px);
    }
    [data-theme="dark"] .app-nav-item.active .nav-icon {
        background: rgba(37, 99, 235, 0.22);
    }
    .app-nav-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        right: 50%;
        transform: translateX(50%);
        width: 26px;
        height: 3px;
        border-radius: 0 0 8px 8px;
        background: linear-gradient(90deg, var(--primary), var(--accent));
    }

    /* center FAB — add a new 360 tour via live capture */
    .app-nav-fab {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-end;
        padding: 0 0 8px;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 0.6rem;
        font-weight: 800;
        position: relative;
        -webkit-tap-highlight-color: transparent;
    }
    .nav-fab-circle {
        position: absolute;
        top: -34px;
        width: 64px;
        height: 64px;
        border-radius: 50%;
        background: radial-gradient(circle at 30% 25%, #60a5fa 0%, var(--primary) 55%, var(--accent) 100%);
        border: 4px solid var(--bg-main);
        box-shadow: 0 12px 30px var(--primary-glow), inset 0 -4px 8px rgba(0, 0, 0, 0.18);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.65rem;
        color: #fff;
        transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
        animation: fabPulse 2.6s ease-in-out infinite;
    }
    .nav-fab-circle::before {
        content: '';
        position: absolute;
        inset: -7px;
        border-radius: 50%;
        border: 2px solid var(--primary);
        opacity: 0.45;
        animation: fabRing 2.6s ease-out infinite;
    }
    .nav-fab-plus {
        position: absolute;
        top: -4px;
        left: -4px;
        width: 21px;
        height: 21px;
        border-radius: 50%;
        background: #fff;
        color: var(--primary);
        font-weight: 900;
        font-size: 0.95rem;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
        border: 1.5px solid var(--primary);
    }
    .nav-fab-label {
        margin-top: 34px;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--primary);
        font-size: 0.6rem;
        font-weight: 800;
    }
    [data-theme="dark"] .nav-fab-label {
        color: #60a5fa;
    }
    .app-nav-fab:active .nav-fab-circle {
        transform: scale(0.9);
        box-shadow: 0 6px 16px var(--primary-glow);
    }

    @keyframes fabPulse {
        0%, 100% { box-shadow: 0 12px 30px var(--primary-glow), inset 0 -4px 8px rgba(0, 0, 0, 0.18); }
        50% { box-shadow: 0 12px 40px var(--primary-glow), 0 0 0 0 rgba(37, 99, 235, 0.4), inset 0 -4px 8px rgba(0, 0, 0, 0.18); }
    }
    @keyframes fabRing {
        0% { transform: scale(0.92); opacity: 0.5; }
        70%, 100% { transform: scale(1.25); opacity: 0; }
    }

    /* ---------- CONTENT TOUCH-UP ---------- */
    .stats-grid {
        gap: 14px;
        margin-bottom: 20px;
    }
    .stat-card {
        padding: 18px;
        gap: 14px;
    }
    .stat-info .stat-value {
        font-size: 1.35rem;
    }
    .card {
        padding: 18px 16px;
        border-radius: 14px;
        margin-bottom: 18px;
    }
    .card-header {
        padding-bottom: 14px;
        margin-bottom: 16px;
        gap: 10px;
    }
    .card-title {
        font-size: 1.02rem;
    }
    .table th,
    .table td {
        padding: 12px 14px;
        font-size: 0.85rem;
        white-space: nowrap;
    }
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    .alert {
        padding: 13px 14px;
        font-size: 0.86rem;
    }
    .form-control,
    .form-select {
        padding: 12px 14px;
        font-size: 16px;
    }
    .btn {
        padding: 11px 16px;
    }

    /* header rows and button groups wrap gracefully */
    .container [style*="justify-content: space-between"] {
        flex-wrap: wrap;
        gap: 12px;
    }
    .container [style*="display: flex"][style*="gap: 10px"] {
        flex-wrap: wrap;
    }

    /* ---------- LANDING / AUTH / TOUR VIEWER FIXES ---------- */
    .hero-section,
    .login-section,
    .register-section {
        background-attachment: scroll;
    }
    section[id],
    [id="hero-preview"] {
        scroll-margin-top: 76px;
    }
    .floating-360-balloon {
        display: none !important;
    }
    .mobile-bottom-nav {
        height: calc(64px + env(safe-area-inset-bottom, 0px));
        z-index: 1000000;
    }
    .hero-preview-wrapper {
        height: 320px;
    }
    .hero-ticker-bar {
        margin-top: 24px;
        justify-content: flex-start;
    }
    .demo-card [style*="display: flex"][style*="gap: 6px"] {
        flex-wrap: wrap;
    }
    .demo-card [style*="display: flex"][style*="gap: 6px"] .btn {
        flex: 1 1 100%;
        justify-content: center;
    }
    #quickTourModal {
        padding: 8px;
    }
    #quickTourModal > div {
        height: 97vh;
        height: 97dvh;
    }
    .side-mega-menu {
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    }
}

/* ---------- EXTRA SMALL PHONES ---------- */
@media (max-width: 480px) {
    .container {
        padding: 16px 12px calc(104px + env(safe-area-inset-bottom, 0px));
    }
    .top-bar {
        padding: 10px 12px;
        gap: 8px;
    }
    .top-bar-title h1 {
        font-size: 0.95rem;
    }
    .user-badge {
        display: none;
    }
    .user-menu {
        gap: 6px;
    }
    .top-bar .btn {
        padding: 9px 10px;
    }
    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .stat-card {
        padding: 16px;
        gap: 14px;
    }
    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    .app-nav-item {
        font-size: 0.56rem;
    }
    .app-nav-item .nav-icon {
        padding: 5px 11px;
    }
    .nav-fab-circle {
        width: 58px;
        height: 58px;
        top: -30px;
        font-size: 1.5rem;
        border-width: 3px;
    }
    .nav-fab-label {
        margin-top: 30px;
        font-size: 0.56rem;
    }
    .hero-form-card [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr;
    }
    .tour-floating-header {
        padding: 8px 10px;
    }
    .container [style*="grid-template-columns: repeat(auto-fit, minmax(400px, 1fr))"],
    .container [style*="grid-template-columns: repeat(auto-fit, minmax(350px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
}

/* ---------- SHARED MOBILE POLISH ---------- */
@media (max-width: 992px) {
    .card-header {
        flex-wrap: wrap;
    }
    .container img {
        max-width: 100%;
        height: auto;
    }
    .table th,
    .table td {
        padding: 12px 12px;
    }
    .form-group,
    .form-row {
        min-width: 0;
    }
    .page-heading {
        flex-wrap: wrap;
    }
    .main-content [style*="display: flex"][style*="gap: 16px"] {
        flex-wrap: wrap;
    }
}

/* ---------- TOUR VIEWER (FULLSCREEN 360) MOBILE ---------- */
@media (max-width: 768px) {
    .tour-floating-header {
        top: 8px;
        right: 8px;
        left: 8px;
        padding: 10px 12px;
        gap: 10px;
        align-items: flex-start;
        flex-wrap: wrap;
        border-radius: 14px;
    }
    .tour-title-box h1 {
        font-size: 1rem;
    }
    .tour-title-box p {
        font-size: 0.78rem;
    }
    .tour-actions {
        flex-wrap: wrap;
        gap: 6px;
    }
    .icon-btn {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }
    .tour-floating-carousel {
        bottom: 12px;
        padding: 10px 12px;
        gap: 8px;
        max-width: 96vw;
    }
    .carousel-thumb {
        width: 86px;
        height: 60px;
    }
    .hotspot-modal {
        padding: 22px;
        width: 92%;
    }
    .tour-viewport [style*="bottom: 85px"] {
        bottom: 12px !important;
        left: 12px !important;
        right: 12px !important;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    .proj-btn {
        padding: 6px 10px !important;
        font-size: 0.74rem !important;
    }
}

/* =====================================================
   9. MOBILE PRO POLISH — Fully Responsive App Experience
   (overrides mobile-only rules so button text stays visible,
    bottom nav text is perfectly centered, and every screen
    behaves like a native mobile app)
   ===================================================== */

/* ---------- BUTTON TEXT ALWAYS VISIBLE ON MOBILE ---------- */
@media (max-width: 992px) {
    .top-bar .btn span:last-child {
        display: inline;
    }
    .top-bar .btn {
        white-space: nowrap;
        gap: 6px;
    }
}

/* ---------- TOP BAR WRAPS GRACEFULLY (title row + actions row) ---------- */
@media (max-width: 700px) {
    .top-bar {
        flex-wrap: wrap;
        gap: 8px 12px;
        padding: 10px 14px;
    }
    .top-bar-title {
        flex: 1 1 auto;
        min-width: 0;
    }
    .user-menu {
        flex: 1 1 auto;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px;
    }
    .top-bar .btn {
        padding: 9px 12px;
        font-size: 0.78rem;
        min-height: 40px;
        border-radius: var(--radius-md);
    }
    .user-badge {
        padding: 6px 10px;
    }
    .user-badge span:last-child {
        font-size: 0.78rem;
    }
}

/* ---------- APP BOTTOM NAV: PERFECTLY CENTERED TEXT ---------- */
@media (max-width: 992px) {
    .app-bottom-nav {
        align-items: center;
    }
    .app-nav-item,
    .app-nav-fab {
        text-align: center;
    }
    .app-nav-item span:last-child,
    .nav-fab-label {
        display: block;
        width: 100%;
        text-align: center;
        line-height: 1.25;
    }
    .app-nav-item {
        min-height: 58px;
    }
}

/* ---------- DASHBOARD CONTENT ON PHONES ---------- */
@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
    .stat-card {
        padding: 16px 12px;
        gap: 12px;
        justify-content: center;
    }
    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 21px;
        flex-shrink: 0;
    }
    .stat-info {
        min-width: 0;
    }
    .stat-info h3 {
        font-size: 0.74rem;
    }
    .stat-info .stat-value {
        font-size: 1.3rem;
    }

    .card {
        padding: 18px 16px;
        border-radius: 14px;
    }
    .page-heading,
    .card-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .container img {
        max-width: 100%;
        height: auto;
    }

    .form-group,
    .form-row {
        min-width: 0;
    }

    /* tables stay scrollable but tighter */
    .table th,
    .table td {
        padding: 12px 14px;
        font-size: 0.82rem;
    }

    /* comfortable form fields on touch */
    .form-control,
    .form-select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        padding: 14px 8px;
    }
    .stat-info .stat-value {
        font-size: 1.2rem;
    }

    .container {
        padding: 14px 12px calc(96px + env(safe-area-inset-bottom, 0px));
    }

    .card-header {
        align-items: flex-start;
    }

    .top-bar .btn {
        padding: 8px 11px;
        font-size: 0.74rem;
    }
}

/* ---------- LANDING / AUTH BOTTOM NAV (inline versions) ---------- */
@media (max-width: 992px) {
    .mobile-bottom-nav {
        align-items: center;
    }
    .mobile-nav-item,
    .mobile-nav-fab {
        text-align: center;
    }
    .mobile-nav-item span,
    .mobile-nav-fab span {
        display: block;
        width: 100%;
        text-align: center;
        line-height: 1.3;
    }
    .mobile-nav-item {
        min-height: 54px;
        justify-content: center;
    }
}

/* ---------- GLOBAL MOBILE SAFETY NET ---------- */
@media (max-width: 992px) {
    body {
        overflow-x: hidden;
    }
    .wrapper {
        max-width: 100%;
        overflow-x: hidden;
    }
    .main-content {
        max-width: 100%;
    }
    .btn {
        text-align: center;
    }
}

/* =====================================================
   10. V3 — MAIN MEGA MENU & OVERFLOW HARDENING
   ===================================================== */
/* Kill any accidental horizontal overflow on all viewports */
html,
body {
    overflow-x: clip;
}
@supports not (overflow: clip) {
    html,
    body {
        overflow-x: hidden;
    }
}

/* Landing pages: fix the #mobile-app grid min-content overflow */
@media (max-width: 992px) {
    #mobile-app > div {
        grid-template-columns: 1fr !important;
        min-width: 0;
    }
}

/* Shared mega-menu body/footer building blocks */
.mega-menu-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    min-width: 0;
}
.mega-menu-section {
    min-width: 0;
}
.mega-menu-footer {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Auth/landing bottom-nav center "create tour" button */
.mobile-nav-fab {
    position: relative;
    top: -10px;
    border: 3px solid var(--bg-surface);
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff !important;
    min-width: 56px;
    min-height: 56px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.4);
    text-decoration: none;
    line-height: 1.2;
}
.mobile-nav-fab:active {
    transform: scale(0.94);
}
.mobile-nav-fab .nav-icon {
    font-size: 1.25rem;
}
.mobile-nav-fab .fab-text {
    font-weight: 800;
    font-size: 0.66rem;
}
