/* ==========================================================================
   WealthFlow Suite - Brand Design Tokens & Custom CSS Stylesheet
   Luxury matte black, metallic gold, and soft ivory aesthetic.
   ========================================================================== */

:root {
    /* Color Palette */
    --matte-black: #0d0d0d;
    --matte-black-rgb: 13, 13, 13;
    --executive-bg: #141414;
    --card-bg: #1a1a1a;
    --primary-gold: #d4af37;
    --primary-gold-rgb: 212, 175, 55;
    --light-gold: #f3e7c4;
    --dark-gold: #b89742;
    --gold-gradient: linear-gradient(135deg, #bf953f 0%, #fcf6ba 25%, #b38728 50%, #fbf5b7 75%, #aa771c 100%);
    --gold-border-gradient: linear-gradient(135deg, #bf953f 0%, #aa771c 100%);
    --ivory: #fcfbf7;
    --soft-white: #e5e0d8;
    --muted-gray: #888888;
    
    /* Typography & Shadows */
    --serif-font: 'Cinzel', 'Playfair Display', Georgia, serif;
    --sans-font: 'Montserrat', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --luxury-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    --gold-glow: 0 0 15px rgba(212, 175, 55, 0.4);
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Base resets & layouts
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--matte-black);
    color: var(--ivory);
    font-family: var(--sans-font);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    background: none;
    border: none;
}

/* ==========================================================================
   1. Luxury Preloader
   ========================================================================== */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--matte-black);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s cubic-bezier(0.77, 0, 0.175, 1), visibility 0.8s;
}

.preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
    max-width: 400px;
    padding: 20px;
}

.monogram {
    font-family: var(--serif-font);
    font-size: 5rem;
    font-weight: 700;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    letter-spacing: 4px;
    animation: pulseGlow 3s ease-in-out infinite;
}

.preloader-title {
    font-family: var(--serif-font);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 6px;
    color: var(--ivory);
    margin-bottom: 5px;
}

.preloader-subtitle {
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 4px;
    color: var(--muted-gray);
    text-transform: uppercase;
    margin-bottom: 30px;
}

.loader-bar-container {
    width: 150px;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 0 auto;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.loader-bar {
    width: 0%;
    height: 100%;
    background: var(--gold-gradient);
    position: absolute;
    top: 0;
    left: 0;
    animation: loaderFill 2.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes loaderFill {
    0% { width: 0%; }
    50% { width: 40%; }
    100% { width: 100%; }
}

@keyframes pulseGlow {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.2)); }
    50% { filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.6)); }
}

/* ==========================================================================
   2. App Container & Setup
   ========================================================================== */
.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    opacity: 1;
    transition: opacity 1s ease-out, transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-container.hidden-init {
    opacity: 0;
    transform: scale(1.03);
}

/* ==========================================================================
   3. Header Styling
   ========================================================================== */
.app-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    pointer-events: none; /* Let clicks pass to background elements if needed */
}

.logo-area {
    pointer-events: auto;
}

.logo-text {
    font-family: var(--serif-font);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--ivory);
}

