/* ==========================================================================
   ZAR DIGITAL INSTITUTIONAL DIGITAL WEALTH & TRADING PLATFORM
   Core Stylesheet & Animation Engine
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Base & Global Styles
   -------------------------------------------------------------------------- */
@layer base {
    html {
        scroll-behavior: smooth;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }

    html,
    body {
        margin: 0;
        padding: 0;
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh;
        overflow-x: hidden;
    }
}

/* --------------------------------------------------------------------------
   2. Custom Scrollbar
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #090e16;
}

::-webkit-scrollbar-thumb {
    background: #252a33;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb:hover {
    background: #00daf3;
}

/* Light Mode Scrollbar */
html.light ::-webkit-scrollbar-track,
body.light-theme ::-webkit-scrollbar-track {
    background: #f1f5f9;
}

html.light ::-webkit-scrollbar-thumb,
body.light-theme ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

html.light ::-webkit-scrollbar-thumb:hover,
body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: #0284c7;
}

/* --------------------------------------------------------------------------
   3. Multi-Level Animation Keyframes
   -------------------------------------------------------------------------- */

/* Level 1: Atmospheric & Ambient Background Floating */
@keyframes floatSlow {
    0% {
        transform: translate(0px, 0px) scale(1);
    }
    50% {
        transform: translate(25px, -35px) scale(1.08);
    }
    100% {
        transform: translate(-20px, 20px) scale(0.95);
    }
}

@keyframes floatDelayed {
    0% {
        transform: translate(0px, 0px) scale(1);
    }
    50% {
        transform: translate(-30px, 25px) scale(1.06);
    }
    100% {
        transform: translate(20px, -25px) scale(0.96);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.35;
        transform: scale(1);
    }
    50% {
        opacity: 0.65;
        transform: scale(1.04);
    }
}

@keyframes cyberGrid {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 40px 40px;
    }
}

/* Level 2: Continuous Real-Time Ticker Marquee */
@keyframes marqueeScroll {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Live Market Tick Flashes */
@keyframes tickGreen {
    0% {
        background-color: rgba(52, 211, 153, 0.35);
        color: #34d399;
    }
    100% {
        background-color: transparent;
    }
}

@keyframes tickRed {
    0% {
        background-color: rgba(248, 113, 113, 0.35);
        color: #f87171;
    }
    100% {
        background-color: transparent;
    }
}

/* Subtle Shimmer for High-Priority Buttons & Badges */
@keyframes ctaShimmer {
    0% {
        box-shadow: 0 0 16px rgba(0, 229, 255, 0.3), 0 0 0 0 rgba(0, 229, 255, 0.2);
    }
    70% {
        box-shadow: 0 0 28px rgba(0, 229, 255, 0.6), 0 0 0 8px rgba(0, 229, 255, 0);
    }
    100% {
        box-shadow: 0 0 16px rgba(0, 229, 255, 0.3), 0 0 0 0 rgba(0, 229, 255, 0);
    }
}

@keyframes scanlineShimmer {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(1000%);
    }
}

/* --------------------------------------------------------------------------
   4. Animation Classes
   -------------------------------------------------------------------------- */

.animate-float-slow {
    animation: floatSlow 12s ease-in-out infinite alternate;
}

.animate-float-delayed {
    animation: floatDelayed 15s ease-in-out infinite alternate;
}

.animate-pulse-glow {
    animation: pulseGlow 5s ease-in-out infinite;
}

.animate-cta {
    animation: ctaShimmer 3s infinite ease-in-out;
}

/* Scroll-Driven Entrance Reveals */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.reveal.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-100 {
    transition-delay: 100ms;
}

.reveal-delay-200 {
    transition-delay: 200ms;
}

.reveal-delay-300 {
    transition-delay: 300ms;
}

.reveal-delay-400 {
    transition-delay: 400ms;
}

/* Ticker Marquee Container */
.ticker-container {
    overflow: hidden;
    position: relative;
    width: 100%;
    mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
}

.ticker-track {
    display: flex;
    width: max-content;
    animation: marqueeScroll 45s linear infinite;
    will-change: transform;
}

.ticker-container:hover .ticker-track {
    animation-play-state: paused;
}

.price-flash-up {
    animation: tickGreen 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.price-flash-down {
    animation: tickRed 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --------------------------------------------------------------------------
   5. Interactive Spotlight & 3D Tilt Cards
   -------------------------------------------------------------------------- */

.interactive-card {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
    overflow: hidden;
}

.interactive-card:hover {
    transform: translateY(-4px);
}

/* Mouse-follow spotlight glow border */
.spotlight-card {
    position: relative;
    overflow: hidden;
}

.spotlight-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    padding: 1.5px;
    background: radial-gradient(500px circle at var(--mouse-x, -500px) var(--mouse-y, -500px), rgba(0, 229, 255, 0.4), transparent 40%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
}

.spotlight-card:hover::before {
    opacity: 1;
}

/* Terminal Glassmorphism Scanline */
.terminal-window {
    position: relative;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 229, 255, 0.08);
}

.terminal-scanline {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(180deg, transparent, rgba(0, 229, 255, 0.03), transparent);
    pointer-events: none;
    animation: scanlineShimmer 8s linear infinite;
}

/* --------------------------------------------------------------------------
   6. Cyber Grid Patterns
   -------------------------------------------------------------------------- */
.bg-grid-cyber {
    background-image: radial-gradient(rgba(0, 229, 255, 0.12) 1px, transparent 1px);
    background-size: 32px 32px;
}

.bg-grid-cyber-light {
    background-image: radial-gradient(rgba(2, 132, 199, 0.18) 1.2px, transparent 1.2px);
    background-size: 32px 32px;
}

/* --------------------------------------------------------------------------
   7. FAQ Accordion Transition
   -------------------------------------------------------------------------- */
.faq-content {
    transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, margin 0.3s ease;
}

.faq-icon {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
}

/* --------------------------------------------------------------------------
   8. Light Theme Dedicated Enhancements
   -------------------------------------------------------------------------- */
html.light,
body.light-theme {
    background-color: #f8fafc;
    color: #0f172a;
}

html.light .spotlight-card::before,
body.light-theme .spotlight-card::before {
    background: radial-gradient(500px circle at var(--mouse-x, -500px) var(--mouse-y, -500px), rgba(2, 132, 199, 0.4), transparent 40%);
}

html.light .terminal-window,
body.light-theme .terminal-window {
    box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.08), 0 0 20px rgba(2, 132, 199, 0.08);
}

html.light .terminal-scanline,
body.light-theme .terminal-scanline {
    background: linear-gradient(180deg, transparent, rgba(2, 132, 199, 0.04), transparent);
}

/* --------------------------------------------------------------------------
   9. Institutional Authentication System (Login & Register)
   -------------------------------------------------------------------------- */
.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-card {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.auth-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    outline: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Auth Inputs */
html.dark .auth-input {
    background-color: #171c24;
    border: 1px solid #3b494c;
    color: #dee2ee;
}

html.dark .auth-input:focus {
    border-color: #00e5ff;
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.18);
    background-color: #1b2028;
}

/* Light Auth Inputs */
html.light .auth-input {
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

html.light .auth-input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
    background-color: #ffffff;
}

/* Passkey Wave Radar Pulse */
@keyframes passkeyWave {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.2;
    }
    100% {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

.animate-passkey-wave {
    animation: passkeyWave 3s ease-in-out infinite;
}

/* Password Strength Indicator */
.strength-track {
    height: 4px;
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.4s ease;
}

