/*
 * chatbot.pixagentur.com
 *
 * Gestalterische Linie: "Werkzeug, kein Poster."
 * Der Dienst ist ein Arbeitsgeraet — Postfach, Wissensbasis, Zahlen. Deshalb
 * ein dunkler Schaltpult-Look: ruhige Flaechen, harte 1px-Kanten, und alles
 * Messbare (Zahlen, Status, Schluessel, Bezeichner) in der Monospace. Die
 * Monospace ist bei PixAgentur ohnehin Markenelement; hier traegt sie die
 * halbe Gestaltung.
 *
 * Farben und Schriften kommen von pixagentur.com — die Subdomain soll als
 * Teil derselben Marke lesen, nicht als Fremdkoerper.
 *
 * Keine @font-face-Regeln: die Hauptseite laedt ebenfalls ueber den
 * System-Stack, und die CSP erlaubt font-src nur 'self'.
 */

:root {
    /* Marke */
    --bg:              #ffffff;
    --bg-alt:          #f6f8fb;
    --surface:         #ffffff;
    --surface-raised:  #ffffff;
    --text:            #111827;
    --text-secondary:  #4b5563;
    --text-tertiary:   #6b7280;
    --accent:          #2563eb;
    --accent-hover:    #1d4ed8;
    --accent-soft:     rgba(37, 99, 235, 0.08);
    --accent-glow:     rgba(37, 99, 235, 0.15);
    --border:          #e5e7eb;
    --border-strong:   #d1d5db;
    --input-bg:        #f9fafb;
    --code-bg:         #f3f4f6;
    --grid-dot:        rgba(0, 0, 0, 0.05);

    --ok:      #059669;
    --ok-soft: rgba(5, 150, 105, 0.10);
    --warn:      #b45309;
    --warn-soft: rgba(180, 83, 9, 0.10);
    --bad:      #dc2626;
    --bad-soft: rgba(220, 38, 38, 0.10);

    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", Consolas, monospace;

    --text-xs:  0.75rem;
    --text-sm:  0.875rem;
    --text-base: 1rem;
    --text-lg:  1.125rem;
    --text-xl:  1.375rem;
    --text-2xl: 1.75rem;
    --text-3xl: 2.25rem;
    --text-5xl: 3.25rem;

    --radius:    8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --transition: 0.2s cubic-bezier(.4, 0, .2, 1);
    --bounce:     cubic-bezier(.34, 1.56, .64, 1);

    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);

    color-scheme: light;
}