.gold-text {
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-badge {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(13, 13, 13, 0.6);
    border: 1px solid rgba(212, 175, 55, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 40px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    color: var(--soft-white);
}

.badge-icon {
    width: 12px;
    height: 12px;
    color: var(--primary-gold);
}

/* ==========================================================================
   4. Welcome Panel & Instructions (Floating UI)
   ========================================================================== */
.welcome-panel {
    position: absolute;
    top: 110px;
    left: 40px;
    z-index: 90;
    max-width: 420px;
    background: rgba(13, 13, 13, 0.5);
    border-left: 2px solid var(--primary-gold);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 24px 30px;
    border-radius: 0 12px 12px 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    animation: slideInPanel 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
    pointer-events: auto;
}

@keyframes slideInPanel {
    0% { opacity: 0; transform: translateX(-30px); }
    100% { opacity: 1; transform: translateX(0); }
}

.welcome-title {
    font-family: var(--serif-font);
    font-size: 1.8rem;
    font-weight: 400;
    letter-spacing: 2px;
    color: var(--ivory);
    margin-bottom: 6px;
}

.welcome-subtitle {
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 2px;
    color: var(--primary-gold);
    text-transform: uppercase;
    margin-bottom: 20px;
}

.instruction-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.compass-icon {
    width: 16px;
    height: 16px;
    color: var(--primary-gold);
    flex-shrink: 0;
    animation: compassRotate 12s linear infinite;
}

@keyframes compassRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.instruction-text {
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--soft-white);
}

/* ==========================================================================
   5. Virtual Office Viewport (Aspect-Ratio Lock System)
   ========================================================================== */
.office-viewport-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #050505;
}

.office-viewport {
    position: relative;
    aspect-ratio: 16 / 9;
    box-shadow: 0 25px 60px rgba(0,0,0,0.8);
    transform-origin: center;
    overflow: hidden;
}

/* Responsiveness mapping for 16:9 box */
@media (min-aspect-ratio: 16/9) {
    .office-viewport {
        width: 100%;
        height: auto;
    }
}

@media (max-aspect-ratio: 16/9) {
    .office-viewport {
        width: auto;
        height: 100%;
    }
}

.office-bg-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* Luxury Ambient Overlay */
.office-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(13, 13, 13, 0.15) 0%, rgba(13, 13, 13, 0.5) 100%);
    pointer-events: none; /* Hotspots sit on top, this overlay sits underneath them */
    z-index: 2;
}

/* ==========================================================================
   6. Interactive Hotspots System
   ========================================================================== */
.hotspots-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

.hotspot {
    position: absolute;
    width: 32px;
    height: 32px;
    transform: translate(-50%, -50%);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: manipulation;
}

/* Hotspot Dots Core */
.hotspot-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gold-gradient);
    border: 1px solid var(--ivory);
    position: relative;
    z-index: 5;
    box-shadow: 0 0 10px var(--primary-gold);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hotspot:hover .hotspot-dot, 
.hotspot.active .hotspot-dot {
    transform: scale(1.3);
    background: var(--ivory);
    border: 1px solid var(--primary-gold);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

/* Hotspot Pulsing Rings */
.hotspot-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--primary-gold);
    animation: hotspotRing 2s cubic-bezier(0.25, 0, 0, 1) infinite;
    pointer-events: none;
    box-shadow: inset 0 0 10px rgba(212, 175, 55, 0.3);
}

.hotspot-pulse-delayed {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid var(--light-gold);
    animation: hotspotRing 2s cubic-bezier(0.25, 0, 0, 1) 0.8s infinite;
    pointer-events: none;
}

@keyframes hotspotRing {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(2.4); opacity: 0; }
}

/* Dynamic Hover Tooltips (Desktop) */
.hotspot-tooltip {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    transform: translate(-50%, 12px);
    background: rgba(13, 13, 13, 0.82);
    border: 1px solid rgba(212, 175, 55, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 8px;
    padding: 14px 18px;
    width: 240px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    box-shadow: var(--luxury-shadow);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
    z-index: 100;
}

/* Tooltip Little Arrow */
.hotspot-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px;
    border-style: solid;
    border-color: rgba(13, 13, 13, 0.82) transparent transparent transparent;
}

.hotspot:hover .hotspot-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.tooltip-tag {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--primary-gold);
    margin-bottom: 4px;
    display: block;
}

.tooltip-title {
    font-family: var(--serif-font);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ivory);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tooltip-title i {
    width: 12px;
    height: 12px;
    color: var(--primary-gold);
    opacity: 0.7;
}

.tooltip-desc {
    font-size: 0.7rem;
    line-height: 1.4;
    color: var(--soft-white);
    font-weight: 300;
    margin-bottom: 10px;
}

