/* 
   FaceScan Glass Edition - Core Styles 
   Premium, Immersive, Mobile-First Design
*/

:root {
    --bg-dark: #080c14;
    --accent-cyan: #1c4d9d; /* 🎯 Updated to match logo blue */
    --accent-blue: #4facfe;
    --accent-rose: #f43f5e;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --header-bg: rgba(8, 12, 20, 0.9); /* 🎯 Dark mode header/dropdown background */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary: #1c4d9d; /* 🎯 Global Primary Color */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

body.light-mode {
    --bg-dark: #f8fafc;
    --accent-cyan: #1c4d9d;
    --accent-blue: #4338ca;
    --accent-rose: #e11d48;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.08);
    --header-bg: rgba(255, 255, 255, 0.95); /* 🎯 Light mode header/dropdown background - More opaque for readability */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --primary: #1c4d9d; /* 🎯 Strong Blue for Light Mode */
}

/* --- Global Camera Components --- */
.camera-container {
    position: relative;
    background: #000;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

#canvas, #ar-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* --- HUD Elements --- */
.top-guidance {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: auto;
}

.top-guidance-text {
    background: rgba(0, 0, 0, 0.85); /* 🎯 Darker black background */
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff; /* 🎯 White text */
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.angle-displays {
    position: absolute;
    top: 80px;
    left: 20px;
    z-index: 50;
}

.progress-section {
    position: absolute;
    top: 80px;
    right: 20px;
    z-index: 50;
    text-align: right;
}

.angle-display, .progress-item {
    background: rgba(0, 0, 0, 0.75); /* 🎯 Darker black background */
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 4px;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff; /* 🎯 White text */
}

/* --- Scanner Overlay & Oval --- */
.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    z-index: 15;
    pointer-events: none;
    mask: radial-gradient(ellipse 160px 220px at 50% 40%, transparent 100%, black 100%);
    -webkit-mask: radial-gradient(ellipse 160px 220px at 50% 40%, transparent 100%, black 100%);
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.camera-overlay.good { background: rgba(76, 175, 80, 0.55) !important; } /* 🎯 Target opacity 0.55 - Perfect State */
.camera-overlay.intermediate { background: rgba(255, 152, 0, 0.2) !important; } /* 🎯 Intermediate/Warning (Orange) */
.camera-overlay.alert { background: rgba(244, 67, 54, 0.25) !important; } /* 🎯 Far/Problem (Red) */

.camera-overlay::after {
    content: '';
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: 440px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 160px/220px;
    z-index: 20;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.camera-overlay.good::after {
    border-color: #4CAF50;
    box-shadow: 0 0 40px rgba(76, 175, 80, 0.8);
}

.camera-overlay.intermediate::after {
    border-color: #ff9800;
    box-shadow: 0 0 30px rgba(255, 152, 0, 0.5);
}

.camera-overlay.alert::after {
    border-color: #f44336;
    box-shadow: 0 0 30px rgba(244, 67, 54, 0.5);
}

/* 🔥 Face Outline Visual Feedback (Three-State) */
.face-outline {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: 440px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 160px/220px;
    z-index: 21;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.face-outline.good {
    border: 4px solid #4CAF50 !important;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.8) !important;
}

.face-outline.intermediate {
    border: 3px solid #ff9800 !important;
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.6) !important;
}

.face-outline.alert {
    border: 3px solid #f44336 !important;
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.6) !important;
}

/* --- Nav Inversion Logic --- */
body.light-mode .theme-icon {
    filter: invert(1);
}

.face-guidance {
    position: absolute;
    top: calc(40% + 240px); /* 🎯 Placed strictly below the oval (40% + 220px radius + 20px space) */
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: 100%;
    padding: 0 30px;
    text-align: center;
}

.guidance-text {
    background: rgba(0, 0, 0, 0.85); /* 🎯 Restored and darker black background */
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 20px;
    font-weight: 800;
    display: inline-block;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
    letter-spacing: 0.5px;
}

/* --- Desktop Layout (min-width: 769px) --- */
@media (min-width: 769px) {
    body { padding: 0; }
    .camera-container {
        border-radius: 8px;
        max-width: 1000px;
        height: 600px;
        box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    }
    .desktop-only { display: flex !important; }
}

/* Standardized Buttons - Professional Compact Theme */
.btn {
    padding: 12px 24px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    border: none;
    white-space: nowrap;
}

#theme-toggle {
    background: transparent !important;
    border: none !important;
    padding: 6px !important;
    min-width: 24px;
}

.btn-primary {
    background: #1c4d9d; /* Matches Agency Logo */
    color: white !important;
    box-shadow: 0 4px 10px rgba(28, 77, 157, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 20px rgba(55, 139, 220, 0.3);
    filter: brightness(1.1);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary) !important;
}

/* Dropdown Navigation */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    min-width: 180px;
    max-height: 280px;      /* ← cap height */
    overflow-y: auto;       /* ← scroll INSIDE menu only */
    overscroll-behavior: contain; /* ← stop scroll chaining to page */
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 9999;          /* ← always on top */
    margin-top: 8px;
    padding: 8px 0;
    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.dropdown-menu::-webkit-scrollbar { width: 4px; }
.dropdown-menu::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
.dropdown-menu::-webkit-scrollbar-track { background: transparent; }

.dropdown-menu.active {
    display: block;
}

.dropdown-item {
    padding: 8px 16px;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    font-size: 0.8rem;
    transition: background 0.2s;
    cursor: pointer;
}

.dropdown-item:hover {
    background: rgba(28, 77, 157, 0.1);
    color: var(--primary);
}

/* Info Icon & Scanner Popup */
.info-icon {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 900;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.instruction-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    z-index: 10002;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    color: var(--text-primary);
}

.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 12, 20, 0.7);
    backdrop-filter: blur(5px);
    z-index: 10001;
}

