/* ===============================
   Die Zentrale – Support-Bot Style
   =============================== */

/* Farben / Variablen */
:root{
  --brand:#ffbe00;           /* Akzent */
  --brand-dark:#111827;      /* Text auf Brand-Hintergrund */
  --text:#111827;            /* Haupttext */
  --card:#ffffff;            /* Kartenhintergrund */
  --ring:#e5e7eb;            /* Ränder */
  --app-height:100vh;        /* Fallback für Viewport-Höhe */
  --safe-bottom:env(safe-area-inset-bottom, 0px);
}

@supports (height: 100svh){
  :root{--app-height:100svh;}
}

/* ====== Seite & Hintergrund ====== */
html,body{min-height:100%; overflow-x:hidden}
body{
  margin:0;
  font-family:"Segoe UI", Roboto, Arial, sans-serif;
  color:var(--text);
  background:url("assets/Hintergrund.jpg") center center / cover no-repeat fixed;
  position:relative;
  min-height:var(--app-height);
  overflow-y:auto;
  padding-bottom:calc(90px + var(--safe-bottom));         /* Platz für Footer + Sticky-Form auf kleinen Screens */
}

/* dezentes Overlay über Foto */
body::before{
  content:"";
  position:fixed;
  inset:0;
  background:rgba(255,255,255,.75);  /* Stärke des Ausblendens */
  backdrop-filter:blur(3px);
  z-index:-1;
}

/* ====== Logo oben rechts + Sprachumschalter ====== */
header{
  position:fixed;
  top:20px;
  right:30px;
  z-index:20;
  background:rgba(255,255,255,.9);
  padding:10px 14px;
  border-radius:14px;
  box-shadow:0 4px 12px rgba(0,0,0,.15);
  border:1px solid var(--ring);
  display:flex;
  align-items:center;
  gap:12px;
}
header img{
  height:90px;               /* Logo-Größe hier anpassen */
  width:auto;
  display:block;
  border-radius:12px;
  flex-shrink:0;
}
.language-switch{
  padding:8px 14px;
  border-radius:999px;
  background:var(--brand);
  color:var(--brand-dark);
  border:1px solid rgba(17,24,39,.1);
  font-size:.9rem;
  font-weight:600;
  cursor:pointer;
  transition:background .2s, transform .05s, box-shadow .2s;
  box-shadow:0 2px 6px rgba(0,0,0,.12);
}
.language-switch:hover:enabled{background:#ffd84a}
.language-switch:disabled{opacity:.6; cursor:not-allowed; box-shadow:none}
.language-switch:active:enabled{transform:translateY(1px)}

/* ====== Sprachwahl-Modal ====== */
.language-modal{
  position:fixed;
  inset:0;
  background:rgba(17,24,39,.45);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:40;
  transition:opacity .25s ease;
}
.language-modal.hidden{
  opacity:0;
  pointer-events:none;
}
.language-card{
  background:rgba(255,255,255,.95);
  border-radius:20px;
  padding:28px 32px;
  max-width:420px;
  width:100%;
  text-align:center;
  box-shadow:0 18px 36px rgba(0,0,0,.18);
  border:1px solid rgba(15,23,42,.12);
}
.language-card h2{
  margin:0 0 12px;
  font-size:1.6rem;
  color:var(--brand-dark);
}
.language-card p{
  margin:0;
  font-size:1rem;
  line-height:1.5;
  color:#334155;
}
.language-options{
  margin-top:22px;
  display:flex;
  gap:18px;
  justify-content:center;
}

/* ====== Consent-Modal ====== */
.consent-modal{
  position:fixed;
  inset:0;
  background:rgba(17,24,39,.45);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:60;
  transition:opacity .25s ease;
}
.consent-modal.hidden{
  opacity:0;
  pointer-events:none;
}
.consent-card{
  background:rgba(255,255,255,.97);
  border-radius:18px;
  padding:24px 26px;
  max-width:520px;
  width:100%;
  text-align:left;
  box-shadow:0 18px 36px rgba(0,0,0,.18);
  border:1px solid rgba(15,23,42,.12);
}
.consent-card h2{
  margin:0 0 10px;
  font-size:1.35rem;
  color:var(--brand-dark);
}
.consent-card p{
  margin:0 0 12px;
  font-size:0.98rem;
  line-height:1.5;
  color:#334155;
}
.consent-note{
  font-size:0.9rem;
  color:#475569;
  margin-bottom:18px;
}
.consent-last{
  font-size:0.85rem;
  color:#64748b;
  margin:0 0 8px;
}
.consent-last.hidden{
  display:none;
}
.consent-actions{
  display:flex;
  gap:12px;
  justify-content:flex-end;
  flex-wrap:wrap;
}
.consent-actions button{
  flex:1;
  min-width:160px;
}
.consent-secondary{
  background:#f1f5f9;
  color:#0f172a;
  border:1px solid #e2e8f0;
}
.consent-secondary:hover{
  background:#e2e8f0;
}
.consent-actions button:focus-visible{
  outline:3px solid rgba(14,165,233,.35);
  outline-offset:2px;
}

/* ====== Chat-Karte ====== */
main{
  max-width:900px;
  margin:140px auto 90px auto; /* Abstand zum fixen Logo + unten */
  background:rgba(255,255,255,.88);
  border:1px solid var(--ring);
  border-radius:16px;
  box-shadow:0 6px 18px rgba(0,0,0,.15);
  padding:22px 24px 26px;
  display:flex;
  flex-direction:column;
  min-height:calc(var(--app-height) - 260px);
  gap:6px;
}

/* Chatbereich: scrollt intern, Form bleibt unten */
#chat{
  flex:1;
  min-height:0;              /* wichtig, damit Flex-Child scrollen darf */
  overflow-y:auto;
  padding:8px 6px 12px 6px;
}