.tooltip-action {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--primary-gold);
    display: flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Adjust tooltip position if hotspot is too high in viewport */
.hotspot.top-placed .hotspot-tooltip {
    bottom: auto;
    top: calc(100% + 14px);
    transform: translate(-50%, -12px);
}

.hotspot.top-placed .hotspot-tooltip::after {
    bottom: 100%;
    top: auto;
    border-color: transparent transparent rgba(13, 13, 13, 0.82) transparent;
}

.hotspot.top-placed:hover .hotspot-tooltip {
    transform: translate(-50%, 0);
}

/* ==========================================================================
   7. Mobile Interaction: Bottom Sheet (Drawer)
   ========================================================================== */
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

.drawer-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.mobile-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #111111;
    border-top: 1.5px solid var(--primary-gold);
    border-radius: 20px 20px 0 0;
    padding: 30px 24px 40px 24px;
    z-index: 1001;
    transform: translateY(100%);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-drawer.active {
    transform: translateY(0);
}

.drawer-drag-indicator {
    width: 40px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    margin: -15px auto 20px auto;
}

.drawer-close-btn {
    position: absolute;
    top: 18px;
    right: 20px;
    color: var(--muted-gray);
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.04);
    transition: var(--transition-smooth);
}

.drawer-close-btn:active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--ivory);
}

.drawer-content {
    text-align: center;
}

.drawer-header-icon {
    width: 50px;
    height: 50px;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 16px auto;
}

.drawer-header-icon i {
    width: 22px;
    height: 22px;
    color: var(--primary-gold);
}

.drawer-title {
    font-family: var(--serif-font);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--ivory);
    margin-bottom: 10px;
}

.drawer-description {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--soft-white);
    font-weight: 300;
    max-width: 480px;
    margin: 0 auto 24px auto;
}

.drawer-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 30px;
    background: var(--gold-gradient);
    color: var(--matte-black);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: var(--gold-glow);
    transition: var(--transition-smooth);
}

.drawer-cta-btn:active {
    transform: scale(0.97);
    filter: brightness(0.9);
}

/* ==========================================================================
   8. Floating Bottom-Right Intake CTA
   ========================================================================== */
.fixed-cta-container {
    position: absolute;
    bottom: 30px;
    right: 40px;
    z-index: 95;
    pointer-events: auto;
}

.intake-cta-button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    background: rgba(13, 13, 13, 0.85);
    border: 1px solid var(--primary-gold);
    border-radius: 40px;
    color: var(--ivory);
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-size: 0.78rem;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--luxury-shadow);
    transition: var(--transition-smooth);
}

.cta-pulse-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 40px;
    box-shadow: inset 0 0 15px rgba(212, 175, 55, 0.2);
    animation: ctaPulse 2.5s infinite;
    pointer-events: none;
}

@keyframes ctaPulse {
    0%, 100% { box-shadow: inset 0 0 15px rgba(212, 175, 55, 0.1), 0 0 0px rgba(212, 175, 55, 0); }
    50% { box-shadow: inset 0 0 15px rgba(212, 175, 55, 0.4), 0 0 15px rgba(212, 175, 55, 0.2); }
}

.cta-icon {
    width: 16px;
    height: 16px;
    color: var(--primary-gold);
}

