@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* Couleurs de marque — gardées uniquement comme accent ponctuel (liens,
   focus), plus comme habillage général : le style plat/neutre/sans-serif
   reprend celui du webui llama.cpp (cf. THIRD_PARTY_NOTICES.md), pas notre
   ancien look "premium" (dégradés, police serif, halos). */
:root {
    --color-terracotta: #C97B63;
    --color-gold: #C9A84C;
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Conservé pour compat (variables encore référencées ailleurs) mais
       neutralisé : plus de dégradé coloré, juste un accent plat. */
    --brand-gradient: var(--text);
    --brand-gradient-soft: var(--bg-elevated);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.08);
    --shadow-md: 0 2px 6px rgba(0,0,0,.12);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.12);
    --ring: 0 0 0 2px rgba(161,161,161,.35);
    --ease: cubic-bezier(.4,0,.2,1);
}

/* Thème sombre (par défaut) — palette reprise du webui llama.cpp
   (tools/ui/src/app.css, licence MIT © 2023-2026 The ggml authors),
   convertie de oklch vers hex pour rester compatible avec notre CSS
   existant basé sur des variables --bg/--text/--border classiques. */
:root[data-theme="dark"] {
    --bg: #0d0d0d;
    --bg-elevated: #171717;
    --bg-input: #1a1a1a;
    --text: #fafafa;
    --text-muted: #a1a1a1;
    --border: rgba(255,255,255,.3);
    --topbar-bg: #000000;
    --bubble-user: #2b2b2b;
    --shadow-md: 0 8px 24px rgba(0,0,0,.45);
    --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
}

/* Thème clair — idem, converti depuis :root (mode clair) du webui llama.cpp. */
:root[data-theme="light"] {
    --bg: #ffffff;
    --bg-elevated: #ffffff;
    --bg-input: #f5f5f5;
    --text: #0a0a0a;
    --text-muted: #737373;
    --border: #d6d6d6;
    --topbar-bg: #0a0a0a;
    --bubble-user: #0a0a0a;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

h1, h2, h3 { font-family: var(--font-heading); letter-spacing: -0.01em; }

::selection { background: rgba(161,161,161,.35); }

/* Scrollbars premium */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::-webkit-scrollbar-track { background: transparent; }

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 1.5rem;
}

.auth-card {
    position: relative;
    background: var(--bg-elevated);
    color: var(--text);
    padding: 2.5rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 380px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.auth-card h1 { font-size: 1.6rem; margin-bottom: 0.25rem; }

.auth-card p.subtitle {
    color: var(--text-muted);
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.field { margin-bottom: 1rem; }

.field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.field input {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: var(--bg-input);
    color: var(--text);
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}

.field input:focus {
    outline: none;
    border-color: transparent;
    box-shadow: var(--ring);
}

.btn {
    display: inline-block;
    width: 100%;
    padding: 0.8rem;
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: opacity .15s var(--ease);
}

.btn:hover { opacity: .85; }
.btn:active { opacity: .7; }

.btn-inline {
    width: auto;
    display: inline-block;
    padding: 0.55rem 1.1rem;
}

/* Bouton secondaire (contour) */
.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}
.btn-secondary:hover { border-color: var(--text-muted); background: var(--bg-elevated); }

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.alert-error { background: #fdecea; color: #b3261e; }

.topbar {
    background: var(--topbar-bg);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar a { color: var(--text); text-decoration: none; font-size: 0.9rem; transition: opacity .15s; }
.topbar a:hover { opacity: .8; }

.container { padding: 2rem; max-width: 1100px; margin: 0 auto; }

.card {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}

.card:hover { box-shadow: var(--shadow-md); }

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: inherit;
    border-radius: 20px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font-body);
    transition: border-color .15s var(--ease), background .15s var(--ease);
}
.theme-toggle:hover { border-color: var(--text-muted); background: var(--bg-elevated); }
