@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --primary: #0054fb;
    --primary-light: #818cf8;
    --accent: #4f46e5;
    --zen-bg: #f8fafc;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 280px;
    --heading-font: 'Fraunces', serif;
    --body-font: 'Space Grotesk', sans-serif;
}

/* MIDNIGHT PRO DARK MODE */
[data-bs-theme="dark"],
body.dark-mode {
    --zen-bg: #0b111a;
    --sidebar-bg: #0f172a;
    --card-bg: #111827;
    --text-main: #e5e7eb;
    --text-muted: #9aa4b2;
    --border-color: #1f2937;
    --primary: #7aa2ff;
    --primary-light: #a5b4fc;
    --accent: #4f46e5;
}

/* --- General Layout --- */
body.zen-body {
    background-color: var(--zen-bg);
    color: var(--text-main);
    font-family: var(--body-font);
    transition: background-color 0.3s, color 0.3s;
    margin: 0;
    overflow-x: hidden;
}

body.zen-body::before{
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(900px 520px at 10% -10%, rgba(0, 84, 251, 0.12), transparent 60%),
        radial-gradient(800px 420px at 95% 5%, rgba(79, 70, 229, 0.08), transparent 55%);
    pointer-events: none;
    z-index: -1;
}

body.dark-mode.zen-body{
    background-image: radial-gradient(circle at 20% 20%, rgba(122,162,255,0.12), transparent 45%),
                      radial-gradient(circle at 80% 0%, rgba(165,180,252,0.08), transparent 40%);
    background-attachment: fixed;
}

/* --- Optimized Gradient Typography (Yellow Line Fix) --- */
h1.text-gradient,
h2.text-gradient,
.text-gradient {
    background-image: linear-gradient(90deg,
            var(--primary) 0%,
            var(--accent) 55%,
            var(--primary-light) 100%) !important;
    /* Standard property - removes the linting warning */
    background-clip: text !important;
    /* Vendor prefixed versions for App/Mobile views */
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    /* Fallback and display logic */
    display: inline-block;
    color: var(--primary);
    font-weight: 800;
}

body.dark-mode h1.text-gradient,
body.dark-mode h2.text-gradient,
body.dark-mode .text-gradient {
    background-image: linear-gradient(90deg,
            #9bb8ff 0%,
            #b7c7ff 55%,
            #a5b4fc 100%) !important;
}

h1, h2, h3, h4, h5, h6{
    font-family: var(--heading-font);
    letter-spacing: 0.01em;
}

/* Sidebar */
.zen-sidebar{
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    transition: width .28s var(--ease), background-color .28s var(--ease), transform .28s var(--ease);
    z-index: 1045;
    box-shadow: none;
}

/* fixed desktop layout */
@media(min-width: 992px){
    .zen-sidebar{
        position: fixed;
        height: 100vh;
        top:0;
        left:0;
    }
    .zen-main{
        margin-left: var(--sidebar-width);
        padding: 48px 56px;
    }
}

/* mobile layout */
@media(max-width: 991.98px){
    .zen-main{
        margin-left: 0;
        padding: 20px 16px;
    }
    .mobile-nav{ position: sticky; top:0; z-index:1030; }
}

/* Navigation links — subtle, accessible */
.nav-link{
    color: var(--text-muted);
    font-weight: 600;
    padding: 10px 14px;
    border-radius: calc(var(--radius) - 2px);
    margin: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color .18s var(--ease), color .18s var(--ease), transform .12s ease;
}

.nav-link:hover{
    color: var(--primary);
    background: linear-gradient(
        90deg,
        rgba(24,103,255,0.14),
        rgba(108,99,255,0.08),
        rgba(24,103,255,0.04)
    );
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 6px 18px rgba(24,103,255,0.18),
        inset 0 0 0 1px rgba(24,103,255,0.12);
    transition:
        transform 0.35s cubic-bezier(.22,.9,.3,1),
        box-shadow 0.35s cubic-bezier(.22,.9,.3,1),
        background 0.35s ease,
        color 0.2s ease;
}

body.dark-mode .nav-link:hover{
    background: linear-gradient(
        90deg,
        rgba(122,162,255,0.12),
        rgba(122,162,255,0.06),
        rgba(122,162,255,0.02)
    );
    box-shadow:
        0 6px 18px rgba(0,0,0,0.4),
        inset 0 0 0 1px rgba(122,162,255,0.18);
}


.nav-link.active{
    background: rgba(24,103,255,0.12);
    color: var(--primary);
    box-shadow: none;
    border-left: 4px solid var(--primary);
    padding-left: 10px; /* compensate for left border */
}

body.dark-mode .nav-link.active{
    background: rgba(122,162,255,0.14);
    border-left-color: var(--primary);
}


/* --- Zen Cards --- */
.zen-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.zen-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body.dark-mode .zen-card{
    box-shadow: 0 10px 18px rgba(0,0,0,0.35);
    background-color: #111827;
}

body.dark-mode .zen-card:hover{
    box-shadow: 0 14px 22px rgba(0,0,0,0.45);
}

.border-start-thick {
    border-left-width: 6px !important;
}

/* --- Input Fields Refined --- */
.zen-input {
    background: var(--zen-bg) !important;
    border: 1.5px solid var(--border-color) !important;
    color: var(--text-main) !important;
    border-radius: 14px !important;
    padding: 0.75rem 1.25rem;
    transition: all 0.2s;
}

.zen-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1) !important;
    outline: none;
}

