/* ═══════════════════════════════════════════════════════════════════
   CIVIUMS DESIGN SYSTEM
   Shared stylesheet — dark civic theme
   Import this file in every page BEFORE page-specific styles.
   <link rel="stylesheet" href="/styles/design-system.css">
═══════════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────
   CSS CUSTOM PROPERTIES (Design Tokens)
────────────────────────────────────────────────── */
:root {
    /* ── Core palette ── */
    --navy:        #0a1628;
    --navy-2:      #0f1e36;
    --navy-3:      #142240;
    --navy-card:   #111d33;
    --navy-border: #1e2e47;

    /* ── Accent (blue) ── */
    --accent:       #4f88ff;
    --accent-dim:   #3a6fd8;
    --accent-glow:  rgba(79,136,255,0.18);
    --accent-text:  #7aaeff;

    /* ── Gold / warm ── */
    --gold:         #f5a623;
    --gold-dim:     rgba(245,166,35,0.15);

    /* ── Semantic ── */
    --dem:          #3b82f6;
    --rep:          #ef4444;
    --green:        #22c55e;
    --green-dim:    rgba(34,197,94,0.15);
    --amber:        #f59e0b;
    --amber-dim:    rgba(245,158,11,0.15);
    --red:          #ef4444;
    --red-dim:      rgba(239,68,68,0.15);

    /* ── Text ── */
    --text-primary:   #f0f4ff;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;

    /* ── Surfaces ── */
    --surface-1:  #0f1e36;
    --surface-2:  #111d33;
    --surface-3:  #162035;

    /* ── Borders ── */
    --border:     #1e2e47;
    --border-dim: #16233a;

    /* ── Radius ── */
    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-xl:  24px;

    /* ── Spacing ── */
    --section-y:  6rem;
    --section-x:  2rem;
    --max-w:      1100px;
    --max-w-text: 720px;

    /* ── Nav height (for scroll-margin / offset) ── */
    --nav-h: 64px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--navy);
    color: var(--text-primary);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font-family: inherit; }
::selection { background: var(--accent); color: #fff; }

/* ──────────────────────────────────────────────────
   TYPOGRAPHY UTILITIES
────────────────────────────────────────────────── */
.max-w  { max-width: var(--max-w);      margin: 0 auto; }
.max-wt { max-width: var(--max-w-text); margin: 0 auto; }

.section-label {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-text);
    margin-bottom: 0.85rem;
}

.section-h2 {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.section-sub {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 580px;
}

.text-center { text-align: center; }
.text-center .section-sub { margin-left: auto; margin-right: auto; }

/* ──────────────────────────────────────────────────
   NAVIGATION
────────────────────────────────────────────────── */
.site-nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 200;
    padding: 1rem var(--section-x);
    background: rgba(10,22,40,0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.nav-logo {
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    flex-shrink: 0;
    text-decoration: none;
}
.nav-logo span { color: var(--accent); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s;
    text-decoration: none;
}
.nav-links a:hover { color: var(--text-primary); }

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* ──────────────────────────────────────────────────
   BUTTONS
────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    text-decoration: none;
    font-family: inherit;
}
.btn-primary:hover {
    background: var(--accent-dim);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79,136,255,0.3);
}
.btn-primary:disabled {
    background: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}
.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}
.btn-ghost:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Danger / destructive variant */
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    background: var(--rep);
    color: #fff;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    white-space: nowrap;
    text-decoration: none;
    font-family: inherit;
}
.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Full-width button modifier */
.btn-full { width: 100%; justify-content: center; }

/* Large button modifier */
.btn-lg {
    padding: 0.85rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

/* ──────────────────────────────────────────────────
   FORM ELEMENTS
────────────────────────────────────────────────── */
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-input {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--surface-1);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group { margin-bottom: 1rem; }

/* ──────────────────────────────────────────────────
   ALERT / STATUS MESSAGES
────────────────────────────────────────────────── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: none;
}

.alert-error {
    background: var(--red-dim);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.3);
}

.alert-success {
    background: var(--green-dim);
    color: #86efac;
    border: 1px solid rgba(34,197,94,0.3);
}

.alert-info {
    background: var(--accent-glow);
    color: var(--accent-text);
    border: 1px solid rgba(79,136,255,0.3);
}

/* ──────────────────────────────────────────────────
   CARD
────────────────────────────────────────────────── */
.card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.card-sm {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

/* ──────────────────────────────────────────────────
   BADGE / CHIP
────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-blue  { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.25); }
.badge-red   { background: var(--red-dim);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
.badge-green { background: var(--green-dim); color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
.badge-gold  { background: var(--gold-dim);  color: var(--gold); border: 1px solid rgba(245,166,35,0.25); }
.badge-amber { background: var(--amber-dim); color: #fcd34d; border: 1px solid rgba(245,158,11,0.25); }

/* ──────────────────────────────────────────────────
   DIVIDER
────────────────────────────────────────────────── */
.divider {
    text-align: center;
    margin: 1.25rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    position: relative;
}
.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 1.5rem);
    height: 1px;
    background: var(--border);
}
.divider::before { left: 0; }
.divider::after  { right: 0; }

/* ──────────────────────────────────────────────────
   FOOTER
────────────────────────────────────────────────── */
.site-footer {
    padding: 2.5rem var(--section-x);
    background: var(--navy-2);
    border-top: 1px solid var(--border);
}

.footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 2rem;
}

.footer-brand {
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}
.footer-brand span { color: var(--accent); }
.footer-tagline { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }

.footer-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}
.footer-links a {
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: color 0.2s;
    text-decoration: none;
}
.footer-links a:hover { color: var(--text-primary); }

.footer-copy {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: right;
}

/* ──────────────────────────────────────────────────
   PAGE WRAPPER (for non-landing pages)
   Adds top padding to account for fixed nav
────────────────────────────────────────────────── */
.page-wrap {
    min-height: 100vh;
    padding-top: var(--nav-h);
    display: flex;
    flex-direction: column;
}

.page-content {
    flex: 1;
    padding: 3rem var(--section-x);
    max-width: var(--max-w);
    margin: 0 auto;
    width: 100%;
}

/* ──────────────────────────────────────────────────
   AUTH CARD (login / signup pages)
────────────────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem var(--section-x);
    background:
        radial-gradient(ellipse 60% 40% at 50% 0%, rgba(79,136,255,0.1) 0%, transparent 70%),
        var(--navy);
}

.auth-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.75rem 2.25rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.35);
}

.auth-logo-link {
    display: block;
    text-align: center;
    text-decoration: none;
    margin-bottom: 2rem;
}

.auth-logo {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.04em;
}
.auth-logo span { color: var(--accent); }

.auth-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0.4rem;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-footer-link {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.auth-footer-link a {
    color: var(--accent-text);
    text-decoration: none;
    font-weight: 600;
}
.auth-footer-link a:hover { text-decoration: underline; }

.auth-terms {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 1rem;
}

/* ──────────────────────────────────────────────────
   RESPONSIVE
────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --section-y: 4rem;
        --section-x: 1.25rem;
    }

    .nav-links a:not(.nav-links a:last-child) { display: none; }

    .footer-inner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.25rem;
    }
    .footer-copy  { text-align: center; }
    .footer-links { justify-content: center; }
}

@media (max-width: 640px) {
    .auth-card {
        padding: 2rem 1.5rem;
        border-radius: var(--radius-lg);
    }
}
