/* ============================================
   Demo Shared Styles — Secure Labs
   Driver.js gold theme, tour completion CTA,
   role switcher, bar chart tooltips
   ============================================ */

/* ========== PAGE TRANSITION ========== */
body {
    animation: pageEnter 0.5s ease forwards;
}

@keyframes pageEnter {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ========== BASE ========== */
:root {
    --color-bg: #05140A;
    --color-gold: #F4A261;
}

body {
    background-color: var(--color-bg);
    color: #FAF8F3;
    font-family: 'Inter', sans-serif;
    margin: 0;
    overflow-x: hidden;
}

.noise-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ========== APP CARD SYSTEM ========== */
.app-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    transition: filter 0.2s ease;
}

.app-card:hover {
    filter: brightness(1.15);
}

.stat-card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 10px;
    transition: filter 0.2s ease;
}

.stat-card:hover {
    filter: brightness(1.25);
}

.input-field {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #e2e8f0;
    padding: 8px 12px;
    font-size: 0.875rem;
    width: 100%;
    outline: none;
    box-sizing: border-box;
}

.input-field:focus {
    border-color: #F4A261;
}

.input-field::placeholder {
    color: #475569;
}

.btn-green {
    background: #059669;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease;
}

.btn-green:hover {
    background: #047857;
}

.btn-green:active {
    transform: scale(0.96);
}

/* ========== BADGES ========== */
.badge {
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
    transition: filter 0.2s ease, transform 0.1s ease;
}

.badge:hover {
    filter: brightness(1.15);
}

.badge-green {
    background: rgba(5, 150, 105, 0.15);
    color: #34d399;
}

