/* V2 Design System - Prime Source */
/* Typography: DM Sans + DM Mono (numbers/data) */

:root {
    --bg: #0f0f10;
    --bg-2: #161618;
    --bg-3: #1e1e21;
    --bg-4: #252528;
    --surface: #1c1c1f;
    --surface-2: #242427;
    --border: rgba(255, 255, 255, 0.07);
    --border-2: rgba(255, 255, 255, 0.12);
    --text: #f0f0ee;
    --text-2: #a8a8a3;
    --text-3: #6a6a65;

    /* PRIMARY ACCENT: Slate-blue — trust, identity, credibility */
    --accent: #4A6FA5;
    --accent-bright: #5A82BC;
    --accent-dim: rgba(74, 111, 165, 0.13);
    --accent-glow: rgba(74, 111, 165, 0.07);
    --accent-border: rgba(74, 111, 165, 0.25);
    --accent-text: #a8c4f0;

    /* SECONDARY SIGNAL: Green — live, confirmed, active only */
    --green: #3ecf6e;
    --green-dim: rgba(62, 207, 110, 0.11);
    --green-border: rgba(62, 207, 110, 0.2);
    --green-text: #7edba0;

    --amber: #a8a8a3;
    --red-dim: rgba(239, 68, 68, 0.15);
}

/* === BASE RESET === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Typography Utility */
.mono {
    font-family: 'DM Mono', monospace;
}

/* === NAVIGATION === */
.v2-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    height: 72px;
    background: rgba(15, 15, 16, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

/* --- PrimeSource frequency mark --- */
.ps-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.ps-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
}

.ps-eq {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    height: 18px;
}

.ps-bar {
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--accent-text), rgba(240, 240, 238, 0.92));
    opacity: 0.95;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 6px 18px rgba(74, 111, 165, 0.12);
    transform-origin: bottom;
}

.ps-bar.b1 {
    height: 8px;
}

.ps-bar.b2 {
    height: 14px;
}

.ps-bar.b3 {
    height: 18px;
}

.ps-bar.b4 {
    height: 11px;
}

@keyframes ps-freq {

    0%,
    100% {
        transform: scaleY(0.75);
        filter: brightness(0.95);
    }

    50% {
        transform: scaleY(1.15);
        filter: brightness(1.05);
    }
}

.ps-eq .b1 {
    animation: ps-freq 1.15s ease-in-out infinite;
    animation-delay: 0.00s;
}

.ps-eq .b2 {
    animation: ps-freq 1.10s ease-in-out infinite;
    animation-delay: 0.12s;
}

.ps-eq .b3 {
    animation: ps-freq 1.05s ease-in-out infinite;
    animation-delay: 0.22s;
}

.ps-eq .b4 {
    animation: ps-freq 1.18s ease-in-out infinite;
    animation-delay: 0.08s;
}

.ps-wordmark {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
    line-height: 1;
}

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

@media (prefers-reduced-motion: reduce) {
    .ps-eq .ps-bar {
        animation: none !important;
    }
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
}

.nav-links a {
    font-size: 14px;
    color: var(--text-2);
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--text);
}

.nav-cta {
    background: var(--accent);
    color: #fff !important;
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 600 !important;
    font-size: 14px !important;
}

/* === BUTTONS === */
.btn-v2 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-v2-primary {
    background: var(--accent);
    color: #fff;
}

.btn-v2-primary:hover {
    background: var(--accent-bright);
    box-shadow: 0 8px 24px rgba(74, 111, 165, 0.2);
}

.btn-v2-secondary {
    background: var(--bg-3);
    color: var(--text-2);
    border: 1px solid var(--border-2);
}

.btn-v2-secondary:hover {
    background: var(--bg-4);
    color: var(--text);
}

/* === CARDS & PANELS === */
.card-v2 {
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.glass-v2 {
    background: rgba(28, 28, 31, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-2);
}

/* === FORMS === */
.input-v2 {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--border-2);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.input-v2:focus {
    border-color: var(--accent-border);
}

/* === TABLES === */
.table-v2 {
    width: 100%;
    border-collapse: collapse;
}

.table-v2 th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
}

