/* ═══════════════════════════════════════════
   AIInvoice – shared site styles
   ═══════════════════════════════════════════ */

/* ─── DARK THEME TOKENS (default) ─────────── */
:root {
    --bg:            #080d1a;
    --bg-raised:     #0f1729;
    --bg-surface:    #162035;
    --border:        rgba(255,255,255,0.07);
    --border-med:    rgba(255,255,255,0.12);
    --nav-bg:        rgba(8,13,26,0.88);
    --card-shadow:   0 4px 24px rgba(0,0,0,0.3);
    --primary:       #7c6ef7;
    --primary-dim:   rgba(124,110,247,0.18);
    --primary-glow:  rgba(124,110,247,0.30);
    --cyan:          #22d3ee;
    --text:          #e2e8f0;
    --text-dim:      #94a3b8;
    --text-muted:    #64748b;
    --success:       #34d399;
    --warning:       #fbbf24;
    --danger:        #f87171;
    --info:          #60a5fa;
    --font: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
}

/* ─── LIGHT THEME TOKENS ───────────────────── */
html.theme-light {
    --bg:            #f4f7fb;
    --bg-raised:     #ffffff;
    --bg-surface:    #eef2f8;
    --border:        rgba(100,116,139,0.14);
    --border-med:    rgba(100,116,139,0.22);
    --nav-bg:        rgba(244,247,251,0.92);
    --card-shadow:   0 4px 24px rgba(30,41,59,0.08);
    --primary-dim:   rgba(124,110,247,0.10);
    --primary-glow:  rgba(124,110,247,0.22);
    --text:          #1e293b;
    --text-dim:      #475569;
    --text-muted:    #94a3b8;
}

/* ─── BASE ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.25s, color 0.25s;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }

/* ─── CONTAINER ───────────────────────────── */
.container {
    width: 100%;
    max-width: 1180px;
    margin-inline: auto;
    padding-inline: 24px;
}

.container-narrow {
    width: 100%;
    max-width: 820px;
    margin-inline: auto;
    padding-inline: 24px;
}

/* ─── UTILITIES ───────────────────────────── */
.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-med);
    background: var(--primary-dim);
    color: #a78bfa;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pill::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

/* ─── BUTTONS ─────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 22px;
    border-radius: 10px;
    font-family: var(--font);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #5b49e8);
    color: #fff;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 28px var(--primary-glow);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-med);
    color: var(--text-dim);
}

.btn-ghost:hover { border-color: var(--primary); color: var(--text); }

.btn-sm { min-height: 36px; padding: 7px 16px; font-size: 13px; }

/* ─── NAV ─────────────────────────────────── */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 0;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: background 0.25s, border-color 0.25s;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 18px;
    flex-shrink: 0;
}

.nav-brand img {
    height: 34px;
    border-radius: 8px;
    object-fit: contain;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-links a {
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dim);
    transition: all 0.15s;
    white-space: nowrap;
}

.nav-links a:hover { background: var(--primary-dim); color: var(--text); }
.nav-links a.active-link { background: var(--primary-dim); color: var(--primary); }

/* ─── THEME TOGGLE ────────────────────────── */
.theme-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-med);
    background: transparent;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.15s;
    line-height: 1;
}

.theme-toggle:hover { background: var(--primary-dim); border-color: var(--primary); color: var(--text); }

.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }

html:not(.theme-light) .theme-toggle .icon-sun { display: block; }
html.theme-light        .theme-toggle .icon-moon { display: block; }

/* ─── FOOTER ──────────────────────────────── */
footer {
    padding: 32px 0;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }

.footer-brand img {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    object-fit: contain;
}

.footer-copy { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }

.footer-links a { font-size: 13px; color: var(--text-muted); transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }

/* ─── INNER PAGE LAYOUT ───────────────────── */
.inner-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── PAGE HERO (inner pages) ─────────────── */
.page-hero {
    padding: 56px 0 48px;
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    max-width: 600px;
    max-height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124,110,247,0.09) 0%, transparent 70%);
    pointer-events: none;
}

.page-hero-badge { margin-bottom: 16px; }

