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

:root {
    /* Colors */
    --primary-color: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --dark-bg: #0f172a;
    --dark-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Glassmorphism */
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: 12px;
}

html,
body {
    background-color: var(--dark-bg);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    width: 100%;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 40%);
    background-attachment: fixed;
    /* Removed global overflow-x hidden to fix sticky behavior */
}

/* Apply overflow-x hidden only to body to prevent horizontal scroll but allow sticky */
body {
    overflow-x: clip;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.text-gradient {
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-accent {
    color: var(--primary-color);
}

.text-gray-300 {
    color: #cbd5e1;
}

/* Force override bootstrap text-muted for dark theme visibility */
.text-muted {
    color: #94a3b8 !important;
}

.text-success-bright {
    color: #4ade80 !important;
}

.text-gray-500 {
    color: #64748b;
}

/* Navigation */
.glass-nav {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.nav-link {
    color: var(--text-muted) !important;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-main) !important;
}

/* Buttons */
.btn-primary-glow {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
    color: white;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-2px);
}

/* Cards & Glassmorphism */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.36);
}

.card {
    background: var(--dark-card);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.card-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
}

/* Feature Cards */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
}

.bg-blue-500-20 {
    background: rgba(59, 130, 246, 0.2);
}

.bg-purple-500-20 {
    background: rgba(139, 92, 246, 0.2);
}

.bg-green-500-20 {
    background: rgba(16, 185, 129, 0.2);
}

.bg-pink-500-20 {
    background: rgba(236, 72, 153, 0.2);
}

.bg-orange-500-20 {
    background: rgba(249, 115, 22, 0.2);
}

.bg-cyan-500-20 {
    background: rgba(6, 182, 212, 0.2);
}

.text-pink {
    color: #f472b6;
}

.text-orange {
    color: #fb923c;
}

.text-cyan {
    color: #22d3ee;
}

.text-purple {
    color: #a78bfa;
}

.text-green {
    color: #34d399;
}

/* Form Elements */
.form-control,
.form-select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-radius: 8px;
    padding: 10px 15px;
}

.form-control:focus,
.form-select:focus {
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    color: white;
}

/* Hero Blobs */
.glow-blob {
    position: fixed;
    /* Fixed to viewport to stay uniform during scroll */
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    z-index: 0;
    pointer-events: none;
    /* Ensure no interference */
}

.blob-1 {
    background: var(--primary-color);
    top: -200px;
    left: -200px;
    animation: blob-float 10s infinite alternate;
}

.blob-2 {
    background: var(--secondary-color);
    bottom: -200px;
    right: -200px;
    animation: blob-float 12s infinite alternate-reverse;
}

@keyframes blob-float {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(50px, 50px);
    }
}

/* Animations */
.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.perspective-container {
    perspective: 1000px;
}

.dashboard-mockup {
    transform: rotateX(5deg);
    transition: transform 0.5s ease;
}

.dashboard-mockup:hover {
    transform: rotateX(0deg) scale(1.02);
}

.live-dashboard {
    background: var(--dark-card);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
}

.live-dashboard:hover {
    transform: none;
}

.bg-black-10 {
    background: rgba(0, 0, 0, 0.1);
}

.bg-accent-20 {
    background: rgba(6, 182, 212, 0.2);
}

.bg-gradient-dark {
    background: linear-gradient(to bottom right, rgba(15, 23, 42, 0.5), rgba(0, 0, 0, 0.2));
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

/* Rich Interaction Zones */
.interactive-zone {
    position: relative;
    transition: all 0.3s ease;
    cursor: default;
}

.interactive-zone:hover {
    z-index: 20;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.rich-tooltip {
    position: absolute;
    width: 280px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.interactive-zone:hover .rich-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.visual-preview {
    border: 1px solid var(--glass-border);
    overflow: hidden;
}


/* Table Styles Override */
.table {
    --bs-table-color: var(--text-muted);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--glass-border);
}

.table-light {
    --bs-table-bg: rgba(255, 255, 255, 0.05);
    --bs-table-color: var(--text-main);
}

.table-hover tbody tr:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.1);
}

.table-hover tbody tr:hover td {
    color: #fff;
}

