/* =============================================================
   Schichtly — Shared Design System
   Einbinden in jedem Modul:
     <link rel="stylesheet" href="../shared.css">
   Im Dashboard (root-level):
     <link rel="stylesheet" href="shared.css">
   ============================================================= */

/* ── 1. Tokens ─────────────────────────────────────────────── */
:root {
    --lime:           #C8F135;
    --lime-dark:      #9FC200;
    --ink:            #0E0E0E;
    --ink-soft:       #202020;
    --ink-muted:      #6C6C6C;
    --white:          #FFFFFF;
    --surface:        #F5F5F0;
    --surface-strong: #ECECE4;
    --surface-card:   #FFFEFB;
    --purple:         #6C3FF5;
    --purple-light:   #EDE8FF;
    --coral:          #FF5C3A;
    --teal:           #00C2A8;
    --slate:          #64748B;
    --danger:         #EF4444;
    --success:        #10B981;
    --warning:        #F59E0B;
    --border:         rgba(14, 14, 14, 0.10);
    --shadow-soft:    0 18px 50px rgba(14, 14, 14, 0.08);
    --shadow-card:    0 20px 50px rgba(14, 14, 14, 0.12);
    --shadow-shell:   0 28px 90px rgba(14, 14, 14, 0.18);
    --radius:         18px;
    --radius-lg:      28px;
    --radius-pill:    999px;
}

/* ── 2. Reset & Base ────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Epilogue', 'Segoe UI', sans-serif;
    background:
        radial-gradient(circle at top left,  rgba(108, 63, 245, 0.12), transparent 28%),
        radial-gradient(circle at top right, rgba(200, 241, 53, 0.18), transparent 24%),
        var(--surface);
    color: var(--ink);
    min-height: 100vh;
    padding: 24px 20px 42px;
}

h1, h2, h3 {
    font-family: 'Syne', sans-serif;
    letter-spacing: -0.03em;
    line-height: 1.02;
}

button, input, select, textarea {
    font: inherit;
}

a {
    text-decoration: none;
}

/* ── 3. Layout ──────────────────────────────────────────────── */
.container {
    max-width: 1380px;
    margin: 0 auto;
}

/* ── 4. Header-Shell ────────────────────────────────────────── */
.header-shell {
    background: var(--ink);
    border-radius: 32px;
    padding: 22px;
    box-shadow: var(--shadow-shell);
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.header-shell::after {
    content: '';
    position: absolute;
    inset: auto -120px -140px auto;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(200, 241, 53, 0.16), transparent 62%);
    pointer-events: none;
}