body.dark-mode .zen-input{
    background: #0f172a !important;
    border-color: #1f2937 !important;
    color: #e5e7eb !important;
}

body.dark-mode .zen-input:focus{
    box-shadow: 0 0 0 4px rgba(122,162,255,0.2) !important;
}

/* --- Primary Action Buttons (Connect / Sync) --- */
.btn.btn-primary{
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    box-shadow: 0 10px 18px rgba(79,70,229,0.22);
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn.btn-primary:hover{
    transform: translateY(-2px);
    box-shadow: 0 14px 22px rgba(79,70,229,0.28);
    filter: brightness(1.03);
}

.btn.btn-primary:active{
    transform: translateY(0);
    box-shadow: 0 6px 12px rgba(79,70,229,0.2);
}

.btn.btn-primary:focus-visible{
    outline: none;
    box-shadow: 0 0 0 4px rgba(79,70,229,0.18), 0 10px 18px rgba(79,70,229,0.22);
}

body.dark-mode .btn.btn-primary{
    box-shadow: 0 10px 20px rgba(0,0,0,0.45), 0 0 0 1px rgba(122,162,255,0.25) inset;
}

body.dark-mode .btn.btn-primary:hover{
    box-shadow: 0 14px 24px rgba(0,0,0,0.55), 0 0 0 1px rgba(165,180,252,0.35) inset;
}

.btn.btn-primary::after{
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.35) 50%, rgba(255,255,255,0) 100%);
    transform: translateX(-120%);
    transition: transform 0.6s ease;
    pointer-events: none;
}

.btn.btn-primary:hover::after{
    transform: translateX(120%);
}

.btn.btn-primary i{
    transition: transform 0.2s ease;
}

.btn.btn-primary:hover i{
    animation: icon-pulse 0.8s ease-in-out infinite;
}