.guide-step {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.step-num {
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: bold;
}

/* --- Desktop Layout (min-width: 769px) --- */
@media (min-width: 769px) {
    body { padding: 2rem; }
    .camera-container {
        border-radius: 8px;
        max-width: 1000px;
        height: 600px;
        box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    }
    .desktop-only { display: flex !important; }
    .mobile-mini-header { display: none !important; }

    /* 🔥 PC Navbar Harmonization (Matches Home Page) */
    .header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        margin-bottom: 20px !important;
        padding: 4px 12px !important; /* 🎯 Extreme height reduction */
        border-bottom: 1px solid var(--glass-border) !important;
        background: transparent !important;
        position: relative !important;
    }

    .user-info {
        display: flex !important;
        gap: 3px !important; /* 🎯 Tightest gap for high density */
        flex-wrap: nowrap !important; 
        justify-content: flex-end !important;
        align-items: center !important;
        max-width: 85%; 
    }

    .user-info .btn {
        white-space: nowrap !important;
        /* 🎯 Removed shrinking override that was forcing 10px font */
    }

    /* 🔥 Enlarge Mobile Prompt on PC */
    #mobile-prompt {
        max-width: 900px !important;
        padding: 15px 30px !important;
        font-size: 1.1rem !important;
        border-radius: 6px !important;
    }

    #mobile-prompt button {
        padding: 8px 25px !important;
        font-size: 1rem !important;
    }

    /* 🔥 Centered Desktop Controls */
    .desktop-controls {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        gap: 20px;
        margin-top: 30px;
        width: 100%;
    }

    .desktop-btn-group {
        display: flex;
        gap: 15px;
        justify-content: center;
    }

    .desktop-btn {
        padding: 14px 30px;
        font-size: 1.1rem;
        font-weight: 700;
        border-radius: 4px;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        text-transform: uppercase;
        letter-spacing: 1px;
        min-width: 180px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .desktop-btn.primary {
        background: var(--accent-cyan);
        color: white; /* 🎯 Fixed: Main action text is now clearly white */
        box-shadow: 0 0 20px rgba(45, 212, 191, 0.3);
    }

    .desktop-btn.danger {
        background: transparent;
        color: #f44336;
        border-color: #f44336;
    }

    .desktop-btn.secondary {
        background: transparent;
        color: var(--accent-cyan);
        border-color: var(--accent-cyan);
    }

    .desktop-btn.continuity-btn {
        background: #1c4d9d; /* 🎯 Solid Professional Blue */
        color: white;
        border: none;
    }

    .desktop-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    }

    /* 🔥 Mobile Prompt Text Inversion Logic */
    #mobile-prompt span {
        color: #f8fafc; /* 🎯 Default: High-contrast white for dark mode */
        font-size: 0.95rem;
        transition: color 0.3s ease;
    }

    body.light-mode #mobile-prompt span {
        color: #000000 !important; /* 🎯 Light Mode: Strict black as requested */
    }

    /* 🔥 Dedicated PC Progress Bar */
    .desktop-progress-container {
        width: 100%;
        max-width: 600px;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(12px);
        padding: 20px;
        border-radius: 6px;
        border: 1px solid var(--glass-border);
        text-align: center;
    }

    .desktop-progress-label {
        font-size: 0.9rem;
        color: #ffffff; /* 🎯 White text */
        margin-bottom: 12px;
        text-transform: uppercase;
        letter-spacing: 1px;
        font-weight: 700;
    }

    .desktop-progress-track {
        height: 12px;
        background: rgba(0, 0, 0, 0.3);
        border-radius: 6px;
        overflow: hidden;
        margin-bottom: 10px;
    }

    .desktop-progress-fill {
        height: 100%;
        width: 0%;
        background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
        box-shadow: 0 0 15px rgba(79, 172, 254, 0.5);
        transition: width 0.4s ease;
    }

    .desktop-progress-text {
        font-size: 1.1rem;
        font-weight: 700;
        color: #ffffff; /* 🎯 White text */
    }
}