[data-theme="dark"], :root:not([data-theme="light"]) {
    --bg:              #0a0a14;
    --bg-alt:          #10111f;
    --surface:         #161625;
    --surface-raised:  #1c1c30;
    --text:            #f1f5f9;
    --text-secondary:  #94a3b8;
    --text-tertiary:   #64748b;
    --accent:          #3b82f6;
    --accent-hover:    #60a5fa;
    --accent-soft:     rgba(59, 130, 246, 0.12);
    --accent-glow:     rgba(59, 130, 246, 0.22);
    --border:          #1e293b;
    --border-strong:   #2b3a52;
    --input-bg:        #10111f;
    --code-bg:         #10111f;
    --grid-dot:        rgba(255, 255, 255, 0.045);

    --ok:      #34d399;
    --ok-soft: rgba(52, 211, 153, 0.12);
    --warn:      #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.12);
    --bad:      #f87171;
    --bad-soft: rgba(248, 113, 113, 0.12);

    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .35);

    color-scheme: dark;
}

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

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: var(--text-base)/1.6 var(--font-sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Punktraster als Grundtextur — gibt der Flaeche Tiefe, ohne zu lärmen. */
.texture-dots {
    background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
    background-size: 22px 22px;
}

h1, h2, h3, h4 {
    margin: 0 0 .5em;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
p  { margin: 0 0 1rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, kbd, pre, .mono { font-family: var(--font-mono); }

hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

::selection { background: var(--accent-soft); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Bausteine ──────────────────────────────────────────────────── */

.eyebrow {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 .75rem;
}

.lead { font-size: var(--text-lg); color: var(--text-secondary); }
.muted { color: var(--text-secondary); }
.small { font-size: var(--text-sm); }
.tiny  { font-size: var(--text-xs); }
.center { text-align: center; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row--end { justify-content: flex-end; }
.row--between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }

.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 1.5rem;
}
.container--narrow { max-width: 760px; }
.container--form   { max-width: 440px; }

.section { padding: 5rem 0; }
.section--tight { padding: 2.5rem 0; }
.section--alt { background: var(--bg-alt); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.card--raised { background: var(--surface-raised); box-shadow: var(--shadow); }
.card--flush  { padding: 0; overflow: hidden; }

.grid { display: grid; gap: 1.25rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ── Knöpfe ─────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .625rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font: 600 var(--text-sm)/1.2 var(--font-sans);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), transform .12s var(--bounce), opacity var(--transition);
    white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: .55; cursor: not-allowed; }

.btn--outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}
.btn--outline:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.btn--ghost { background: transparent; color: var(--text-secondary); }
.btn--ghost:hover { background: var(--accent-soft); color: var(--accent); }

.btn--danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn--danger:hover { background: var(--bad-soft); }

.btn--small { padding: .375rem .7rem; font-size: var(--text-xs); }
.btn--block { width: 100%; }

/* ── Formulare ──────────────────────────────────────────────────── */

.field { margin-bottom: 1.1rem; }
.field-label {
    display: block;
    margin-bottom: .375rem;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.field-hint { margin: .375rem 0 0; font-size: var(--text-xs); color: var(--text-tertiary); }
.field-error { display: block; margin-top: .375rem; font-size: var(--text-xs); color: var(--bad); }

.input, .textarea, .select {
    width: 100%;
    padding: .625rem .75rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font: var(--text-sm)/1.5 var(--font-sans);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.textarea { resize: vertical; min-height: 6rem; }
.input--mono, .textarea--mono { font-family: var(--font-mono); font-size: var(--text-xs); }

.input[type="color"] { padding: .25rem; height: 2.5rem; cursor: pointer; }

.check { display: flex; align-items: flex-start; gap: .625rem; cursor: pointer; font-size: var(--text-sm); }
.check input { margin-top: .2rem; accent-color: var(--accent); width: 1rem; height: 1rem; }

/* ── Marken/Status ──────────────────────────────────────────────── */

.tag {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .5rem;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    background: var(--accent-soft);
    color: var(--accent);
    white-space: nowrap;
}
.tag--ok   { background: var(--ok-soft);   color: var(--ok); }
.tag--warn { background: var(--warn-soft); color: var(--warn); }
.tag--bad  { background: var(--bad-soft);  color: var(--bad); }
.tag--mute { background: var(--code-bg);   color: var(--text-tertiary); }

.banner {
    display: flex;
    gap: .75rem;
    padding: .875rem 1rem;
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: var(--radius);
    background: var(--surface);
    font-size: var(--text-sm);
    margin-bottom: 1.25rem;
}
.banner p:last-child { margin-bottom: 0; }
.banner--ok   { border-left-color: var(--ok);   background: var(--ok-soft); }
.banner--warn { border-left-color: var(--warn); background: var(--warn-soft); }
.banner--bad  { border-left-color: var(--bad);  background: var(--bad-soft); }
.banner--info { border-left-color: var(--accent); background: var(--accent-soft); }

/* ── Tabellen ───────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th, .table td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); }
.table th {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 500;
    background: var(--bg-alt);
    position: sticky;
    top: 0;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--accent-soft); }
.table td.num { font-family: var(--font-mono); text-align: right; white-space: nowrap; }

/* ── Kennzahlen ─────────────────────────────────────────────────── */

.metric {
    padding: 1.1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.metric-label {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}
.metric-value {
    display: block;
    margin-top: .35rem;
    font-family: var(--font-mono);
    font-size: var(--text-2xl);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}
.metric-sub { margin-top: .2rem; font-size: var(--text-xs); color: var(--text-tertiary); }

.meter { height: 6px; border-radius: 999px; background: var(--code-bg); overflow: hidden; margin-top: .6rem; }
.meter > span { display: block; height: 100%; background: var(--accent); transition: width .4s var(--transition); }
.meter--warn > span { background: var(--warn); }
.meter--bad  > span { background: var(--bad); }

/* ── Anwendungsgeruest ──────────────────────────────────────────── */

.app {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.app-side {
    border-right: 1px solid var(--border);
    background: var(--bg-alt);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: .45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--accent);
}

.app-nav { display: flex; flex-direction: column; gap: .15rem; }
.app-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .5rem .7rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.app-nav a:hover { background: var(--accent-soft); color: var(--text); text-decoration: none; }
.app-nav a.is-active { background: var(--accent-soft); color: var(--accent); }
.app-nav .count {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    padding: 0 .35rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
}

.app-main { padding: 2rem 2rem 4rem; min-width: 0; }
.app-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1.25rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--border);
}
.app-head h1 { margin: 0; font-size: var(--text-2xl); }
.app-foot { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--border); font-size: var(--text-xs); color: var(--text-tertiary); }

/* ── Gesprächsansicht ───────────────────────────────────────────── */

.convo {
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    gap: 1.25rem;
    align-items: start;
}

.convo-list { max-height: 72vh; overflow-y: auto; }
.convo-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: .75rem .9rem;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    transition: background var(--transition);
}
.convo-item:hover { background: var(--accent-soft); }
.convo-item.is-active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.convo-item-top { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.convo-item-name { font-weight: 600; font-size: var(--text-sm); }
.convo-item-meta { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-tertiary); }

.thread { display: flex; flex-direction: column; gap: .75rem; max-height: 58vh; overflow-y: auto; padding: 1.25rem; }

.bubble {
    max-width: 78%;
    padding: .625rem .875rem;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.bubble--user { align-self: flex-start; background: var(--bg-alt); border: 1px solid var(--border); }
.bubble--assistant { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent-soft); }
.bubble--staff { align-self: flex-end; background: var(--accent); color: #fff; }
.bubble-role {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .65;
    margin-bottom: .2rem;
}

/* ── Startseite ─────────────────────────────────────────────────── */

.site-head {
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    border-bottom: 1px solid var(--border);
}
.site-head .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 1rem; }

.hero {
    position: relative;
    padding: 6rem 0 4rem;
    overflow: hidden;
}
/* Ein einzelner, weicher Lichtkegel hinter der Ueberschrift — das ist der
   ganze Effekt. Mehr wuerde vom Text ablenken. */
.hero::before {
    content: "";
    position: absolute;
    inset: -40% 20% auto -10%;
    height: 620px;
    background: radial-gradient(closest-side, var(--accent-glow), transparent 72%);
    pointer-events: none;
    filter: blur(8px);
}
.hero > .container { position: relative; }
.hero h1 {
    font-size: clamp(2.25rem, 6vw, var(--text-5xl));
    max-width: 18ch;
}
.hero .lead { max-width: 54ch; }

.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.75rem; }

