/*
 * base.css — Design Tokens, Reset & Typography
 * ==============================================
 *
 * This file defines the visual foundation of RechtGuard:
 *   1. CSS Custom Properties (colour tokens)
 *   2. CSS Reset (normalize all elements)
 *   3. Typography (Inter font family)
 *   4. Layout utilities (step container, navigation)
 *   5. Animations (fadeUp, spin, scaleIn, pulse)
 *
 * COLOUR SYSTEM:
 *   The dark theme uses a navy/slate background with gold + blue accents.
 *   All colours are defined as CSS variables.
 *
 * FONTS:
 *   - 'Inter'       — All UI text, headings, buttons
 *   - 'Crimson Pro'  — Letter document only (see letter.css)
 */


/* ═══════════════════════════════════════════════════════════════════════════
   1. CSS CUSTOM PROPERTIES (COLOUR TOKENS)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* ─── Light Mode Background Colours ───────────────────────────────── */
    --bg:             #f8fafc;   /* Main page background (slate-50) */
    --bg-card:        #ffffff;   /* Card / panel backgrounds */
    --bg-card-hover:  #f1f5f9;   /* Card hover state (slate-100) */
    --bg-input:       #f1f5f9;   /* Input field backgrounds */
    --bg-darker:      #e2e8f0;   /* Darker sections (slate-200) */

    /* ─── Light Mode Border Colours ───────────────────────────────────── */
    --border:         #e2e8f0;   /* Default borders (slate-200) */
    --border-focus:   #2563eb;   /* Input focus ring (accent blue) */

    /* ─── Gold Accent (Primary Brand Colour) ──────────────────────────── */
    --gold:           #c9a84c;   /* Primary accent — headings, CTAs, icons */
    --gold-light:     #e8d48b;   /* Light gold for subtle highlights */
    --gold-dark:      #a68832;   /* Dark gold for hover states */

    /* ─── Light Mode Text Colours ─────────────────────────────────────── */
    --text:           #0f172a;   /* Primary text (slate-900) */
    --text-muted:     #475569;   /* Secondary text (slate-600) */
    --text-dim:       #94a3b8;   /* Placeholder text (slate-400) */

    /* ─── Semantic Colours (shared) ────────────────────────────────────── */
    --accent:         #2563eb;   /* Blue accent — CTAs, links, highlights */
    --accent-dark:    #1e3a8a;   /* Darker blue for hover / backgrounds */
    --danger:         #ef4444;   /* Errors, fines, deadline alerts */
    --success:        #22c55e;   /* Success states, confirmations */
    --warning:        #f59e0b;   /* Warnings, points in Flensburg */

    /* ─── Border Radius Tokens (shared) ────────────────────────────────── */
    --radius-sm:      0.375rem;  /* 6px — small elements */
    --radius-md:      0.5rem;    /* 8px — inputs, badges */
    --radius-lg:      0.75rem;   /* 12px — buttons, alerts */
    --radius-xl:      1rem;      /* 16px — cards, panels */
    --radius-2xl:     1.5rem;    /* 24px — large cards, sections */
    --radius-full:    9999px;    /* Pill shapes */

    /* ─── Overlay colour ───────────────────────────────────────────────── */
    --overlay:        rgba(15, 23, 42, 0.5);
}

/* ─── Dark Mode Overrides ─────────────────────────────────────────────── */
html.dark {
    --bg:             #0f1729;
    --bg-card:        #182035;
    --bg-card-hover:  #1e2a45;
    --bg-input:       #111b30;
    --bg-darker:      #0a0f1d;
    --border:         #2a3654;
    --border-focus:   #2563eb;
    --text:           #e2e8f0;
    --text-muted:     #8896b3;
    --text-dim:       #5a6a8a;
    --overlay:        rgba(15, 23, 41, 0.85);
}


/* ═══════════════════════════════════════════════════════════════════════════
   2. CSS RESET
   ═══════════════════════════════════════════════════════════════════════════ */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Remove default list styling */
ul, ol {
    list-style: none;
}


/* ═══════════════════════════════════════════════════════════════════════════
   3. TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════════════ */

/* Headings use Inter Black for bold, modern feel */
h1, h2, h3 {
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

/* Step page title — used on every wizard step */
h2.step-title {
    font-size: clamp(22px, 4vw, 28px);
    color: var(--text);
    margin-bottom: 8px;
}

/* Step page subtitle — brief description below the title */
.step-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Section headings within a step (e.g., "Empfänger (Behörde)") */
.section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.section-heading h3 {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--gold);
    margin: 0;
}

.section-heading .icon {
    color: var(--gold);
}

/* Material Symbols icon alignment */
.material-symbols-outlined {
    vertical-align: middle;
    font-variation-settings: 'FILL' 0, 'wght' 400;
}

/* Filled variant for star ratings etc */
.material-symbols-outlined.fill-1 {
    font-variation-settings: 'FILL' 1, 'wght' 400;
}


/* ═══════════════════════════════════════════════════════════════════════════
   4. LAYOUT UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */

/* Standard step container — centers content with consistent padding */
.step-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Wider variant for the review step (letter preview needs more space) */
.step-container--wide {
    max-width: 740px;
}

/* Bottom navigation bar (Back / Next buttons) on every step */
.step-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
}

/* Two-column grid (used for field pairs like PLZ + Ort) */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Two-column grid with narrow left column (PLZ 1fr, Ort 2fr) */
.grid-2-narrow-left {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 12px;
}

/* Separator line with centered text ("oder") */
.separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
}

.separator__line {
    flex: 1;
    height: 1px;
    background: var(--border);
}

.separator__text {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
}

/* Flash messages (errors, warnings, success) */
.flash-container {
    max-width: 640px;
    margin: 16px auto 0;
    padding: 0 24px;
}

.flash {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 8px;
    transition: opacity 0.5s ease;
}

.flash--error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.flash--success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
}

.flash--warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}


/* ═══════════════════════════════════════════════════════════════════════════
   5. ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Fade in from below — used for landing page elements */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Spinner rotation — used by loading overlay */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scale in from zero — used by success checkmark on download step */
@keyframes scaleIn {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* Pulse animation — used by urgency banners */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}


/* ═══════════════════════════════════════════════════════════════════════════
   6. THEME TOGGLE
   ═══════════════════════════════════════════════════════════════════════════ */

.theme-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.theme-toggle:hover {
    transform: scale(1.1);
    border-color: var(--accent);
}

.theme-toggle .material-symbols-outlined {
    font-size: 20px;
}

/* Hide floating toggle on landing page (navbar has its own) */
.landing-page .theme-toggle {
    display: none;
}