.fallback-warning{
  margin:12px 0;
  padding:14px 16px;
  border:1px solid #fca5a5;
  background:#fef2f2;
  color:#b91c1c;
  border-radius:12px;
  font-weight:700;
  box-shadow:0 4px 10px rgba(185,28,28,.15);
}

/* Nachrichten-Bubbles */
.msg{margin:10px 0; line-height:1.55; display:flex}
.msg.user{justify-content:flex-end}
.bubble{
  max-width:78%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--ring);
  box-shadow:0 1px 4px rgba(0,0,0,.06);
  background:#f8fafc;
}
.bubble a{
  color:#0f766e;
  font-weight:600;
  text-decoration:underline;
  word-break:break-word;
}
.bubble a:hover{color:#0b4f44}
.user .bubble{
  background:var(--brand);
  color:#000;                 /* Schwarz auf Gelb lesbarer */
  border-color:transparent;
  border-bottom-right-radius:6px;
}
.bot .bubble{
  background:#f3f4f6;
  color:var(--text);
  border-bottom-left-radius:6px;
}
.engine-status{
  margin-top:8px;
  padding-top:6px;
  border-top:1px dashed #d1d5db;
  font-size:0.9rem;
  color:#475569;
}
/* ====== Eingabe fix am Kartenboden ====== */
form{
  display:flex;
  gap:10px;
  margin-top:12px;
  position:sticky;           /* bleibt am unteren Kartenrand */
  bottom:var(--safe-bottom);
  z-index:5;
  background:rgba(255,255,255,.95);
  backdrop-filter:blur(3px);
  padding:10px;
  border:1px solid var(--ring);
  border-radius:12px;
}
input[type="text"]{
  flex:1;
  padding:12px 14px;
  border:1px solid #d1d5db;
  border-radius:10px;
  font-size:1rem;
  outline:none;
  color:var(--text);
  background:#fff;
  transition:border-color .2s, box-shadow .2s;
}
input[type="text"]::placeholder{color:#94a3b8}
input[type="text"]:focus{
  border-color:#0ea5e9;
  box-shadow:0 0 0 3px rgba(14,165,233,.15);
}
button{
  background:var(--brand);
  color:var(--brand-dark);
  border:none;
  border-radius:10px;
  padding:12px 20px;
  font-size:1rem;
  cursor:pointer;
  transition:background .2s, transform .05s;
}
button:hover{background:#ffd84a}
button:active{transform:translateY(1px)}
button.language-option{
  flex:1;
  padding:12px 18px;
  font-size:1.05rem;
  border-radius:12px;
  border:1px solid var(--ring);
  background:var(--brand);
  color:var(--brand-dark);
  font-weight:600;
  box-shadow:0 4px 12px rgba(0,0,0,.1);
}
button.language-option:hover{background:#ffd84a}
button.language-option:active{transform:translateY(1px)}
button.language-option:focus-visible{outline:3px solid rgba(14,165,233,.35); outline-offset:2px}
button.language-switch{
  border:1px solid rgba(17,24,39,.1);
  box-shadow:0 2px 6px rgba(0,0,0,.12);
}

/* ====== Tippen-Animation (. .. …) ====== */
.typing{display:inline-flex; gap:4px; min-width:36px}
.dot{
  width:6px; height:6px;
  border-radius:50%;
  background:#667085;
  animation:blink 1.2s infinite ease-in-out;
}
.dot:nth-child(2){animation-delay:.2s}
.dot:nth-child(3){animation-delay:.4s}
@keyframes blink{0%,80%,100%{opacity:.2} 40%{opacity:1}}

/* ====== Responsive ====== */
@media (max-width:1024px){
  header{top:16px; right:18px; padding:8px 12px; gap:10px}
  header img{height:80px}
  main{margin:128px auto 90px; max-width:860px; padding:20px 22px 24px; min-height:calc(var(--app-height) - 240px)}
  .bubble{max-width:84%}
}

@media (max-width:768px){
  body{background-attachment:scroll; padding-bottom:calc(80px + var(--safe-bottom))}
  header{top:12px; right:14px; padding:8px 10px; gap:10px}
  header img{height:70px}
  .language-switch{padding:6px 12px; font-size:.85rem}
  main{margin:118px 16px 90px; max-width:94%; padding:18px 18px 22px; min-height:calc(var(--app-height) - 220px)}
  form{gap:8px; padding:10px 10px;}
  input[type="text"], button{font-size:.95rem}
  .bubble{max-width:90%}
  footer.signature{font-size:0.82rem; left:12px; bottom:12px}
}

@media (max-width:640px){
  header{top:10px; right:12px; padding:7px 9px; gap:8px}
  header img{height:64px}
  main{margin:108px 12px 92px; padding:16px 14px 20px; min-height:calc(var(--app-height) - 200px)}
  #chat{padding-bottom:18px}
  form{padding:10px 10px; gap:8px}
  input[type="text"]{padding:11px 12px; font-size:.95rem}
  button{padding:11px 16px; white-space:nowrap}
  .bubble{max-width:92%}
  footer.signature{font-size:0.8rem; left:10px; bottom:10px; letter-spacing:0.2px}
}

@media (max-width:480px){
  body{padding-bottom:calc(72px + var(--safe-bottom))}
  header{top:8px; right:10px; padding:6px 8px; gap:6px; border-radius:12px}
  header img{height:58px}
  .language-switch{padding:6px 10px; font-size:.82rem}
  main{margin:100px 10px 96px; padding:14px 12px 18px; min-height:calc(var(--app-height) - 190px)}
  #chat{padding-bottom:22px}
  form{padding:10px 9px; gap:8px}
  input[type="text"]{font-size:.93rem; padding:11px 11px}
  button{padding:11px 14px; font-size:.93rem}
  footer.signature{font-size:0.78rem; max-width:calc(100% - 20px); flex-wrap:wrap}
}

/* ==== Footer Signatur ==== */
footer.signature {
  position: fixed;
  bottom: 12px;
  left: 18px;
  display: flex;
  gap: 0;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 500;              /* leicht kräftiger, nicht fett */
   color: #000;                   /* schwarz */
  text-shadow: none;
  opacity: 0.95;
  z-index: 50;
  letter-spacing: 0.3px;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  user-select: none;
  transition: text-shadow 0.2s, color 0.2s;
}

footer.signature:hover {
   color: #000;
  text-shadow: none;
}

.admin-trigger {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-shadow: inherit;
}

.admin-form {
  display: flex;
  gap: 6px;
  margin-left: 8px;
  align-items: center;
}

.admin-form.hidden {
  display: none;
}

.admin-input {
  width: 70px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 0.85rem;
  outline: none;
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
}

.admin-input:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

/* ===============================
   Analytics Board (dark)
   =============================== */
body.analytics-body{
  background:#0b0f19;
  color:#e2e8f0;
  padding-bottom:0;
}
body.analytics-body::before{
  display:none;
}
.analytics-shell{
  display:grid;
  grid-template-columns: 320px 1fr;
  min-height:100vh;
}
.analytics-sidebar{
  background:#0f172a;
  border-right:1px solid rgba(148,163,184,.15);
  padding:24px 18px;
  overflow-y:auto;
}
.analytics-sidebar-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:18px;
}
.analytics-sidebar-header h2{
  margin:0;
  font-size:1.1rem;
  color:#f8fafc;
}
.analytics-count{
  background:rgba(148,163,184,.15);
  color:#e2e8f0;
  padding:4px 10px;
  border-radius:999px;
  font-size:.8rem;
}
.analytics-sessions{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.analytics-session{
  background:rgba(15,23,42,.8);
  border:1px solid rgba(148,163,184,.18);
  border-radius:14px;
  padding:12px 14px;
  color:#e2e8f0;
  text-align:left;
  cursor:pointer;
  transition:border .2s ease, background .2s ease;
}
.analytics-session:hover{
  border-color:rgba(250,204,21,.45);
}
.analytics-session.active{
  border-color:#facc15;
  background:rgba(30,41,59,.9);
}
.analytics-session-top{
  display:flex;
  justify-content:space-between;
  font-size:.75rem;
  color:#94a3b8;
  margin-bottom:6px;
}
.analytics-session-preview{
  font-size:.85rem;
  color:#e2e8f0;
  margin-bottom:8px;
  line-height:1.4;
}
.analytics-session-count{
  font-size:.75rem;
  color:#94a3b8;
}
.analytics-main{
  padding:28px 32px;
  display:flex;
  flex-direction:column;
  gap:16px;
}
.analytics-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}
.analytics-kicker{
  text-transform:uppercase;
  letter-spacing:.2em;
  font-size:.7rem;
  color:#94a3b8;
  margin:0 0 6px;
}
.analytics-header h1{
  margin:0;
  font-size:2rem;
  color:#f8fafc;
}
.analytics-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.analytics-button{
  background:#facc15;
  color:#1f2937;
  border:none;
  border-radius:999px;
  padding:10px 16px;
  font-weight:600;
  cursor:pointer;
  box-shadow:0 6px 12px rgba(0,0,0,.2);
}
.analytics-button.secondary{
  background:#1e293b;
  color:#e2e8f0;
  border:1px solid rgba(148,163,184,.3);
  box-shadow:none;
}
.analytics-meta{
  font-size:.85rem;
  color:#94a3b8;
}
.analytics-tabs{
  display:flex;
  gap:10px;
}
.analytics-tab{
  background:rgba(30,41,59,.8);
  color:#e2e8f0;
  border:1px solid rgba(148,163,184,.2);
  border-radius:999px;
  padding:8px 18px;
  cursor:pointer;
  font-weight:600;
}
.analytics-tab.active{
  background:#facc15;
  color:#1f2937;
  border-color:#facc15;
}
.analytics-panel{
  background:rgba(15,23,42,.7);
  border:1px solid rgba(148,163,184,.18);
  border-radius:18px;
  padding:18px;
  min-height:280px;
}
.analytics-panel.hidden{
  display:none;
}
.analytics-session-meta{
  font-size:.75rem;
  color:#94a3b8;
  margin-bottom:14px;
  word-break:break-all;
}
.analytics-chat{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.analytics-message{
  background:rgba(30,41,59,.9);
  border-radius:14px;
  padding:12px 14px;
  border:1px solid rgba(148,163,184,.18);
}
.analytics-message.user{
  border-color:rgba(59,130,246,.5);
}
.analytics-message.assistant{
  border-color:rgba(16,185,129,.4);
}
.analytics-message-role{
  font-size:.7rem;
  text-transform:uppercase;
  letter-spacing:.1em;
  color:#94a3b8;
  margin-bottom:6px;
}
.analytics-message-content{
  font-size:.95rem;
  color:#f8fafc;
  line-height:1.5;
  white-space:pre-wrap;
}
.analytics-message-time{
  font-size:.7rem;
  color:#64748b;
  margin-top:8px;
}
.analytics-cards{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));
  gap:14px;
  margin-bottom:18px;
}
.analytics-card{
  background:rgba(30,41,59,.8);
  border-radius:16px;
  padding:16px;
  border:1px solid rgba(148,163,184,.2);
}
.analytics-card h3{
  margin:0 0 8px;
  font-size:.85rem;
  color:#94a3b8;
  text-transform:uppercase;
  letter-spacing:.12em;
}
.analytics-value{
  font-size:2rem;
  margin:0;
  color:#f8fafc;
}
.analytics-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(240px, 1fr));
  gap:16px;
}
.analytics-panel-card{
  background:rgba(30,41,59,.8);
  border-radius:16px;
  padding:16px;
  border:1px solid rgba(148,163,184,.2);
}
.analytics-panel-card h3{
  margin:0 0 10px;
  font-size:.95rem;
  color:#e2e8f0;
}
.analytics-list{
  display:flex;
  flex-direction:column;
  gap:8px;
  font-size:.9rem;
  color:#e2e8f0;
}
.analytics-muted{
  color:#94a3b8;
  font-size:.8rem;
}
.analytics-empty{
  color:#94a3b8;
  font-size:.9rem;
}

@media (max-width: 960px){
  .analytics-shell{
    grid-template-columns:1fr;
  }
  .analytics-sidebar{
    border-right:none;
    border-bottom:1px solid rgba(148,163,184,.15);
  }
}