/* --- Dropdown Menu (Global) --- */
.nav-dropdown {
    position: relative !important;
}

.dropdown-menu {
    position: absolute !important;
    top: calc(100% + 15px) !important;
    right: 0 !important;
    background: var(--header-bg) !important;
    backdrop-filter: blur(32px) !important;
    -webkit-backdrop-filter: blur(32px) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 0.5rem !important;
    min-width: 200px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15) !important;
    display: none !important;
    flex-direction: column !important;
    padding: 10px !important;
    z-index: 3000 !important;
}

.dropdown-menu.active {
    display: flex !important;
}

.dropdown-item {
    padding: 10px 15px !important;
    color: var(--text-primary) !important;
    text-decoration: none !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    transition: background 0.2s !important;
    cursor: pointer !important;
    white-space: nowrap !important;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* --- Mobile "Glass Edition" (max-width: 768px) --- */
@media (max-width: 768px) {
    #mobile-prompt {
        display: none !important;
    }

    /* 🔥 Universal Menu Toggle Icon */
    .menu-toggle {
        display: flex;
        position: fixed;
        top: 15px;
        right: 15px;
        width: 44px;
        height: 44px;
        background: var(--glass-bg);
        backdrop-filter: blur(12px);
        border: 1px solid var(--glass-border);
        border-radius: 50%;
        color: white;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        cursor: pointer;
        z-index: 2000;
        transition: transform 0.2s ease;
    }

    .menu-toggle:active { transform: scale(0.9); }

    .header.desktop-only {
        display: none; /* Hidden by default on mobile */
        position: fixed;
        top: 70px;
        left: 15px;
        right: 15px;
        flex-direction: column;
        background: rgba(15, 23, 42, 0.9);
        backdrop-filter: blur(20px);
        padding: 20px;
        border-radius: 8px;
        border: 1px solid var(--glass-border);
        z-index: 1500;
        animation: slideIn 0.3s ease-out;
    }

    .header.desktop-only.active {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 25px 15px;
    }

    .header.desktop-only > div:first-child {
        flex-direction: column !important;
        gap: 8px !important;
        margin-bottom: 15px;
    }

    .header.desktop-only h1 {
        font-size: 1.4rem !important;
        margin: 0;
    }

    .header.desktop-only p {
        display: none !important; /* Hide long subtitle to save space */
    }

    .header.desktop-only .user-info {
        flex-direction: column;
        width: 100%;
        gap: 8px;
        margin-top: 10px;
    }

    .header.desktop-only .btn {
        width: 100%;
        justify-content: center;
    }

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

    body.scanner-active {
        height: auto;
        min-height: 100vh;
        width: 100vw;
        overflow-y: auto;
        position: relative;
    }
    
    .camera-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 100;
        margin: 0;
        border-radius: 0;
    }

    /* Specific desktop elements to hide on mobile */
    .desktop-controls, #mobile-prompt, .desktop-only {
        display: none !important;
    }

    /* Hide standard header only during active scanning to prevent HUD overlap */
    body.scanner-active .header {
        display: none !important;
    }

    .mobile-mini-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        padding: 20px;
        z-index: 1000;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: linear-gradient(to bottom, rgba(15, 23, 42, 0.6), transparent);
    }

    .mini-back-btn {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(8px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        width: 44px;
        height: 44px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: transform 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mini-back-btn:active {
        transform: scale(0.9);
    }

    .camera-controls {
        position: fixed;
        bottom: 85px; /* 🎯 Lowered to prevent overlap with Position guidance */
        left: 0;
        right: 0;
        display: flex;
        justify-content: center;
        z-index: 200;
    }

    .controls-row {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 20px;
    }

    .camera-btn {
        width: 60px;
        height: 60px;
        border-radius: 8px;
        background: var(--glass-bg);
        backdrop-filter: blur(12px);
        border: 1px solid var(--glass-border);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .camera-btn.start-btn {
        width: 75px;
        height: 75px;
        background: var(--accent-cyan);
        color: var(--bg-dark);
        border: none;
        box-shadow: 0 0 25px rgba(45, 212, 191, 0.4);
    }

    .camera-btn.start-btn.scanning {
        background: var(--accent-rose);
        box-shadow: 0 0 30px rgba(244, 63, 94, 0.6);
    }

    .capture-grid {
        position: fixed;
        bottom: 10px; /* 🎯 Fixed at bottom */
        left: 50%;
        transform: translateX(-50%);
        width: 96%; /* 🎯 Wider horizontally */
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(16px);
        border: 1px solid var(--glass-border);
        border-radius: 4px;
        padding: 5px 8px; /* 🎯 Reduced padding */
        z-index: 200;
    }

    .capture-grid .grid-title {
        display: none; /* Hide 'Capture Progress' text on mobile to save vertical space */
    }

    .grid-sections { display: flex; gap: 8px; align-items: center; }
    .grid-section { 
        flex: 1; 
        background: rgba(255,255,255,0.03);
        padding: 4px;
        border-radius: 4px;
        text-align: center;
    }
    .section-canvas {
        width: 100%;
        height: 24px !important; /* Force smaller height */
        background: #000;
        border-radius: 4px;
        margin-bottom: 2px;
    }
    .section-label { font-size: 8px; margin-bottom: 2px; color: var(--text-secondary); }
    .section-progress { display: none; } /* Hide numbers, bar is enough */
}

/* --- Utility Animations --- */
@keyframes glow {
    0% { filter: drop-shadow(0 0 5px var(--accent-cyan)); }
    50% { filter: drop-shadow(0 0 15px var(--accent-cyan)); }
    100% { filter: drop-shadow(0 0 5px var(--accent-cyan)); }
}

/* --- Ultra-Compressed & Centered Footer System --- */
.crm-contact-wrapper {
    width: 100%;
    padding: 15px 0; /* Reduced padding */
    border-top: 1px solid var(--glass-border);
    background-color: transparent;
}

.crm-contact-section {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    align-items: flex-start;
    justify-content: space-between; /* Edge-to-edge as requested */
    max-width: 1100px; /* Constraint width for centering effect */
    margin: 0 auto;
    padding: 20px;
}

.crm-col-footer {
    flex: 1;
    min-width: 300px;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Left oriented as requested */
    text-align: left; /* Left oriented as requested */
}

.crm-contact-label {
    font-size: 0.65rem !important; /* Even smaller */
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.crm-footer-h2 {
    font-size: 1.15rem !important; /* Smaller */
    font-weight: 800;
    margin: 4px 0 12px 0 !important;
    color: var(--text-primary);
    text-align: left; /* Left aligned as requested */
}

.crm-contact-text {
    font-size: 0.8rem !important; /* Smaller */
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Left oriented icon and text */
    gap: 6px;
    text-align: left;
}

.crm-socials {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    justify-content: flex-start; /* Left oriented as requested */
}

.crm-social-icon {
    width: 36px !important;
    height: 36px !important;
    background-color: var(--primary);
    color: white !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.15rem !important;
    transition: transform 0.2s, background-color 0.3s;
}

.crm-social-icon:hover {
    background-color: #153a77 !important;
    transform: scale(1.05);
}

.crm-form-group-sm {
    margin-bottom: 10px;
    text-align: left; /* Keep form labels left aligned for readability */
    width: 100%;
}

.crm-form-label-footer {
    font-size: 0.75rem !important;
    margin-bottom: 5px;
    display: block;
    color: var(--text-secondary);
}

.crm-form-input-sm {
    padding: 6px 10px !important;
    font-size: 0.8rem !important;
    height: 34px !important;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-radius: 6px;
    width: 100%;
}

.crm-form-textarea-sm {
    min-height: 70px !important;
}

.crm-btn-footer {
    padding: 8px 18px !important;
    font-size: 0.8rem !important;
    margin-top: 5px;
    background-color: var(--accent-cyan) !important;
    color: white !important;
    border-radius: 6px !important;
    border: none;
    cursor: pointer;
}

/* --- Dark Mode Visibility Fixes --- */
body:not(.light-mode) .crm-p,
body:not(.light-mode) .crm-list li {
    color: var(--text-secondary) !important;
}

body:not(.light-mode) .crm-h2,
body:not(.light-mode) .crm-footer-h2,
body:not(.light-mode) .crm-contact-label,
body:not(.light-mode) .crm-contact-text,
body:not(.light-mode) .crm-form-label-footer {
    color: var(--text-primary) !important;
}

body:not(.light-mode) .crm-h2,
body:not(.light-mode) .crm-footer-h2 {
    color: #ffffff !important;
}

/* --- Global Universal Navbar (Strict Consistency) --- */
.header {
    height: 85px !important; /* 🎯 Slightly taller to fit 72px logo with room to breathe */
    min-height: 85px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 15px !important; /* 🎯 Narrower padding to give more internal width */
    background: var(--header-bg) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05) !important;
    position: relative !important;
    z-index: 2000 !important;
    width: 100% !important;
    margin: 15px 0 35px 0 !important;
    gap: 15px !important; /* 🎯 Ensure a minimum gap between logo and buttons */
}

.header-logo-group {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 5px !important;
    flex-shrink: 0 !important; /* 🎯 Logo group MUST NOT shrink */
}

.main-logo {
    height: 65px !important; /* 🎯 Fit comfortably inside 85px header */
    width: auto !important;
    border-radius: 4px !important;
    background: transparent !important;
    padding: 0 !important;
    display: block !important;
    margin: 0 auto !important;
}

.header-title {
    display: none !important;
}

.header-subtitle {
    display: none !important;
}

.user-info {
    display: flex !important;
    align-items: center !important;
    gap: 2px !important; /* 🎯 Minimum gap possible to save width */
}

/* Base Desktop Navbar Buttons (1100px+) */
.user-info .btn {
    padding: 6px 12px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    text-decoration: none !important;
    transition: all 0.2s !important;
    white-space: nowrap !important;
}

/* Mid-tier Tablet/Small Laptop: Shrink buttons instead of collapsing */
@media (max-width: 1100px) and (min-width: 769px) {
    .user-info .btn {
        padding: 4px 6px !important;
        font-size: 9px !important;
        gap: 2px !important;
    }
    .header-logo-group .main-logo {
        height: 60px !important; /* Keep logo reasonably large on tablets */
    }
    .user-info {
        gap: 2px !important; /* Pack buttons tighter */
    }
}

/* --- Removed Redundant Button Overrides causing issues --- */
/*
.btn-primary {
    background: var(--primary) !important;
    color: white !important;
    border: none !important;
}

.btn-outline {
    background: transparent !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-primary) !important;
}
*/

.theme-icon {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
    transition: transform 0.3s ease !important;
}

.menu-toggle {
    display: none !important;
    background: transparent !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-primary) !important;
    font-size: 24px !important;
    cursor: pointer !important;
    padding: 5px 12px !important;
    border-radius: 8px !important;
    z-index: 2005 !important;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block !important;
    }
    
    .user-info {
        display: none !important;
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        background: var(--bg-dark) !important; /* 🔥 DYNAMIC THEME BACKGROUND */
        backdrop-filter: blur(32px) !important;
        flex-direction: column !important;
        padding: 30px 20px !important;
        gap: 15px !important;
        border-radius: 0 0 2rem 2rem !important;
        border: 1px solid var(--glass-border) !important;
        border-top: none !important;
        margin-top: 5px !important;
        box-shadow: 0 30px 60px rgba(0,0,0,0.5) !important;
    }
    
    .user-info.active {
        display: flex !important;
    }
}
/* --- Structural Utilities (Tailwind Replacements) --- */
.h-screen { height: 100vh !important; }
.w-full { width: 100% !important; }
.flex { display: flex !important; }
.flex-col { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.flex-1 { flex: 1 1 0% !important; }
.items-center { align-items: center !important; }
.justify-center { justify-content: center !important; }
.relative { position: relative !important; }
.absolute { position: absolute !important; }
.inset-0 { inset: 0 !important; }
.overflow-hidden { overflow: hidden !important; }
.hidden { display: none !important; }
.z-\[200\] { z-index: 200 !important; }
.z-\[300\] { z-index: 300 !important; }
.mt-auto { margin-top: auto !important; }
.p-8 { padding: 2rem !important; }
.bg-black\/90 { background: rgba(0,0,0,0.9) !important; }
.backdrop-blur-md { backdrop-filter: blur(12px) !important; }
.text-indigo-400 { color: #818cf8 !important; }
.border-indigo-600 { border-color: #4f46e5 !important; }
.bg-white\/5 { background: rgba(255, 255, 255, 0.05) !important; }
.border-white\/10 { border-color: rgba(255, 255, 255, 0.1) !important; }
.bg-red-500\/10 { background: rgba(239, 68, 68, 0.1) !important; }
.text-red-500 { color: #ef4444 !important; }
.bg-indigo-600 { background: #4f46e5 !important; }
.text-slate-400 { color: #94a3b8 !important; }
.text-slate-500 { color: #64748b !important; }
.text-slate-600 { color: #475569 !important; }
.text-slate-700 { color: #334155 !important; }
.inset-x-0 { left: 0 !important; right: 0 !important; }
.inset-y-0 { top: 0 !important; bottom: 0 !important; }
.p-10 { padding: 2.5rem !important; }
.mb-24 { margin-bottom: 6rem !important; }
.bg-white\/10 { background: rgba(255, 255, 255, 0.1) !important; }
.rounded-2xl { border-radius: 0.5rem !important; }
.rounded-\[3rem\] { border-radius: 0.5rem !important; }
.font-black { font-weight: 900 !important; }
.tracking-widest { letter-spacing: 0.1em !important; }
.mt-8 { margin-top: 2rem !important; }
.uppercase { text-transform: uppercase !important; }
.animate-spin { animation: spin 1s linear infinite !important; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* --- Desktop Layout & Sidebar (Standard CSS) --- */
@media (min-width: 1024px) {
    .md\:flex-row { flex-direction: row !important; }
    .md\:w-96 { width: 24rem !important; }
    .md\:h-full { height: 100% !important; }
    .md\:fixed { position: fixed !important; }
    .md\:left-0 { left: 0 !important; }
    .md\:top-0 { top: 0 !important; }
    .md\:bottom-0 { bottom: 0 !important; }
    .md\:order-first { order: -1 !important; }
}

/* --- Standard Navbar Mobile Breakpoint (768px) --- */
@media (max-width: 768px) {
    .header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 15px !important;
        margin-bottom: 20px !important;
        background: var(--header-bg) !important;
        border: 1px solid var(--glass-border) !important;
        border-radius: 4px !important;
        width: 100% !important;
        min-height: 60px !important;
    }
    .header-logo-group {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }
    .main-logo { height: 60px !important; width: auto !important; background: transparent !important; }
    .header-logo-group { background: transparent !important; }
    .menu-toggle { display: flex !important; }
    .user-info {
        display: none !important;
        position: absolute !important;
        top: 70px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        flex-direction: column !important;
        gap: 8px !important;
        background: var(--glass-bg) !important;
        backdrop-filter: blur(24px) !important;
        border: 1px solid var(--glass-border) !important;
        padding: 15px !important;
        border-radius: 6px !important;
        z-index: 1000 !important;
    }
    .user-info.active { display: flex !important; }
}

/* --- CRM Global Layout System (Migrated from Index) --- */
.crm-container {
    max-width: 1100px;
    margin: 0 auto;
    text-align: left;
    padding: 48px 32px;
}

.crm-section {
    display: flex;
    flex-wrap: wrap;
    gap: 48px;
    margin-bottom: 80px;
    align-items: flex-start;
}

.crm-col {
    flex: 1;
    min-width: 300px;
}

/* Typography Hierarchy */
.crm-h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 24px;
    line-height: 1.2;
}

.crm-h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.3;
}

.crm-h3 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
    display: block;
}

/* Uniform Body Text (15px) */
.crm-p, .crm-list li, .feature-info {
    font-size: 15px;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    line-height: 1.6;
}

.crm-p {
    margin-bottom: 24px;
}

.crm-list {
    list-style: none;
    padding: 0;
    margin: 0 0 25px 0;
}

.crm-list li {
    position: relative;
    padding-left: 18px;
    margin-bottom: 16px;
}

.crm-list li::before {
    content: "●";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--text-primary);
    font-size: 0.8rem;
    margin-top: 2px;
}

/* Style strong tags inside list as uniform subheadings */
.crm-list li strong {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 6px;
}

.crm-buttons {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.crm-btn {
    background-color: var(--accent-cyan);
    color: #ffffff !important;
    border: none;
    padding: 8px 24px; /* Apple-style compact button padding */
    border-radius: 4px;
    font-weight: 600; /* Semi-bold instead of heavy bold */
    font-size: 12.5px; /* Smaller button font */
    letter-spacing: 0.02em;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s, transform 0.2s;
}

.crm-btn:hover {
    background-color: #153a77;
    transform: translateY(-1px);
}

.interactive-3d-section {
    margin-top: 48px;
    display: flex;
    align-items: center;
    gap: 48px;
    padding: 32px 48px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease;
    overflow: hidden;
    margin-bottom: 80px;
}

.interactive-3d-section:hover {
    transform: translateY(-2px);
}

.viewer-container {
    flex: 1;
    height: 450px;
    border-radius: 4px;
    overflow: hidden;
    background: radial-gradient(circle at center, rgba(28, 77, 157, 0.03) 0%, transparent 70%);
    position: relative;
    border: 1px solid var(--glass-border);
    display: block !important;
    visibility: visible !important;
}

.steps-container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 32px;
    width: 100%;
    margin-top: 64px;
    margin-bottom: 80px;
}

.step-image {
    width: 19%;
    object-fit: contain;
    border-radius: 4px;
    background: transparent;
}

.features-grid {
    display: flex;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 80px;
    width: 100%;
}

.feature-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card .crm-btn {
    margin-top: auto;
}

.feature-img {
    width: 100%;
    aspect-ratio: 16/7;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 20px;
    background: #111;
}

.feature-info {
    /* Inherits uniform 1rem font-size */
    margin-bottom: 24px;
    min-height: 2.8em;
    width: 100%;
    display: block;
    text-align: left;
}

@media (max-width: 768px) {
    .crm-container {
        padding: 32px 20px !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }
    .crm-section {
        flex-direction: column !important;
        gap: 32px !important;
        margin-bottom: 48px !important;
        text-align: left !important;
        align-items: flex-start !important;
    }
    .features-grid {
        flex-direction: column;
        gap: 24px;
        margin-bottom: 48px;
    }
    .interactive-3d-section {
        flex-direction: column !important;
        gap: 24px;
        padding: 24px;
        margin-top: 32px;
        margin-bottom: 48px;
        border-radius: 8px;
    }
    .viewer-container {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        align-self: stretch !important;
        height: 220px !important;
        min-height: 350px !important;
        margin: 0 auto !important;
    }
    .crm-col {
        width: 100% !important;
    }
    .steps-container {
        flex-direction: column;
        gap: 24px;
        margin-top: 48px;
        margin-bottom: 48px;
    }
    .step-image {
        width: 80%;
        max-width: 300px;
    }
}

/* --- Toggle Switch Styles (Global) --- */
.toggle-wrapper {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #444;
    transition: .4s;
    border-radius: 8px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-cyan);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.65rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Ensure 3D Viewers Fill Container */
model-viewer {
    width: 100%;
    height: 100%;
    min-height: 100%;
    display: block;
    --poster-color: transparent;
}

#unified-3d-canvas canvas {
    width: 100% !important;
    height: 100% !important;
}

/* --- Global Modal (Popup Overlay) for Policies --- */
.policy-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.policy-modal-container {
    background-color: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    padding: 30px;
    animation: modalFadeIn 0.3s ease-out;
    display: block;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

body.light-mode .policy-modal-container {
    background-color: #ffffff;
    border-color: rgba(0,0,0,0.1);
}

.policy-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}

body.light-mode .policy-modal-close {
    background: rgba(0, 0, 0, 0.05);
}

.policy-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

body.light-mode .policy-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.policy-content h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-right: 30px;
}

.policy-content h3 {
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.policy-content p, .policy-content li {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
    font-size: 0.95rem;
}
/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 40px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255, 255, 255, 0.2); transition: .4s; border-radius: 24px; border: 1px solid rgba(255, 255, 255, 0.1); }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
input:checked + .slider { background-color: var(--primary); border-color: var(--primary); }
input:checked + .slider:before { transform: translateX(16px); }

/* Language Tooltip Animations */
@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes langTooltipWave {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

@keyframes tooltipFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.fade-out-tooltip {
    animation: tooltipFadeOut 0.5s forwards !important;
}

/* n8n Chat Widget Global Theme Overrides */
:root {
    /* Base theme colors */
    --color--primary: #1c4d9d !important;
    --color--primary-shade-50: #143875 !important;
    --color--background: #ffffff !important;
    --color--background--light-2: #f8f9fa !important;
    --color--background--light-3: #f0f2f5 !important;
    
    /* Toggle (Launcher/Close Button) */
    --chat--toggle--background: #1c4d9d !important;
    --chat--toggle--hover--background: #143875 !important;
    --chat--toggle--active--background: #0d2550 !important;
    --chat--toggle--color: #ffffff !important;
    
    /* Chat Window Backgrounds & Sizing */
    --chat--window--width: 350px !important;
    --chat--window--height: 520px !important;
    --chat--window--border-radius: 8px !important;
    
    --chat--body--background: #ffffff !important;
    --chat--footer--background: #ffffff !important;
    --chat--input--background: #ffffff !important;
    --chat--input--container--background: #ffffff !important;
    
    /* Send/File Buttons */
    --chat--input--send--button--background: transparent !important;
    --chat--input--send--button--background-hover: transparent !important;
    --chat--input--send--button--color: #1c4d9d !important;
    
    /* Typography & Font Sizes */
    --chat--font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    --chat--message--font-size: 14px !important;
    --chat--heading--font-size: 16px !important;
    --chat--input--font-size: 14px !important;
    
    /* Chat Bubbles */
    --chat--message--user--background: #1c4d9d !important;
    --chat--message--user--color: #ffffff !important;
    --chat--message--bot--background: #f0f2f5 !important;
    --chat--message--bot--color: #333333 !important;
    
    /* Header */
    --chat--header--background: #1c4d9d !important;
    --chat--header--color: #ffffff !important;
}

/* Force global elements if they escape shadow DOM */
.chat-launcher, .chat-toggle, [class*="launcher"] {
    background-color: #1c4d9d !important;
}