.cta-arrow {
    width: 14px;
    height: 14px;
    color: var(--primary-gold);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.intake-cta-button:hover {
    background: var(--gold-gradient);
    color: var(--matte-black);
    border-color: transparent;
    box-shadow: var(--gold-glow);
    transform: translateY(-2px);
}

.intake-cta-button:hover .cta-icon,
.intake-cta-button:hover .cta-arrow {
    color: var(--matte-black);
}

.intake-cta-button:hover .cta-arrow {
    transform: translateX(4px);
}

.intake-cta-button:active {
    transform: translateY(0);
}

/* ==========================================================================
   9. Footer Info (Bottom Left)
   ========================================================================== */
.app-footer {
    position: absolute;
    bottom: 30px;
    left: 40px;
    z-index: 90;
    pointer-events: none;
}

.app-footer p {
    font-size: 0.65rem;
    font-weight: 300;
    letter-spacing: 1px;
    color: var(--muted-gray);
    text-transform: uppercase;
}

/* ==========================================================================
   10. Screen-size adjustments (Desktop responsive & mobile landscape)
   ========================================================================== */
@media (max-width: 1024px) {
    .app-header {
        padding: 20px 24px;
    }
    .welcome-panel {
        left: 24px;
        top: 90px;
        max-width: 360px;
        padding: 20px;
    }
    .fixed-cta-container {
        right: 24px;
        bottom: 24px;
    }
    .app-footer {
        left: 24px;
        bottom: 24px;
    }
}

@media (max-width: 768px) {
    body {
        overflow-y: auto; /* Allow overflow if needed on very small devices */
    }
    
    .app-header {
        position: fixed;
        background: linear-gradient(to bottom, rgba(13,13,13,0.9) 0%, rgba(13,13,13,0) 100%);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        padding: 15px 20px;
    }
    
    .logo-text {
        font-size: 1.1rem;
    }
    
    /* Reposition/resize welcome panel for smaller devices */
    .welcome-panel {
        position: relative;
        top: 0;
        left: 0;
        max-width: 100%;
        margin: 80px 20px 10px 20px;
        border-left: none;
        border-top: 1.5px solid var(--primary-gold);
        border-radius: 0 0 10px 10px;
        padding: 16px;
        box-shadow: none;
        z-index: 10;
        background: rgba(13, 13, 13, 0.85);
    }
    
    .welcome-title {
        font-size: 1.4rem;
        text-align: center;
    }
    
    .welcome-subtitle {
        text-align: center;
        margin-bottom: 12px;
    }
    
    .instruction-box {
        justify-content: center;
    }
    
    /* Enable horizontal scrolling of the virtual room on vertical phones */
    .office-viewport-container {
        width: 100%;
        height: calc(100vh - 220px);
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        display: block; /* Disable flex centering so horizontal scroll works */
        background-color: #0d0d0d;
        position: relative;
    }
    
    /* Force 16:9 box to have height = viewport minus margins, width scales accordingly */
    .office-viewport {
        height: 100%;
        width: auto;
        aspect-ratio: 16 / 9;
        margin: 0 auto;
        box-shadow: none;
    }
    
    .office-bg-image {
        height: 100%;
        width: auto;
        max-width: none; /* Crucial to let the image overflow horizontally */
    }
    
    /* Hide desktop tooltips on mobile since we use drawers */
    .hotspot-tooltip {
        display: none !important;
    }
    
    .hotspot {
        width: 36px; /* Slightly larger hit target for fingers */
        height: 36px;
    }
    
    .hotspot-dot {
        width: 14px;
        height: 14px;
    }
    
    /* Fixed bottom right CTA adjustments */
    .fixed-cta-container {
        position: fixed;
        bottom: 20px;
        left: 20px;
        right: 20px;
        display: flex;
        justify-content: center;
        width: calc(100% - 40px);
    }
    
    .intake-cta-button {
        width: 100%;
        justify-content: center;
        padding: 14px;
        font-size: 0.72rem;
    }
    
    /* Adjust footer info location on mobile */
    .app-footer {
        position: relative;
        bottom: 0;
        left: 0;
        text-align: center;
        padding: 20px 0 90px 0; /* Space for the intake button */
        width: 100%;
        background: var(--matte-black);
    }
}

/* Large monitors - cap size for visual excellence */
@media (min-width: 2000px) {
    .office-viewport {
        max-width: 1920px;
        max-height: 1080px;
        border: 1px solid rgba(212, 175, 55, 0.3);
    }
}