/* Aufzaehlung mit Mono-Nummern statt Punkten — greift die Instrumententafel
   der Anwendung auf. */
.numbered { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.numbered li {
    counter-increment: step;
    display: grid;
    grid-template-columns: 2.5rem 1fr;
    gap: .75rem;
    padding: .9rem 0;
    border-bottom: 1px solid var(--border);
}
.numbered li::before {
    content: counter(step, decimal-leading-zero);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--accent);
}
.numbered li:last-child { border-bottom: 0; }
.numbered strong { display: block; margin-bottom: .15rem; }

.snippet {
    margin: 0;
    padding: 1rem;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre;
    color: var(--text-secondary);
}

.price-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.price {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition), transform var(--transition);
}
.price:hover { border-color: var(--accent); transform: translateY(-2px); }
.price.is-featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.price-name { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.price-amount { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.02em; margin: .5rem 0 .1rem; }
.price-unit { font-size: var(--text-xs); color: var(--text-tertiary); font-family: var(--font-mono); }
.price ul { list-style: none; padding: 0; margin: 1rem 0 0; font-size: var(--text-sm); color: var(--text-secondary); }
.price li { padding: .3rem 0 .3rem 1.25rem; position: relative; }
.price li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-family: var(--font-mono); }

.site-foot { border-top: 1px solid var(--border); padding: 2rem 0; font-size: var(--text-sm); color: var(--text-tertiary); }
.site-foot a { color: var(--text-secondary); }

/* ── Anmeldeseiten ──────────────────────────────────────────────── */

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1.5rem;
}
.auth-card { width: 100%; max-width: 400px; }

/* ── Bewegung ───────────────────────────────────────────────────── */

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}
.rise { animation: rise .45s var(--transition) both; }
.rise-1 { animation-delay: .05s; }
.rise-2 { animation-delay: .12s; }
.rise-3 { animation-delay: .19s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ── Schmale Bildschirme ────────────────────────────────────────── */

@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .app-side {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .app-nav { flex-direction: row; }
    .app-main { padding: 1.5rem 1.25rem 3rem; }
    .convo { grid-template-columns: 1fr; }
    .convo-list { max-height: 40vh; }
}

@media (max-width: 560px) {
    .hero { padding: 3.5rem 0 2.5rem; }
    .section { padding: 3rem 0; }
    .bubble { max-width: 92%; }
}