.page-hero h1 {
    font-size: clamp(28px, 4vw, 48px);
    font-weight: 900;
    line-height: 1.06;
    letter-spacing: -0.02em;
}

.page-hero .lead {
    margin-top: 12px;
    font-size: clamp(15px, 1.6vw, 17px);
    color: var(--text-dim);
    line-height: 1.65;
    max-width: 600px;
}

.page-hero-meta {
    margin-top: 14px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ─── SUMMARY CARD ────────────────────────── */
.summary-card {
    padding: 28px 32px;
    border-radius: 16px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    margin: 32px 0;
}

.summary-card-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 18px;
}

.summary-points {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.summary-point {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.summary-point-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--primary-dim);
    border: 1px solid rgba(124,110,247,0.2);
    display: grid;
    place-items: center;
    font-size: 16px;
    flex-shrink: 0;
}

.summary-point-text strong { display: block; font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.summary-point-text span   { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

/* ─── DOCUMENT ARTICLE ────────────────────── */
.doc-wrap { padding: 0 0 72px; flex: 1; }

.doc-article {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: clamp(24px, 4vw, 48px);
    box-shadow: var(--card-shadow);
}

.doc-article h2 {
    font-size: 20px;
    font-weight: 800;
    margin: 36px 0 12px;
    padding-left: 14px;
    border-left: 3px solid var(--primary);
    line-height: 1.25;
    color: var(--text);
}

.doc-article h2:first-of-type { margin-top: 24px; }

.doc-article p {
    color: var(--text-dim);
    font-size: 15px;
    line-height: 1.72;
    margin-bottom: 12px;
}

.doc-article ul {
    padding-left: 0;
    list-style: none;
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.doc-article ul li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 15px;
    color: var(--text-dim);
    line-height: 1.6;
}

.doc-article ul li::before {
    content: '';
    flex-shrink: 0;
    margin-top: 7px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
}

.doc-article a { color: var(--primary); font-weight: 600; transition: opacity 0.15s; }
.doc-article a:hover { opacity: 0.8; }

.doc-meta {
    font-size: 13px;
    color: var(--text-muted);
    padding: 10px 14px;
    background: var(--bg-surface);
    border-radius: 8px;
    margin-bottom: 8px;
    display: inline-block;
}

/* ─── STATUS PILLS (shared) ───────────────── */
.status-pill, .history-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    border: 1px solid transparent;
}

.status-approved       { background: rgba(52,211,153,0.15);  color: #34d399; border-color: rgba(52,211,153,0.3); }
.status-rejected       { background: rgba(248,113,113,0.15); color: #f87171; border-color: rgba(248,113,113,0.3); }
.status-needs_correction{ background: rgba(251,191,36,0.15);  color: #fbbf24; border-color: rgba(251,191,36,0.3); }
.status-verified       { background: rgba(96,165,250,0.15);  color: #60a5fa; border-color: rgba(96,165,250,0.3); }
.status-pending        { background: rgba(251,191,36,0.10);  color: #d4a017; border-color: rgba(251,191,36,0.2); }
.status-no_approvers,
.status-missing,
.status-other          { background: rgba(100,116,139,0.12); color: var(--text-muted); border-color: var(--border-med); }

html.theme-light .status-approved       { background: rgba(52,211,153,0.12);  color: #059669; }
html.theme-light .status-rejected       { background: rgba(248,113,113,0.12); color: #dc2626; }
html.theme-light .status-needs_correction{ background: rgba(251,191,36,0.12);  color: #b45309; }
html.theme-light .status-verified       { background: rgba(96,165,250,0.12);  color: #2563eb; }
html.theme-light .status-pending        { background: rgba(251,191,36,0.10);  color: #92400e; }

/* ─── RESPONSIVE ──────────────────────────── */
@media (max-width: 720px) {
    .nav-links { display: none; }

    .summary-points { grid-template-columns: 1fr; }

    footer { padding: 24px 0; }
}

@media (max-width: 480px) {
    .page-hero { padding: 36px 0 32px; }
    .doc-article { padding: 20px; }
    .summary-card { padding: 20px; }
}