/* === UTILITIES & RESPONSIVE HELPER === */
.ps-container-v2 {
    width: 100%;
    margin: 0 auto;
    padding: 0 40px;
}

.grid-2, .grid-3 {
    display: grid;
    gap: 32px;
}

.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.align-center { align-items: center; }

@media (max-width: 992px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .ps-container-v2 { padding: 0 24px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr !important; gap: 24px; }
    
    .mobile-stack {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 20px !important;
    }
}

@media (max-width: 480px) {
    .ps-container-v2 { padding: 0 16px; }
}

.table-v2 tr:hover {
    background: var(--bg-2);
}

/* === BADGES === */
.badge-v2 {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}

.badge-v2-live {
    background: var(--green-dim);
    color: var(--green-text);
    border: 1px solid var(--green-border);
}

/* === SIGNALS === */
.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
}

/* === RESPONSIVE MESH === */
@media (max-width: 1024px) {
    .v2-nav {
        padding: 0 24px;
    }

    .nav-links {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .container-v2 {
        padding: 0 16px !important;
    }

    .v2-nav {
        padding: 0 16px;
    }

    .nav-links {
        display: none;
    }

    /* Hidden by default on mobile */
    .nav-links.active {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 72px;
        left: 0;
        right: 0;
        background: var(--bg-2);
        padding: 40px;
        border-bottom: 1px solid var(--border);
        gap: 24px;
        z-index: 999;
        height: calc(100vh - 72px);
        overflow-y: auto;
    }

    .mobile-toggle {
        display: block !important;
        background: none;
        border: none;
        color: var(--text);
        font-size: 20px;
        cursor: pointer;
    }

    footer div {
        flex-direction: column;
        gap: 32px;
        text-align: center;
    }

    footer div div {
        gap: 16px !important;
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .v2-nav {
         height: 64px;
    }
    
    .nav-links.active {
        top: 64px;
        height: calc(100vh - 64px);
        padding: 32px 20px;
    }
    
    .ps-wordmark {
        font-size: 16px;
    }
    
    .ps-mark {
        width: 22px;
        height: 22px;
    }
}

.mobile-toggle {
    display: none;
}

/* ═══════════════════════════════════════════════════════════
   PRODUCTION THEME SYSTEM — V2 Token Set (--v2-* prefixed)
   Used by: base.html, login, register, forgot/reset, index,
   dashboard, billing, history, search
═══════════════════════════════════════════════════════════ */

:root {
    /* ── Background layers ── */
    --v2-bg: #0a0a10;
    --v2-bg-2: #0f0f18;
    --v2-bg-3: #14141f;

    /* ── Surfaces ── */
    --v2-surface: #111118;
    --v2-surface-2: #18181f;

    /* ── Borders ── */
    --v2-border: rgba(255, 255, 255, 0.07);
    --v2-border-2: rgba(255, 255, 255, 0.13);

    /* ── Text ── */
    --v2-text: #eeeef0;
    --v2-text-2: #9999a5;
    --v2-text-3: #55556a;

    /* ── Accent: Sky blue (#38bdf8) ── */
    --v2-accent: #38bdf8;
    --v2-accent-dim: rgba(56, 189, 248, 0.08);
    --v2-accent-border: rgba(56, 189, 248, 0.2);

    /* ── Indigo ── */
    --v2-indigo: #6366f1;
    --v2-indigo-dim: rgba(99, 102, 241, 0.1);

    /* ── Green: success/live ── */
    --v2-green: #10b981;
    --v2-green-dim: rgba(16, 185, 129, 0.1);
    --v2-green-border: rgba(16, 185, 129, 0.2);

    /* ── Amber: warning ── */
    --v2-amber: #f59e0b;
    --v2-amber-dim: rgba(245, 158, 11, 0.1);

    /* ── Radius ── */
    --v2-r: 10px;
    --v2-r-sm: 6px;
    --v2-r-lg: 14px;
    --v2-r-xl: 20px;

    /* ── Shadows ── */
    --v2-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --v2-shadow-lg: 0 20px 64px rgba(0, 0, 0, 0.55);

    /* ── Fonts ── */
    --v2-font: 'Inter', 'DM Sans', -apple-system, sans-serif;
    --v2-font-mono: 'DM Mono', 'IBM Plex Mono', monospace;

    /* ── Motion ── */
    --v2-fast: 0.15s;
    --v2-med: 0.25s;
    --v2-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── SECTION / LAYOUT HELPERS ── */
.v2-section {
    padding: 80px 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── BADGE ── */
.v2-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--v2-accent);
    margin-bottom: 16px;
}

/* ── HERO GLOW ── */
.v2-hero-glow {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.v2-hero-glow-2 {
    position: absolute;
    top: 100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ── LIVE DOT ── */
.v2-live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--v2-green);
    box-shadow: 0 0 8px var(--v2-green);
    animation: v2-blink 2s ease-in-out infinite;
}

@keyframes v2-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ── GLOW PULSE on CTA ── */
.v2-glow-pulse {
    animation: v2-glowpulse 2.5s ease-in-out infinite;
}

@keyframes v2-glowpulse {

    0%,
    100% {
        box-shadow: 0 0 0 rgba(56, 189, 248, 0);
    }

    50% {
        box-shadow: 0 0 24px rgba(56, 189, 248, 0.35);
    }
}

/* ── GRADIENT TEXT ── */
.v2-gradient-cta {
    background: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── CARD ── */
.v2-card {
    background: var(--v2-surface);
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-r-lg);
    padding: 24px;
    transition: all var(--v2-med) var(--v2-ease);
}

.v2-card:hover {
    border-color: var(--v2-border-2);
    box-shadow: var(--v2-shadow);
}

/* ── BUTTONS ── */
.v2-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--v2-r);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all var(--v2-fast) var(--v2-ease);
    white-space: nowrap;
}