/* Badges */
.badge.bg-info {
    background-color: rgba(6, 182, 212, 0.2) !important;
    color: #22d3ee !important;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

/* Modal */
.modal-content {
    background: var(--dark-card);
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-header,
.modal-footer {
    border-color: var(--glass-border);
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Tabs */
.nav-tabs {
    border-bottom-color: var(--glass-border);
}

.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
}

.nav-tabs .nav-link:hover {
    color: var(--text-main);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    background: transparent;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

/* Utilities */
.bg-white-5 {
    background: rgba(255, 255, 255, 0.05);
}

.border-white-10 {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.bg-dark-card {
    background: rgba(0, 0, 0, 0.2);
}

.fs-7 {
    font-size: 0.875rem;
}

.uppercase {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

/* Sidebar & Layout */
#sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-item-custom {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    border-radius: 8px;
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item-custom:hover,
.nav-item-custom.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.nav-item-custom i {
    font-size: 1.25rem;
    margin-right: 1rem;
    width: 24px;
    text-align: center;
}

.nav-label {
    font-weight: 500;
}

#topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 260px;
    height: 70px;
    z-index: 900;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    transition: left 0.3s ease;
}

#main-content {
    margin-left: 260px;
    padding-top: 90px;
    padding-bottom: 2rem;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* User Profile Dropdown */
.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.05);
}

.avatar-circle {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Mobile Responsive */
@media (max-width: 991px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.show {
        transform: translateX(0);
    }

    #topbar {
        left: 0;
        padding: 0 1rem;
    }

    #main-content {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block !important;
    }

    /* Index Page Mobile Fixes */
    .hero-section {
        padding-top: 100px;
        /* Ensure content clears fixed navbar */
        min-height: auto;
        /* Allow content to dictate height on mobile */
    }

    .hero-section .display-1 {
        font-size: 2.5rem;
        /* Smaller font on mobile */
    }

    .live-dashboard {
        height: auto !important;
        /* Allow content to dictate height */
        min-height: 400px;
    }

    /* Scale down content inside the preview for mobile */
    .live-dashboard .dashboard-main {
        padding: 1rem !important;
    }

    .live-dashboard h3 {
        font-size: 1.25rem;
    }

    .live-dashboard h4 {
        font-size: 1rem;
    }

    .live-dashboard .lead {
        font-size: 0.9rem;
    }

    .live-dashboard .small,
    .live-dashboard small {
        font-size: 0.75em;
    }

    .live-dashboard .bi {
        font-size: 1em;
    }

    .container {
        padding-left: 20px;
        padding-right: 20px;
    }

    /* Auth View Mobile Optimization */
    #view-auth .col-md-6 {
        width: 100%;
        max-width: 100%;
    }

    #view-auth .card-body {
        padding: 2rem !important;
    }

    #view-auth h3 {
        font-size: 1.75rem;
        margin-bottom: 2rem !important;
    }

    /* Increased spacing between form groups */
    #view-auth .mb-3 {
        margin-bottom: 1.5rem !important;
    }

    #view-auth .form-control {
        padding: 10px 15px;
        /* Slightly reduced height */
        font-size: 1rem;
        /* Revert to standard size for better proportions */
        height: auto;
    }

    #view-auth .btn {
        padding: 10px;
        /* Slightly reduced height */
        font-size: 1rem;
        margin-top: 0.5rem;
        /* Extra space before button */
    }

    #view-auth label {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
        color: var(--text-muted);
    }

    /* Sidebar Overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
}


/* Showcase & Scrollytelling Styles */
.showcase-wrapper {
    position: relative;
    /* Create scroll space: 4 steps * 100vh roughly */
    height: 400vh;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through if needed, but sticky container has content */
}

.sticky-container {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 20;
    z-index: 20;
    /* Background removed to let global glows show through */
    pointer-events: auto;
}

/* Step Triggers (Invisible markers) */
.step-trigger {
    position: absolute;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 15;
    /* border: 1px solid red; */
}

.step-trigger[data-step="0"] {
    top: 0;
}

.step-trigger[data-step="1"] {
    top: 100vh;
}

.step-trigger[data-step="2"] {
    top: 200vh;
}

.step-trigger[data-step="3"] {
    top: 300vh;
}

/* Dashboard Highlight States */
.live-dashboard {
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-origin: center center;
}

.interactive-zone {
    transition: all 0.5s ease;
}

/* Dimmed State */
.dimmed {
    opacity: 0.3;
    filter: blur(2px);
    transform: scale(0.98);
    pointer-events: none;
}