.badge-amber {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.badge-red {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.badge-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.badge-gray {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
}

.badge-purple {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

/* ========== DRIVER.JS GOLD THEME ========== */
.driver-popover.securegate-demo-popover {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid rgba(244, 162, 97, 0.8);
    border-radius: 14px;
    color: #FAF8F3;
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    max-width: 340px;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.driver-popover.securegate-demo-popover .driver-popover-title {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 400;
    font-style: italic;
    color: #FAF8F3;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

.driver-popover.securegate-demo-popover .driver-popover-description {
    font-size: 0.83rem;
    color: rgba(250, 248, 243, 0.62);
    line-height: 1.65;
    margin-top: 6px;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.driver-popover.securegate-demo-popover .driver-popover-progress-text {
    font-size: 0.68rem;
    color: rgba(244, 162, 97, 0.5);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.driver-popover.securegate-demo-popover .driver-popover-next-btn {
    background: #F4A261;
    color: #05140A;
    border: none;
    border-radius: 999px;
    padding: 7px 20px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.driver-popover.securegate-demo-popover .driver-popover-next-btn:hover {
    background: #e8944f;
    transform: translateY(-1px);
}

.driver-popover.securegate-demo-popover .driver-popover-prev-btn {
    background: transparent;
    color: rgba(244, 162, 97, 0.55);
    border: 1px solid rgba(244, 162, 97, 0.18);
    border-radius: 999px;
    padding: 7px 16px;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.driver-popover.securegate-demo-popover .driver-popover-prev-btn:hover {
    background: rgba(244, 162, 97, 0.1);
    color: #F4A261;
}

.driver-popover.securegate-demo-popover .driver-popover-close-btn {
    color: rgba(255, 255, 255, 0.25);
    transition: color 0.2s;
}

.driver-popover.securegate-demo-popover .driver-popover-close-btn:hover {
    color: rgba(255, 255, 255, 0.75);
}

/* Arrow colors — match gradient background */
.driver-popover.securegate-demo-popover .driver-popover-arrow-side-left {
    border-left-color: #0f2918;
}

.driver-popover.securegate-demo-popover .driver-popover-arrow-side-right {
    border-right-color: #0f2918;
}

.driver-popover.securegate-demo-popover .driver-popover-arrow-side-top {
    border-top-color: #0f2918;
}

.driver-popover.securegate-demo-popover .driver-popover-arrow-side-bottom {
    border-bottom-color: #091a0d;
}

/* Highlighted element ring */
.driver-active-element {
    box-shadow:
        0 0 0 2px rgba(244, 162, 97, 0.45),
        0 0 0 6px rgba(244, 162, 97, 0.07) !important;
    border-radius: 10px;
}

.driver-overlay {
    background: transparent !important;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ========== ROLE SWITCHER PILL BAR ========== */
.role-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(5, 20, 10, 0.6);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    padding: 4px 6px;
}

.role-switcher a {
    text-decoration: none;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 6px 14px;
    border-radius: 9999px;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.3s ease, background 0.3s ease;
    white-space: nowrap;
}

.role-switcher a:hover {
    color: rgba(255, 255, 255, 0.7);
}

.role-switcher a.active {
    color: #05140A;
    background: #F4A261;
    font-weight: 600;
}

/* ========== TOUR COMPLETION CARD ========== */
.completion-card {
    display: none;
    background: rgba(5, 20, 10, 0.5);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(244, 162, 97, 0.25);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    max-width: 480px;
    margin: 40px auto 0;
    animation: completionFadeIn 0.6s ease-out forwards;
}

.completion-card.visible {
    display: block;
}

@keyframes completionFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.completion-card .completion-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(5, 150, 105, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.completion-card .completion-icon .material-symbols-outlined {
    font-size: 28px;
    color: #34d399;
}

.completion-card h3 {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 8px;
}

.completion-card p {
    color: #94a3b8;
    font-size: 0.875rem;
    margin: 0 0 24px;
    line-height: 1.5;
}

.completion-card .cta-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.completion-card .cta-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: #F4A261;
    color: #05140A;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-decoration: none;
    transition: transform 0.2s;
}

.completion-card .cta-primary:hover {
    transform: scale(1.05);
}

.completion-card .cta-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-decoration: none;
    transition: color 0.3s, border-color 0.3s;
}

.completion-card .cta-secondary:hover {
    color: #fff;
    border-color: rgba(244, 162, 97, 0.5);
}

/* ========== NEXT ROLE NUDGE ========== */
.next-role-nudge {
    text-align: center;
    padding: 24px 0;
}

.next-role-nudge a {
    text-decoration: none;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.06em;
    transition: color 0.3s ease;
}

.next-role-nudge a:hover {
    color: #F4A261;
}

.next-role-nudge a .material-symbols-outlined {
    font-size: 14px;
    vertical-align: middle;
}

/* ========== BAR CHART TOOLTIP ========== */
.bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    position: relative;
    height: 100%;
}

.bar-wrapper .bar {
    background: linear-gradient(to top, #059669, #34d399);
    border-radius: 3px 3px 0 0;
    transition: height 0.5s ease, filter 0.2s ease;
    width: 100%;
    cursor: pointer;
}

.bar-wrapper:hover .bar {
    filter: brightness(1.2);
}

.bar-wrapper .bar-tooltip {
    position: absolute;
    top: -8px;
    transform: translateY(-100%);
    background: #0a1f10;
    color: #F4A261;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(244, 162, 97, 0.3);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.bar-wrapper:hover .bar-tooltip {
    opacity: 1;
}

/* ========== INTERACTIVE TOGGLE ========== */
.toggle-switch {
    width: 40px;
    height: 24px;
    border-radius: 9999px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch.on {
    background: #059669;
}

.toggle-switch.off {
    background: #475569;
}

.toggle-switch .toggle-knob {
    position: absolute;
    top: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch.on .toggle-knob {
    left: 18px;
}

.toggle-switch.off .toggle-knob {
    left: 2px;
}

/* ========== TOGGLE TOAST ========== */
.toggle-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #0a1f10;
    border: 1px solid rgba(244, 162, 97, 0.3);
    color: #34d399;
    font-size: 12px;
    font-weight: 500;
    padding: 8px 20px;
    border-radius: 9999px;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.toggle-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========== QR SCANNER SUCCESS STATE ========== */
.scan-success-card {
    text-align: center;
    padding: 24px;
    animation: scanSuccessFade 0.5s ease-out forwards;
}

@keyframes scanSuccessFade {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scan-success-card .success-check {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(5, 150, 105, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.scan-success-card .success-check .material-symbols-outlined {
    font-size: 32px;
    color: #34d399;
}

/* ========== OTP FILL ANIMATION ========== */
@keyframes otpBounce {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    60% {
        transform: scale(1.12);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.otp-box.animating {
    animation: otpBounce 0.35s ease-out forwards;
}

@keyframes verifyPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.5);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(5, 150, 105, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(5, 150, 105, 0);
    }
}

.verify-pulse {
    animation: verifyPulse 1s ease-out 1;
}

/* ========== PHONE-NATIVE MODE (body.phone-native) ========== */
body.phone-native {
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 390px;
    margin: 0 auto;
}

body.phone-native main {
    padding-top: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
}

body.phone-native .app-card {
    border-radius: 10px;
    padding: 12px !important;
    margin-bottom: 10px !important;
}

/* Force 2-col grid on phone (overrides md: breakpoint classes) */
body.phone-native [class*="md:grid-cols-4"],
body.phone-native [class*="md:grid-cols-3"] {
    grid-template-columns: repeat(2, 1fr) !important;
}

/* Hide role switcher in embedded mode */
body.phone-native .role-switcher {
    display: none !important;
}

/* Completion card tighter padding */
body.phone-native .completion-card {
    margin: 20px 0 0;
    padding: 20px;
}

/* ── Title bar: tighter in phone context ── */
body.phone-native #app-main>div:first-child {
    margin-bottom: 14px !important;
}

body.phone-native #app-main>div:first-child h1 {
    font-size: 0.72rem !important;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.phone-native #app-main>div:first-child p {
    font-size: 0.65rem !important;
}

/* ── Stat cards: tighter number sizes on phone ── */
body.phone-native .stat-card .text-2xl {
    font-size: 1.35rem !important;
}

/* ── Section headings: slightly smaller on phone ── */
body.phone-native .app-card h2 {
    font-size: 0.78rem !important;
}

/* ── Reduce table cell padding on phone ── */
body.phone-native table td,
body.phone-native table th {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

/* ── EMBEDDED HEADER ── */
#restart-tour-btn .material-symbols-outlined {
    font-size: 11px;
    vertical-align: middle;
    margin-right: 3px;
}

#embedded-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #05140A;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 10px 16px;
    align-items: center;
    justify-content: space-between;
}

#restart-tour-btn,
#free-explore-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: inherit;
}

#restart-tour-btn {
    color: #F4A261;
}

#free-explore-btn {
    color: rgba(255, 255, 255, 0.35);
}

#restart-tour-btn:hover {
    color: #e8944f;
}

#free-explore-btn:hover {
    color: rgba(255, 255, 255, 0.6);
}