.v2-btn-primary {
    background: var(--v2-accent);
    color: #0a0a10;
}

.v2-btn-primary:hover {
    background: #67d1fb;
    color: #0a0a10;
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.3);
    transform: translateY(-1px);
}

.v2-btn-secondary {
    background: transparent;
    color: var(--v2-text-2);
    border: 1px solid var(--v2-border-2);
}

.v2-btn-secondary:hover {
    background: var(--v2-surface-2);
    color: var(--v2-text);
    border-color: var(--v2-border-2);
}

.v2-btn-lg {
    padding: 13px 26px;
    font-size: 15px;
    border-radius: var(--v2-r-lg);
}

.v2-btn-sm {
    padding: 7px 14px;
    font-size: 12px;
    border-radius: var(--v2-r-sm);
}

/* ── FORM INPUTS ── */
.v2-form-group {
    margin-bottom: 20px;
}

.v2-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--v2-text-3);
    margin-bottom: 8px;
}

.v2-input {
    width: 100%;
    padding: 11px 14px;
    background: var(--v2-bg-2);
    border: 1px solid var(--v2-border-2);
    border-radius: var(--v2-r);
    color: var(--v2-text);
    font-size: 14px;
    font-family: var(--v2-font);
    outline: none;
    transition: border-color var(--v2-fast), box-shadow var(--v2-fast);
    -webkit-text-fill-color: var(--v2-text);
}

.v2-input:focus {
    border-color: var(--v2-accent-border);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.08);
    background: var(--v2-bg-3);
}

.v2-input::placeholder {
    color: var(--v2-text-3);
}

/* Override Bootstrap input groups */
.v2-input.border-end-0 {
    border-right: none !important;
}

/* ── BADGES ── */
.v2-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}

.v2-badge-green {
    background: var(--v2-green-dim);
    color: var(--v2-green);
    border: 1px solid var(--v2-green-border);
}

