/* ═══════════════════════════════════════════════════════════════
   Rollosson Brand CSS — Shared Design System
   Import this file into any Rollosson project for consistent branding.
   Requires: PicoCSS v2 loaded before this file.
   ═══════════════════════════════════════════════════════════════

   USAGE:
   1. Copy this file into your project: app/static/css/rollosson-brand.css
   2. Copy rollosson_logo.png into: app/static/icons/rollosson_logo.png
   3. In your HTML <head>, load PicoCSS first, then this file:
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
        <link rel="stylesheet" href="/static/css/rollosson-brand.css">
   4. Add your app-specific overrides in a separate file loaded after this one.

   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300..700;1,9..40,300..700&display=swap');

/* ── Brand Tokens ─────────────────────────────────────────── */
:root {
    /* Primary palette */
    --brand-navy: #20205A;
    --brand-navy-light: #2d2d7a;
    --brand-copper: #B8926A;
    --brand-copper-light: #CFAD8A;

    /* Neutral palette */
    --brand-beige: #F5F0EB;
    --brand-beige-dark: #EDE5DC;
    --brand-text: #1A1A2E;
    --brand-muted: #7A7A8E;
    --brand-border: #E0D6CC;
    --brand-card: #FFFFFF;

    /* Semantic colors */
    --brand-success: #2D7A4F;
    --brand-success-bg: #E8F5EE;
    --brand-error: #9A2E2E;
    --brand-error-bg: #FDE8E8;
    --brand-warn: #8B6914;
    --brand-warn-bg: #FFF8E1;
    --brand-info: #1A5276;
    --brand-info-bg: #E1F0FA;

    /* PicoCSS overrides */
    --pico-primary: var(--brand-navy);
    --pico-primary-hover: var(--brand-navy-light);
    --pico-background-color: var(--brand-beige);
    --pico-card-background-color: var(--brand-card);
    --pico-muted-color: var(--brand-muted);
    --pico-muted-border-color: var(--brand-border);
    --pico-color: var(--brand-text);
    --pico-border-radius: 8px;
}

/* ── Typography ───────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background-color: var(--brand-beige);
    color: var(--brand-text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'DM Serif Display', Georgia, serif;
    color: var(--brand-navy);
    letter-spacing: -0.01em;
}

h1 { font-size: 1.75rem; line-height: 1.2; }
h2 { font-size: 1.75rem; line-height: 1.2; }
h3 { font-size: 1.35rem; }

hgroup p {
    font-family: 'DM Sans', sans-serif;
    color: var(--brand-muted);
}

a { color: var(--brand-navy); }
a:hover { color: var(--brand-copper); }

code {
    background: var(--brand-beige-dark);
    color: var(--brand-navy);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.88em;
}

/* ── Buttons ──────────────────────────────────────────────── */
button, [role="button"], input[type="submit"] {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 6px;
    transition: all 0.2s ease;
}

[role="button"]:not(.outline), button:not(.outline):not([type="button"]) {
    --pico-background-color: var(--brand-navy);
    --pico-border-color: var(--brand-navy);
    --pico-color: #fff;
}

[role="button"]:not(.outline):hover, button:not(.outline):not([type="button"]):hover {
    --pico-background-color: var(--brand-navy-light);
    --pico-border-color: var(--brand-navy-light);
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(32,32,90,0.2);
}

.outline {
    --pico-color: var(--brand-navy);
    --pico-border-color: var(--brand-border);
}
.outline:hover {
    --pico-border-color: var(--brand-navy);
    --pico-color: var(--brand-navy);
    background: rgba(32,32,90,0.04);
}

.btn-sm {
    padding: 0.3rem 0.85rem;
    font-size: 0.78rem;
    border-radius: 5px;
}

/* ── Inputs ───────────────────────────────────────────────── */
input, select, textarea {
    font-family: 'DM Sans', sans-serif;
    background: var(--brand-card);
    border-color: var(--brand-border);
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--brand-copper);
    box-shadow: 0 0 0 3px rgba(184,146,106,0.15);
}

/* ── Navigation Bar ───────────────────────────────────────── */
nav.site-nav {
    background: var(--brand-navy);
    padding: 0 2rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 16px rgba(32,32,90,0.12);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav.site-nav .nav-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: #fff;
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
}

nav.site-nav .nav-brand img {
    height: 32px;
    width: 32px;
    border-radius: 4px;
}

nav.site-nav .nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

