/* -----------------------------------------------------------------------------
   VA. Information System OS — Sovereign Legal Workstation Edition
   Design Architecture: Executive Law Office UI (Default: Light Mode)
   Copyright (c) 2026 Creators Warehouse & VeteransVSO Platform
   ----------------------------------------------------------------------------- */

/* ☀️ Light Mode Variables (Default) */
:root {
    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #f1f5f9;
    --bg-card-hover: #e2e8f0;
    --border-color: #cbd5e1;
    --border-gold: rgba(217, 119, 6, 0.45);
    
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #64748b;
    
    --gold: #d97706;
    --gold-bright: #b45309;
    --blue-accent: #0284c7;
    --blue-light: #0369a1;
    --emerald: #059669;
    --red: #dc2626;
    --purple: #7c3aed;
    
    --card-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

/* 🌙 Dark Mode Variables (Optional Toggle) */
[data-theme="dark"] {
    --bg-primary: #0b1329;
    --bg-surface: #111e38;
    --bg-card: #182849;
    --bg-card-hover: #1f335c;
    --border-color: rgba(2, 132, 199, 0.25);
    --border-gold: rgba(234, 179, 8, 0.4);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --gold: #f59e0b;
    --gold-bright: #fbbf24;
    --blue-accent: #0284c7;
    --blue-light: #38bdf8;
    --emerald: #10b981;
    --red: #ef4444;
    --purple: #8b5cf6;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-heading);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Header */
.os-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-gold);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--card-shadow);
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-badge {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #fff;
    font-size: 20px;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
    border: 1px solid #fde68a;
}

.brand-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-title span.tag {
    font-size: 11px;
    background: rgba(2, 132, 199, 0.15);
    color: var(--blue-accent);
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
}

.brand-sub {
    font-size: 12px;
    color: var(--gold-bright);
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.firm-license-pill {
    background: rgba(5, 150, 105, 0.12);
    border: 1px solid var(--emerald);
    color: var(--emerald);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.firm-license-pill:hover {
    background: rgba(5, 150, 105, 0.2);
}

.btn-header {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.btn-header:hover {
    background: var(--bg-card);
    border-color: var(--blue-accent);
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

/* Client / Case Switcher Bar */
.case-bar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.case-select-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.case-select-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.case-select {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    min-width: 260px;
}

.case-select:focus {
    border-color: var(--gold);
}

.case-quick-stats {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-item strong {
    color: var(--gold-bright);
}

/* Main Workspace Grid */
.os-main {
    flex: 1;
    display: grid;
    grid-template-columns: 340px 1fr 380px;
    gap: 16px;
    padding: 16px 24px;
    overflow-y: auto;
}

@media (max-width: 1440px) {
    .os-main {
        grid-template-columns: 300px 1fr 340px;
    }
}

@media (max-width: 1100px) {
    .os-main {
        grid-template-columns: 1fr;
    }
}

/* Cards & Panels */
.os-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
}

.card-header {
    background: var(--bg-card);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title .icon {
    font-size: 16px;
}

.card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

/* Left Column: Dossier Details */
.client-hero {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(217, 119, 6, 0.05) 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
}

.client-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 4px;
}

.client-service {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 10px;
}

.dossier-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 12px;
}

.dossier-cell {
    background: var(--bg-surface);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.dossier-label {
    color: var(--text-dim);
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
}

.dossier-val {
    color: var(--text-main);
    font-weight: 600;
    margin-top: 2px;
}

/* Caluza Triangle Gauges */
.caluza-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
}

.caluza-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.caluza-pillar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--bg-card);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 12px;
}

.caluza-pillar:last-child {
    margin-bottom: 0;
}

.pillar-name {
    font-weight: 600;
    color: var(--text-main);
}

.pillar-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.pillar-badge.verified {
    background: rgba(5, 150, 105, 0.15);
    color: var(--emerald);
    border: 1px solid var(--emerald);
}

.pillar-badge.pending {
    background: rgba(217, 119, 6, 0.15);
    color: var(--gold-bright);
    border: 1px solid var(--gold);
}

.pillar-badge.missing {
    background: rgba(220, 38, 38, 0.15);
    color: var(--red);
    border: 1px solid var(--red);
}

/* Conditions List */
.conditions-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.condition-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.condition-title {
    font-weight: 700;
    color: var(--text-main);
}

.condition-meta {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 2px;
}

.condition-pct {
    background: rgba(2, 132, 199, 0.15);
    color: var(--blue-accent);
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
}

/* Center Column: Legal Adjudication Command Center */
.center-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.action-chips-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-chip {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.action-chip:hover {
    background: var(--bg-card);
    border-color: var(--gold);
    color: var(--gold-bright);
    transform: translateY(-1px);
}

/* Legal Input Bar */
.query-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--card-shadow);
}