.header {
    background: rgba(255, 255, 255, 0.04);
    padding: 18px 22px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.header h1 {
    color: var(--white);
    font-size: clamp(1.6rem, 3vw, 2.8rem);
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── 5. Buttons ─────────────────────────────────────────────── */
.button {
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
    transition: transform 0.2s, opacity 0.2s, background 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    line-height: 1;
}

.button:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

/* Primär — Lime (Hauptaktion) */
.button-primary {
    background: var(--lime);
    color: var(--ink);
}

/* Sekundär — im dark header-shell */
.button-secondary {
    background: rgba(255, 255, 255, 0.10);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

/* Sekundär — auf hellem Hintergrund */
.button-light {
    background: #eef2f7;
    color: #0f172a;
    border: 1px solid var(--border);
}

/* Zurück zum Dashboard */
.button-back {
    background: rgba(255, 255, 255, 0.10);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

/* Gefahr / Löschen */
.button-danger {
    background: var(--danger);
    color: var(--white);
}

/* Erfolg */
.button-success {
    background: var(--success);
    color: var(--white);
}

/* Ghost (nur Outline) */
.button-ghost {
    background: transparent;
    color: var(--ink);
    border: 1.5px solid var(--border);
}

/* Kleiner Variant */
.button-sm {
    padding: 7px 14px;
    font-size: 0.85rem;
}

/* Admin-Button (nur für Admins sichtbar — JS setzt display:flex) */
.button-admin {
    background: rgba(108, 63, 245, 0.14);
    color: var(--purple);
    display: none;
}

/* ── 6. Cards / Panels ──────────────────────────────────────── */
.card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    padding: 24px;
}

.panel {
    background: var(--surface-card);
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    padding: 24px;
    margin-top: 24px;
}

.panel-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.panel h2 {
    font-size: 1.3rem;
}

/* ── 7. Badges / Pills ──────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
}

.badge-ok      { background: #dcfce7; color: #166534; }
.badge-warn    { background: #fef3c7; color: #92400e; }
.badge-alert   { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: var(--purple-light); color: var(--purple); }
.badge-neutral { background: var(--surface-strong); color: var(--ink-muted); }

/* ── 8. Forms ───────────────────────────────────────────────── */
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
    margin-top: 14px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    background: #fff;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(108, 63, 245, 0.10);
}

/* ── 9. Tables ──────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
}

th {
    color: var(--ink-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── 10. Modal ──────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(14, 14, 14, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: s-fadeIn 0.2s ease-out;
}

.modal-box {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 520px;
    width: 92%;
    box-shadow: 0 32px 80px rgba(14, 14, 14, 0.28);
    animation: s-slideUp 0.25s ease-out;
}

.modal-box h2 {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.modal-body {
    color: #475569;
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ── 11. Toast ──────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1100;
    pointer-events: none;
}

.toast {
    background: var(--surface-card);
    border-radius: var(--radius);
    padding: 14px 20px;
    box-shadow: 0 12px 40px rgba(14, 14, 14, 0.18);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    pointer-events: auto;
    animation: s-slideInRight 0.28s ease-out;
    min-width: 260px;
    max-width: 400px;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error   { border-left: 4px solid var(--danger); }
.toast-info    { border-left: 4px solid var(--purple); }
.toast-warn    { border-left: 4px solid var(--warning); }

/* ── 12. Empty State ────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--ink-muted);
}

.empty-state-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    line-height: 1.5;
}

/* ── 13. Loading Spinner ────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 3px solid rgba(14, 14, 14, 0.12);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: s-spin 0.7s linear infinite;
}

/* ── 14. Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
    body {
        padding: 14px 12px 34px;
    }

    .header-shell {
        border-radius: 20px;
        padding: 16px;
        margin-bottom: 18px;
    }

    .header {
        border-radius: 14px;
        padding: 14px 16px;
        flex-direction: column;
        align-items: flex-start;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .card, .panel {
        border-radius: 18px;
        padding: 16px;
    }
}

/* ── 15. Animations ─────────────────────────────────────────── */
@keyframes s-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes s-slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes s-slideInRight {
    from { opacity: 0; transform: translateX(60px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes s-spin {
    to { transform: rotate(360deg); }
}

/* ── 16. Toast JS-Helper (inline script target) ─────────────── */
/*
   Verwendung in JS:
   showToast('Gespeichert', 'success')   → grün
   showToast('Fehler: ...', 'error')     → rot
   showToast('Info...', 'info')          → lila
   showToast('Achtung!', 'warn')         → gelb

   Füge diesen Block einmalig pro Seite ein (oder in shared.js):

   function showToast(msg, type = 'info', duration = 3500) {
     let c = document.querySelector('.toast-container');
     if (!c) { c = document.createElement('div'); c.className = 'toast-container'; document.body.appendChild(c); }
     const t = document.createElement('div');
     t.className = `toast toast-${type}`;
     const icons = { success: '✓', error: '✕', info: 'ℹ', warn: '⚠' };
     t.innerHTML = `<span>${icons[type] || 'ℹ'}</span><span>${msg}</span>`;
     c.appendChild(t);
     setTimeout(() => t.remove(), duration);
   }
*/