nav.site-nav .nav-links a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s;
    padding: 0.25rem 0;
}
nav.site-nav .nav-links a:hover { color: #fff; }

nav.site-nav .nav-links .nav-active {
    color: #fff;
    border-bottom: 2px solid var(--brand-copper);
    padding-bottom: 2px;
}

nav.site-nav .nav-links span {
    color: rgba(255,255,255,0.55);
    font-size: 0.85rem;
}

nav.site-nav .nav-links strong {
    color: #fff;
    font-size: 0.9rem;
}

nav.site-nav .nav-links .nav-divider {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.15);
}

/* ── Cards & Surfaces ─────────────────────────────────────── */
article, .card {
    background: var(--brand-card);
    border: 1px solid var(--brand-border);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* ── Flash Messages ───────────────────────────────────────── */
.flash {
    padding: 0.8rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
    font-weight: 500;
    border-left: 4px solid;
}
.flash-success { background: var(--brand-success-bg); color: var(--brand-success); border-color: var(--brand-success); }
.flash-error { background: var(--brand-error-bg); color: var(--brand-error); border-color: var(--brand-error); }
.flash-info { background: var(--brand-info-bg); color: var(--brand-info); border-color: var(--brand-info); }

/* ── Progress Bar ─────────────────────────────────────────── */
.progress-bar {
    background: var(--brand-beige-dark);
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
}
.progress-fill {
    background: linear-gradient(90deg, var(--brand-navy), var(--brand-copper));
    height: 100%;
    border-radius: 20px;
    transition: width 0.4s ease;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.badge-active { background: var(--brand-success-bg); color: var(--brand-success); }
.badge-inactive { background: var(--brand-error-bg); color: var(--brand-error); }

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.status-answered { background: var(--brand-success-bg); color: var(--brand-success); }
.status-skipped { background: var(--brand-warn-bg); color: var(--brand-warn); }
.status-not_sure { background: var(--brand-info-bg); color: var(--brand-info); }
.status-unanswered { background: var(--brand-beige-dark); color: var(--brand-muted); }

/* ── Tables ────────────────────────────────────────────────── */
table {
    border-collapse: separate;
    border-spacing: 0;
    background: var(--brand-card);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--brand-border);
}
table thead th {
    background: var(--brand-beige-dark);
    color: var(--brand-navy);
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--brand-border);
}
table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--brand-beige-dark);
    font-size: 0.92rem;
}
table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: rgba(245,240,235,0.5); }

/* ── Actions ──────────────────────────────────────────────── */
.actions { display: flex; gap: 0.5rem; align-items: center; }
.actions form { margin: 0; }

/* ── Footer ───────────────────────────────────────────────── */
footer.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--brand-muted);
    font-size: 0.82rem;
}
footer.site-footer .footer-brand {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    gap: 0.4rem;
    color: var(--brand-muted);
    text-decoration: none;
    transition: color 0.15s;
}
footer.site-footer .footer-brand:hover {
    color: var(--brand-navy);
}
footer.site-footer .footer-brand:hover img {
    opacity: 0.8;
}
footer.site-footer img {
    height: 16px;
    width: 16px;
    border-radius: 2px;
    opacity: 0.5;
}

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-beige);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    top: -30%; right: -10%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(32,32,90,0.04) 0%, transparent 70%);
    border-radius: 50%;
}
.login-page::after {
    content: '';
    position: absolute;
    bottom: -20%; left: -5%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(184,146,106,0.06) 0%, transparent 70%);
    border-radius: 50%;
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--brand-card);
    border-radius: 16px;
    padding: 2.75rem 2.5rem;
    box-shadow: 0 8px 40px rgba(32,32,90,0.08), 0 1px 3px rgba(0,0,0,0.04);
    position: relative;
    z-index: 1;
    border: 1px solid var(--brand-border);
}
.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}
.login-brand img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    margin-bottom: 1rem;
}
.login-brand h1 {
    font-size: 1.65rem;
    margin-bottom: 0.2rem;
    color: var(--brand-navy);
}
.login-brand p {
    color: var(--brand-muted);
    font-size: 0.92rem;
    margin: 0;
}
.login-error {
    background: var(--brand-error-bg);
    color: var(--brand-error);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
    font-weight: 500;
    border-left: 3px solid var(--brand-error);
}

/* ── Credential Box ───────────────────────────────────────── */
.credential-box {
    background: linear-gradient(135deg, rgba(32,32,90,0.03), rgba(184,146,106,0.06));
    border: 1px solid var(--brand-copper-light);
    border-left: 4px solid var(--brand-navy);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}
.credential-box h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

/* ── Utilities ────────────────────────────────────────────── */
.text-copper { color: var(--brand-copper); }
.text-navy { color: var(--brand-navy); }
.text-muted { color: var(--brand-muted); }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 2rem; }