.query-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 50px;
}

.query-input::placeholder {
    color: var(--text-dim);
}

.query-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.query-hints {
    font-size: 11px;
    color: var(--text-dim);
}

.btn-generate {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #fff;
    border: 1px solid #fde68a;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
}

.btn-generate:hover {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.4);
}

/* Certified Legal Brief Output Area */
.brief-workspace {
    flex: 1;
    min-height: 480px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.brief-toolbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brief-status {
    font-size: 12px;
    color: var(--gold-bright);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.brief-actions {
    display: flex;
    gap: 8px;
}

.btn-brief-action {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-brief-action:hover {
    background: var(--bg-card);
    border-color: var(--blue-accent);
}

.brief-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-main);
}

/* Formal Law Firm Letterhead Stamped Header */
.firm-letterhead {
    border-bottom: 2px solid var(--gold);
    padding-bottom: 16px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.firm-name-seal {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.3px;
}

.firm-detail-line {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}

.confidential-watermark {
    background: rgba(217, 119, 6, 0.12);
    border: 1px dashed var(--gold);
    color: var(--gold-bright);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Markdown Styling inside Brief Content */
.brief-content h1, .brief-content h2, .brief-content h3 {
    color: var(--text-main);
    margin-top: 18px;
    margin-bottom: 8px;
}

.brief-content h3 {
    color: var(--blue-accent);
    font-size: 15px;
    border-left: 3px solid var(--gold);
    padding-left: 10px;
}

.brief-content p {
    margin-bottom: 14px;
}

.brief-content strong {
    color: var(--text-main);
}

.brief-content ul, .brief-content ol {
    margin-left: 20px;
    margin-bottom: 14px;
}

.brief-content li {
    margin-bottom: 6px;
}

/* Right Column: Tactical Legal Tools */
.right-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tab-nav {
    display: flex;
    background: var(--bg-card);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.tab-btn.active {
    background: var(--blue-accent);
    color: #fff;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Tools Form Controls */
.calc-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calc-input-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
}

.calc-input {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.calc-input:focus {
    border-color: var(--gold);
}

.calc-result-box {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calc-stat {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.calc-stat strong {
    color: var(--gold-bright);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 580px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.modal-header {
    background: var(--bg-card);
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-footer {
    background: var(--bg-card);
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Print Friendly Styles for Certified Briefs */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .os-header, .case-bar, .center-col .action-chips-bar, .query-box, .right-col, .os-main > .os-card:first-child, .brief-toolbar {
        display: none !important;
    }
    .os-main {
        display: block !important;
        padding: 0 !important;
    }
    .brief-workspace {
        border: none !important;
        background: #fff !important;
    }
    .brief-content {
        color: #000 !important;
        padding: 0 !important;
    }
    .firm-letterhead {
        border-bottom: 2px solid #000 !important;
    }
    .firm-name-seal {
        color: #000 !important;
    }
    .brief-content h3 {
        color: #000 !important;
        border-left: 3px solid #000 !important;
    }
    .brief-content strong {
        color: #000 !important;
    }
}