/* Active Highlight State */
.highlight-active {
    opacity: 1;
    filter: none;
    transform: scale(1.05);
    z-index: 50;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.3), 0 20px 50px rgba(0, 0, 0, 0.5);
    background: rgba(30, 41, 59, 0.9);
    /* More solid background to pop */
    border-color: var(--accent-color);
}

/* Text Captions Overlay */
.showcase-text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    /* Center over the dashboard */
    width: 100%;
    max-width: 1000px;
    /* Match dashboard mock width */
    height: 600px;
    /* Match dashboard mock height */
    z-index: 100;
    pointer-events: none;
    /* border: 1px dashed rgba(255,255,255,0.1); /* Debug alignment */
}

.text-step {
    position: absolute;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.5s ease;
    background: rgba(15, 23, 42, 0.9);
    /* Slightly darker for better readability over content */
    backdrop-filter: blur(12px);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--accent-color);
    max-width: 350px;
}

/* Context-aware positioning for Desktop */
.text-step[data-step="0"] {
    /* Center for Intro */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(20px);
    text-align: center;
    border-left: 1px solid var(--glass-border);
    /* Remove side accent for clear card look */
    border-top: 4px solid var(--accent-color);
}

.text-step[data-step="0"].active {
    transform: translate(-50%, -50%);
}

.text-step[data-step="1"] {
    /* Near Sidebar (Right of 80px sidebar) */
    top: 120px;
    left: 120px;
}

.text-step[data-step="2"] {
    /* Below Stats Row (Stats are top ~180px) */
    top: 240px;
    left: 120px;
}

.text-step[data-step="3"] {
    /* Near Chart/Bottom area */
    bottom: 40px;
    left: 120px;
}

.text-step.active {
    opacity: 1;
    visibility: visible;
    /* Transform handled per step for intro, reset for others */
}

.text-step:not([data-step="0"]).active {
    transform: translateY(0);
}

/* Mobile Adjustments for Showcase - Sticky Experiment */
@media (max-width: 991px) {
    .showcase-wrapper {
        height: 350vh !important;
        /* Restore scroll length */
        padding-bottom: 0;
    }

    .sticky-container {
        position: sticky !important;
        /* Re-enable sticky */
        top: 0;
        height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start;
        /* Align top */
        padding: 60px 0 0 0 !important;
        /* Space for navbar */
        overflow: hidden !important;
    }

    /* Reset inner container */
    .sticky-container .container {
        display: block !important;
        height: 100%;
        width: 100%;
    }

    /* Dashboard Mockup - Scaled for Mobile */
    .live-dashboard {
        position: absolute;
        top: 80px;
        /* Position towards top */
        left: 50%;
        /* transform: translateX(-50%) scale(0.65) !important;  <-- Handled by JS now */
        transform-origin: top center;
        width: 1000px !important;
        /* Keep original desktop width basis for scaling */
        height: 600px !important;
        max-width: none !important;

        /* Re-enable interactions/styles */
        flex-direction: row !important;
        /* Keep desktop row layout inside */
        margin-bottom: 0;
    }

    /* Show sidebar again for the full visual */
    .dashboard-sidebar {
        display: flex !important;
    }

    .dashboard-main {
        padding: 1.5rem !important;
        /* Restore padding */
    }

    /* Restore Step Triggers */
    .step-trigger {
        display: block !important;
        height: 87vh;
        /* Slightly shorter on mobile */
    }

    /* Text Overlay - Positioned at bottom */
    .showcase-text-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        pointer-events: none;
    }

    /* Text Steps - Floating Cards at Bottom */
    .text-step {
        position: absolute !important;
        bottom: 100px;
        /* Position at bottom of screen */
        left: 50% !important;
        width: 90%;
        max-width: 400px;
        transform: translateX(-50%) translateY(20px) !important;
        margin: 0;

        /* Ensure visibility transitions work */
        opacity: 0 !important;
        visibility: hidden !important;
        display: block;

        /* Mobile Card Style */
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(16px);
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    .text-step.active {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateX(-50%) translateY(0) !important;
    }

    /* Remove the specific positioning overrides */
    .text-step[data-step] {
        top: auto !important;
        left: 50% !important;
        right: auto !important;
    }

    /* Re-enable dimming for "Stickiness" feel */
    .dimmed {
        opacity: 0.3 !important;
        filter: blur(2px) !important;
    }

    .highlight-active {
        box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.3) !important;
        background: rgba(30, 41, 59, 0.9) !important;
    }
}