@keyframes icon-pulse{
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* --- Tables & Badges --- */
.table thead th {
    background-color: rgba(0, 0, 0, 0.02);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem;
    border-top: none;
}

body.dark-mode .table thead th {
    background-color: rgba(255, 255, 255, 0.02);
}

body.dark-mode .table{
    color: var(--text-main);
}

body.dark-mode .table td,
body.dark-mode .table th{
    border-color: rgba(31,41,55,0.9);
}

/* Normalize light utility classes in dark mode */
body.dark-mode .bg-white{
    background-color: #111827 !important;
}

body.dark-mode .bg-light,
body.dark-mode .bg-light-subtle,
body.dark-mode .table-light{
    background-color: rgba(15,23,42,0.6) !important;
}

body.dark-mode .text-dark{
    color: var(--text-main) !important;
}

body.dark-mode .border{
    border-color: var(--border-color) !important;
}

body.dark-mode .input-group-text{
    background-color: #0f172a !important;
    color: var(--text-muted) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .offcanvas,
body.dark-mode .modal-content{
    background-color: #111827 !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
}

.zen-badge {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border: 1px solid rgba(79, 70, 229, 0.2);
    font-weight: 700;
    border-radius: 10px;
    padding: 0.4em 0.8em;
}

body.dark-mode .zen-badge {
    background: rgba(129, 140, 248, 0.2) !important;
    color: #a5b4fc !important;
}

/* --- Process Overlay --- */
.process-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 16, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.process-overlay.active {
    display: flex;
}

.process-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 480px;
    border-radius: 28px;
    border: 1px solid var(--border-color);
    padding: 2rem;
}

.process-steps li{
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.process-steps li.active{
    animation: step-pulse 1.2s ease-in-out infinite;
}

.process-steps li.active i{
    animation: step-slide 0.6s ease-out;
}

@keyframes step-pulse{
    0% { transform: translateX(0); }
    50% { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

@keyframes step-slide{
    0% { transform: translateX(-4px); opacity: 0.6; }
    100% { transform: translateX(0); opacity: 1; }
}

.progress-bar-wrap {
    height: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

body.dark-mode .progress-bar-wrap {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .progress-bar-fill{
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    width: 0%;
    transition: width 0.4s ease;
}

/* --- Theme Toggle --- */
.theme-switch-wrapper {
    background: rgba(0, 0, 0, 0.05);
    padding: 8px 12px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
}

body.dark-mode .theme-switch-wrapper{
    background: rgba(255, 255, 255, 0.06);
}

.theme-switch {
    display: inline-block;
    height: 20px;
    position: relative;
    width: 40px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #cbd5e1;
    position: absolute;
    cursor: pointer;
    inset: 0;
    transition: .4s;
    border-radius: 34px;
}

body.dark-mode .slider{
    background-color: #334155;
}

.slider:before {
    background-color: #fff;
    bottom: 3px;
    content: "";
    height: 14px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 14px;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(18px);
}

/* --- Transcription Box --- */
.ocr-text {
    background: rgba(0, 0, 0, 0.02);
    border: 1px dashed var(--border-color);
    padding: 1.5rem;
    border-radius: 16px;
    font-family: var(--body-font);
    font-size: 0.95rem;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
}

body.dark-mode .ocr-text {
    background: rgba(15, 23, 42, 0.7);
}

/* --- Mobile Submission Cards --- */
.mobile-submission-list{
    padding: 12px;
    display: grid;
    gap: 10px;
}

.mobile-sub-card{
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px;
    background: var(--card-bg);
}

.mobile-file-name{
    font-size: 0.95rem;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.mobile-score-wrap{
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(79, 70, 229, 0.05) 100%);
}

/* --- Mobile Bottom Navigation --- */
.mobile-bottom-nav{
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    backdrop-filter: blur(6px);
}

.mobile-bottom-nav a{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-decoration: none;
    font-weight: 600;
}

.mobile-bottom-nav a i{
    font-size: 1.05rem;
}

.mobile-bottom-nav a.active{
    color: var(--primary);
}

.mobile-feedback-fab{
    position: fixed;
    right: 14px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    z-index: 1110;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.24);
}

body.dark-mode .mobile-feedback-fab{
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
    border-color: rgba(122, 162, 255, 0.32);
}

@media(max-width: 991.98px){
    .zen-main{
        padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* compact phones */
@media(max-width: 575.98px){
    .zen-main{
        padding-left: 12px;
        padding-right: 12px;
    }
    .mobile-sub-card{
        padding: 10px;
    }
    .mobile-file-name{
        font-size: 0.9rem;
    }
    .ocr-text{
        font-size: 0.9rem;
        line-height: 1.5;
    }
}

body.dark-mode .mobile-bottom-nav{
    background: #111827;
    border-top-color: var(--border-color);
}

/* --- Analytics Layout --- */
.analytics-tools{
    position: static;
}

.analytics-kpi{
    border-left: 4px solid var(--primary);
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.analytics-kpi:hover{
    transform: translateY(-4px);
}

.analytics-kpi-value{
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-main);
}

.analytics-filters .btn.active{
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

body.dark-mode .analytics-tools{
    background: transparent;
}

body.dark-mode .bg-light,
body.dark-mode .bg-light-subtle{
    background-color: rgba(15, 23, 42, 0.65) !important;
}

/* analytics first-load motion */
.analytics-reveal{
    opacity: 0;
    transform: translateY(22px) scale(0.985);
    filter: blur(2px);
    transition:
        opacity 0.62s cubic-bezier(.22,.9,.3,1),
        transform 0.62s cubic-bezier(.22,.9,.3,1),
        filter 0.62s ease;
    will-change: opacity, transform, filter;
}

.analytics-reveal.in-view{
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

@media(max-width: 991.98px){
    .analytics-tools{
        position: static;
    }
}

@media (prefers-reduced-motion: reduce){
    .analytics-reveal{
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        transition: none !important;
    }
    .analytics-kpi:hover{
        transform: none;
    }
}

/* --- Help Modal (Softer Look) --- */
.help-modal-content{
    background: var(--card-bg);
}

.help-modal-header{
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.14), rgba(79, 70, 229, 0.04));
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color) !important;
}

.help-hero{
    border: 1px solid rgba(79, 70, 229, 0.22);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(79, 70, 229, 0.03));
}

.help-email-code{
    font-size: 0.82rem;
    background: rgba(255, 255, 255, 0.85);
    padding: 10px 12px;
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 10px;
    width: 100%;
    word-break: break-all;
}

.help-step-card{
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.65);
}

.help-step-badge{
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.12);
    border: 1px solid rgba(79, 70, 229, 0.24);
}

#helpModal .modal-body .bg-light{
    background-color: rgba(0, 0, 0, 0.025) !important;
}

body.dark-mode .help-modal-header{
    background: linear-gradient(180deg, rgba(122, 162, 255, 0.12), rgba(122, 162, 255, 0.05));
}

body.dark-mode .help-step-badge{
    color: #c7d5ff;
    background: rgba(122, 162, 255, 0.16);
    border-color: rgba(122, 162, 255, 0.32);
}

body.dark-mode .help-hero{
    border-color: rgba(122, 162, 255, 0.32);
    background: linear-gradient(135deg, rgba(122, 162, 255, 0.14), rgba(122, 162, 255, 0.05));
}

body.dark-mode .help-email-code{
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(122, 162, 255, 0.32);
}

body.dark-mode .help-step-card{
    background: rgba(15, 23, 42, 0.45);
    border-color: var(--border-color);
}

/* --- Case View --- */
.case-text{
    background: rgba(0,0,0,0.02);
    border: 1px dashed var(--border-color);
    padding: 1.25rem;
    border-radius: 16px;
    max-height: 480px;
    overflow-y: auto;
    line-height: 1.65;
    font-size: 0.95rem;
}

.case-text mark{
    background: rgba(249, 115, 22, 0.25);
    color: inherit;
    padding: 0 2px;
    border-radius: 4px;
}

body.dark-mode .case-text{
    background: rgba(15, 23, 42, 0.7);
}

/* --- Landing Hero --- */
.hero-wrap{
    border: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(0, 84, 251, 0.08), rgba(79, 70, 229, 0.04));
    border-radius: 28px;
    padding: 28px;
}

#connect{
    scroll-margin-top: 90px;
}