.v2-badge-blue {
    background: var(--v2-accent-dim);
    color: var(--v2-accent);
    border: 1px solid var(--v2-accent-border);
}

.v2-badge-amber {
    background: var(--v2-amber-dim);
    color: var(--v2-amber);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ── PROGRESS BAR ── */
.v2-progress-wrap {
    height: 4px;
    background: var(--v2-border);
    border-radius: 2px;
    overflow: hidden;
}

.v2-progress-bar {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--v2-accent), var(--v2-indigo));
    transition: width 0.6s var(--v2-ease);
}

/* ── AUTH PAGES ── */
.v2-auth-page {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
}

.v2-auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--v2-surface);
    border: 1px solid var(--v2-border-2);
    border-radius: var(--v2-r-xl);
    padding: 40px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--v2-shadow-lg);
}

.v2-auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--v2-accent-border), transparent);
}

.v2-auth-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--v2-accent-dim);
    border: 1px solid var(--v2-accent-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--v2-accent);
    font-size: 20px;
    margin: 0 auto 20px;
}

.v2-auth-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--v2-text);
    margin-bottom: 6px;
}

.v2-auth-subtitle {
    font-size: 14px;
    color: var(--v2-text-2);
    margin-bottom: 0;
}

.v2-auth-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--v2-r);
    font-size: 13px;
    margin-bottom: 20px;
}

.v2-auth-alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fc8181;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.v2-auth-alert-success {
    background: var(--v2-green-dim);
    color: var(--v2-green);
    border: 1px solid var(--v2-green-border);
}

.v2-auth-alert-info {
    background: var(--v2-accent-dim);
    color: var(--v2-accent);
    border: 1px solid var(--v2-accent-border);
}

.v2-auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--v2-text-3);
}

.v2-auth-footer a {
    color: var(--v2-accent);
    text-decoration: none;
    font-weight: 600;
}

.v2-auth-footer a:hover {
    text-decoration: underline;
}

/* ── EMPTY STATE ── */
.v2-empty-state {
    text-align: center;
    padding: 60px 24px;
}

/* ── STAGGER ANIMATION ── */
.v2-stagger>*:nth-child(1) {
    transition-delay: 0.05s;
}

.v2-stagger>*:nth-child(2) {
    transition-delay: 0.1s;
}

.v2-stagger>*:nth-child(3) {
    transition-delay: 0.15s;
}

.v2-stagger>*:nth-child(4) {
    transition-delay: 0.2s;
}

.v2-stagger>*:nth-child(5) {
    transition-delay: 0.25s;
}

.v2-stagger>*:nth-child(6) {
    transition-delay: 0.3s;
}

/* ── SCROLL REVEAL ── */
.v2-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.55s var(--v2-ease), transform 0.55s var(--v2-ease);
}

.v2-reveal.v2-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── FADE UP ENTRANCE ── */
.v2-fade-up-1 {
    animation: v2-fadeup 0.55s 0.05s var(--v2-ease) both;
}

.v2-fade-up-2 {
    animation: v2-fadeup 0.55s 0.15s var(--v2-ease) both;
}

.v2-fade-up-3 {
    animation: v2-fadeup 0.55s 0.25s var(--v2-ease) both;
}

@keyframes v2-fadeup {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

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

/* ── Bootstrap Integration Overrides ── */
.form-control {
    background: var(--v2-bg-2) !important;
    border: 1px solid var(--v2-border-2) !important;
    color: var(--v2-text) !important;
    border-radius: var(--v2-r) !important;
    padding: 11px 14px !important;
}

.form-control:focus {
    border-color: var(--v2-accent-border) !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.08) !important;
    background: var(--v2-bg-3) !important;
    color: var(--v2-text) !important;
}

.form-control::placeholder {
    color: var(--v2-text-3) !important;
}

/* Autofill override */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--v2-text) !important;
    -webkit-box-shadow: 0 0 0 1000px var(--v2-bg-3) inset !important;
    caret-color: var(--v2-text);
}