.hero-eyebrow{
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
}

.hero-title{
    font-size: clamp(2rem, 3.4vw, 3.2rem);
    line-height: 1.05;
}

.hero-subtext{
    font-size: 1rem;
    color: var(--text-muted);
}

.hero-metrics{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.metric-card{
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.75);
}

.metric-label{
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-muted);
    font-weight: 700;
}

.metric-value{
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
}

.trust-strip{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.trust-pill{
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.8);
    font-size: 0.82rem;
    color: var(--text-muted);
}

.hero-steps{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.step-card{
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.75);
}

.step-index{
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.step-title{
    font-weight: 800;
    color: var(--text-main);
    margin-top: 4px;
}

.step-text{
    font-size: 0.85rem;
    color: var(--text-muted);
}
.fade-in-up{
    animation: fadeUp 0.7s ease both;
}

@keyframes fadeUp{
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.stagger-reveal > *{
    opacity: 0;
    transform: translateY(14px);
    animation: staggerUp 0.7s ease forwards;
}

.stagger-reveal > *:nth-child(1){ animation-delay: 0.05s; }
.stagger-reveal > *:nth-child(2){ animation-delay: 0.12s; }
.stagger-reveal > *:nth-child(3){ animation-delay: 0.2s; }
.stagger-reveal > *:nth-child(4){ animation-delay: 0.28s; }
.stagger-reveal > *:nth-child(5){ animation-delay: 0.36s; }
.stagger-reveal > *:nth-child(6){ animation-delay: 0.44s; }
.stagger-reveal > *:nth-child(7){ animation-delay: 0.52s; }

@keyframes staggerUp{
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

body.dark-mode .hero-wrap{
    background: linear-gradient(135deg, rgba(122, 162, 255, 0.1), rgba(122, 162, 255, 0.06));
    border-color: var(--border-color);
}

body.dark-mode .metric-card,
body.dark-mode .trust-pill,
body.dark-mode .step-card{
    background: rgba(15, 23, 32, 0.65);
}

/* --- Utilities --- */
.avatar-box {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-weight: 700;
}
