/* ==================================================
   🌍 1. GLOBALS & RESET
   ================================================== */
:root {
  --sidebar-width: 240px;
  --max-content-width: 1200px;
  --color-bg: #202021;
  --color-text: #e5ecf5;
  --color-accent: #6ca5ff;
  --color-accent-light: #60a5fa;
  --color-warning: rgba(220, 38, 38, 0.15);
  --color-success: rgba(34, 197, 94, 0.15);
  --color-notice: rgba(59, 130, 246, 0.15);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: #444; border-radius: 3px; }


/* ==================================================
   🧾 2. TYPOGRAPHIE
   ================================================== */
h1, h2 { color: #ffffff; font-weight: 700; }
h1 { font-size: 2.4em; text-align: center; }
h2 { font-size: 1.8rem; margin-top: 2rem; margin-bottom: 0.75rem; }
label { display: block; margin: 24px 0 8px; font-weight: 500; color: #cbd2e1; }

a { color: #abc7ff; font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; }


/* ==================================================
   🔘 3. BUTTONS & ACTIONS
   ================================================== */
.button-group { display: flex; gap: 12px; }
button {
  padding: 12px 20px;
  font-weight: 600;
  background: #6ca5ff;
  color: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: .3s;
}
button:hover {
  background: #c8c8ff;
}
button:disabled {
  background-color: #2f3640;
  color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}
button.abort-mode {
  background: 333333;
}
button.abort-mode:hover {
  background: 555555;
}


/* PROFILE OVERVIEW "CHAT NOW" Button – iOS CALL Green, darker base + pulse brightness */
.chat-now-btn.mini-btn {
  font-size: 1.2em;
  padding: 12px 80px;
  background: #2fa84e; /* dunkleres Grundgrün */
  margin-bottom: 12px;
  border-radius: 7px;
  display: block;
  font-weight: 400;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 6px rgba(47,168,78,0.3);
  color: #ffffff;
  border: 1px solid #1c6d32;
  opacity: 0.95;
  animation: pulseChatNow 1.8s ease-in-out infinite;
  transition:
    background 0.35s cubic-bezier(.45,.05,.55,.95),
    color 0.35s cubic-bezier(.55,.2,.4,1),
    box-shadow 0.35s cubic-bezier(.55,.2,.4,1),
    opacity 0.35s cubic-bezier(.55,.2,.4,1);
}

@keyframes pulseChatNow {
  0% {
    transform: scale(1);
    background: #2fa84e;
    box-shadow: 0 0 0 rgba(47,168,78,0.0);
  }
  50% {
    transform: scale(1.04);
    background: #37c75b; /* leicht heller in der Mitte */
    box-shadow: 0 0 18px rgba(47,168,78,0.45);
  }
  100% {
    transform: scale(1);
    background: #2fa84e;
    box-shadow: 0 0 0 rgba(47,168,78,0.0);
  }
}

.chat-now-btn.mini-btn:disabled {
  background: #2a3440;
  color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
  animation: none;
  box-shadow: none;
}

.chat-now-btn.mini-btn:not(:disabled):hover,
.chat-now-btn.mini-btn:not(:disabled):focus {
  background: #45d86c; /* helleres iOS Green beim Hover */
  color: #fff;
  opacity: 1;
  animation: none; /* Puls stoppen beim Hover */
  box-shadow: 0 4px 18px rgba(52,199,89,0.35);
}





/* ==================================================
   📦 2. LAYOUT & WRAPPERS (Main, Content, Form-Container)
   ================================================== */
.main-wrapper {
  margin-left: var(--sidebar-width);
  padding: 50px 0;
}
.content-wrapper {
  width: 100%;
  max-width: var(--max-content-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-left: 1.2rem; 
  padding-right: 1.2rem;
}

.form-box,
.form-container {
  background-color: #202021;
  border: 1px solid #7d7d7d;
  border-radius: 10px;
  /* Kompaktes Padding unten für weniger Luft unter Hints */
  padding: 1.5rem 2.0rem 0.2rem 2.0rem; /* top, right, bottom, left */
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  margin-top: 0;
}


/* ==================================================
   👤 2a. HEADLINE ROW (h2 + Buttons rechts)
   ================================================== */
.headline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5em;
}
.headline-row h2 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
}

/* Buttons (Autofill & Reset) */
.headline-row button + button {
  margin-left: 0.75em; /* Abstand zwischen Autofill und Reset */
}

.headline-row button {
  position: relative; /* nötig für Tooltip-Position */
  margin-left: auto;
}
.headline-row button:disabled {
  cursor: not-allowed;
}


/* Tooltip-Stil */
.headline-row .tooltip {
  position: absolute;
  top: 100%;          /* unterhalb des Buttons */
  right: 0;           /* rechtsbündig mit Button */
  transform: translateY(8px); /* Abstand nach unten */
  white-space: nowrap;
  background: #000;
  color: #e2e8f0;
  padding: 6px 10px;
  margin-top: 8px;
  border-radius: 6px;
  font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 100;
}

/* Tooltip beim Hover anzeigen */
.headline-row button:hover .tooltip {
  opacity: 1;
}


/* ==================================================
   🎛️ 4. FORM ELEMENTE
   ================================================== */
.inline-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2em;
  justify-content: space-between;
  margin: 0 auto;
}
.field-group {
  flex: 1 1 calc(25% - 1.2em);
  min-width: 200px;
}
@media (max-width: 960px) {
  .field-group { flex: 1 1 calc(50% - 1.2em); }
}
@media (max-width: 680px) {
  .field-group { flex: 1 1 100%; }
}
input[type="text"], select {
  width: 100%;
  padding: 12px 14px;
  background-color: #202021;
  border: 1px solid #7d7d7d;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 1em;
  transition: border-color 0.3s, box-shadow 0.3s;
}
input[type="text"]:focus, select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
  outline: none;
}
input::placeholder { color: #99a1b3; }
input[type="range"] { width: 100%; accent-color: #6ca5ff; }

.sliders-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2em;
  justify-content: space-between;
  margin-top: 2rem;
}
.trait-slider {
  flex: 1 1 calc(25% - 1.2em);
  min-width: 200px;
}
.trait-slider label { font-size: 1em; font-weight: 600; color: #cbd2e1; }



/* ==================================================
   ⚠️ 5. HINT/NOTICE/SUCCESS BOXES (unified, compact, mit mehr Abstand oben)
   ================================================== */
   
   
.hint-wrapper {
  min-height: 2.4em;     /* Reserviert den Platz für kompakte 1-Zeilen-Hints */
  margin-bottom: 0.3em;
  display: block;
}
   
   
.hint {
  position: relative;
  padding: 0.4rem 0.8rem 0.4rem 1.1rem;
  border-radius: 6px;
  font-size: 0.93rem;
  font-weight: 400;
  line-height: 1.2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  margin: 2.5rem 0 0.5rem 0;  /* ↑ mehr Abstand nach oben! */
  border: 1px solid transparent;
  display: block;
  transition: opacity 0.3s, border 0.3s;
}
.hint.visible {
  opacity: 1;
  pointer-events: auto;
}
.hint::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 5px;
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}
.hint--notice {
  background-color: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #bfdbfe;
}
.hint--notice::before {
  background-color: rgba(59, 130, 246, 0.9);
}
.hint--warning {
  background-color: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.4);
  color: #fecaca;
}
.hint--warning::before {
  background-color: rgba(220, 38, 38, 0.9);
}
.hint--success {
  background-color: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #bbf7d0;
}
.hint--success::before {
  background-color: rgba(34, 197, 94, 0.9);
}
.pulsing-text {
  animation: pulseNotice 1.5s infinite;
}
@keyframes pulseNotice {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}
.hint p {
  margin: 0;
  line-height: 1.2;
  padding: 0;
}



/* ==================================================
   🖼️ 6. CHARACTER PREVIEW
   ================================================== */
.character-preview {
  background-color: #202021;
  border: 1px solid #7d7d7d;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.character-preview .preview-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.preview-photo {
  cursor: pointer;
  width: 100%;
  max-width: 200px;
  opacity: 1;
  height: auto;
  object-fit: cover;
  display: block;
  border-radius: 8px;
  background-color: #333;
  flex-shrink: 0;
  filter: grayscale(100%);
  border: 2px solid #6ca5ff;
  box-shadow: 0 0 0px rgba(0, 0, 0, 0);
  transition: filter 0.4s, transform 0.3s, box-shadow 0.3s;
}
.preview-photo:hover {
  filter: grayscale(0%);
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.75);
}
canvas.preview-canvas {
  display: block;
  filter: grayscale(100%);
  border: 0;
  max-width: 200px;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 12px;
  background-color: #333;
  flex-shrink: 0;
  transition: filter 0.4s, transform 0.3s;
  image-rendering: pixelated;
  animation: reduce-blur 5s ease-out forwards;
  filter: blur(50px);
}
@keyframes reduce-blur {
  from { filter: blur(5px); }
  to { filter: blur(0px); }
}
.preview-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* Besseres Grid */
  gap: 1.5rem 2rem;
  align-items: start;
  margin-left: 3.5rem;
  flex: 1 1 0%;
  min-width: 0;
}

.preview-details p {
  margin: 0.25rem 0;
  line-height: 1.0;
}

.preview-details p { margin: 0.5rem 0; }
.preview-details .label { font-weight: 600; color: #98a7b8; margin-bottom: 0px; display: block; }
.preview-details .value { font-weight: 500; color: #e5f1f8; font-size: 1.2em; }
@media (max-width: 900px) {
  .preview-details { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-left: 0; }
}
@media (max-width: 680px) {
  .character-preview .preview-content { flex-direction: column; align-items: center; }
  .preview-details { grid-template-columns: 1fr; text-align: center; margin-left: 0; }
}


/* ==================================================
   🧭 7. SIDEBAR & SLOTS
   ================================================== */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: #202021;
  border-right: 1px solid #333;
  padding: 16px;
  overflow-y: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar-header { text-align: center; display: flex; flex-direction: column; align-items: center; }
.char-slot {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  margin-bottom: 22px;
}
.char-info { text-align: center; width: 85%; }
.char-preview {
  cursor: pointer;
  width: 50%;
  border-radius: 12px;
  border: 2px solid #6ca5ff;
  background-color: #333;
  filter: grayscale(100%);
  transition: filter 0.4s, transform 0.3s, box-shadow 0.3s;
}
.char-preview:hover {
  filter: grayscale(0%);
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.75);
}
.pulse-saturation {
  animation: saturatePulse 1s ease-in-out infinite, pulseOverlayOpacity 1.5s ease-in-out infinite;
  background-color: #444;
  mix-blend-mode: screen;
}
@keyframes saturatePulse {
  0% { filter: saturate(0.4); }
  50% { filter: saturate(1); }
  100% { filter: saturate(0.4); }
}
@keyframes pulseOverlayOpacity {
  0% { opacity: 0.5; }
  50% { opacity: 1.0; }
  100% { opacity: 0.5; }
}
.pulse-saturation:hover { mix-blend-mode: normal; }


/* ==================================================
   💬 8. RESPONSE-BOX & OUTPUT
   ================================================== */
#responseBox {
  background-color: #202021;
  line-height: 1.6;
  min-height: 260px;
  max-height: 260px;         
  overflow-y: auto; 
  margin-bottom: 18px;
  font-size: 1.01em; 
}
#output { display: none; }


/* ==================================================
   🛈 10. TOOLTIP (Autofill, etc. - immer links!)
   ================================================== */
.tooltip {
  visibility: hidden;
  opacity: 0;
  width: max-content;
  max-width: 320px;
  background: #222e3a;
  color: #c7e0ff;
  text-align: left;
  border-radius: 6px;
  padding: 7px 13px;
  position: absolute;
  z-index: 10;
  right: 100%;      /* Tooltip erscheint LINKS vom Button */
  left: auto;
  top: 50%;
  transform: translateY(-50%) translateX(-8px);  /* Abstand nach links */
  font-size: 0.7em;
  box-shadow: 0 3px 10px rgba(60,80,140,0.18);
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
  white-space: normal;
}
.headline-row {
  position: relative; /* Für Tooltip positioning */
}
#autofillBtn {
  position: relative;
}
#autofillBtn:hover .tooltip,
#autofillBtn:focus .tooltip {
  visibility: visible;
  opacity: 1;
}
@media (max-width: 700px) {
  .tooltip {
    top: 110%;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    min-width: 180px;
    max-width: 95vw;
    padding: 11px 13px;
    text-align: center;
  }
}







/* ==================================================
   📱 13. RESPONSIVE
   ================================================== */
@media (max-width: 600px) {
  #sidebar { display: none; }
  .main-wrapper { margin-left: 0; }
  .button-group { flex-direction: column; }
  button { width: 100%; }
}



/* ============================
   🌑 LIGHTBOX / PORTRAIT MODAL (quadratisch, bündig, immer mittig, 100% groß)
============================ */

.lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.74);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeInOverlay 0.6s ease forwards;
}
@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}
.lightbox.hidden {
  display: none;
}
.lightbox-inner {
  width: 92vw;
  height: 92vw;
  max-width: 85vh;
  max-height: 85vh;
  min-width: 340px;
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Kein flex-direction: column ! */
}

.portrait-box {
  /* Das ist das quadratische Overlay, das ALLES bündig hält */
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 34px;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  box-shadow: 0 0 70px 0 #000d;
  background: #111; /* Fallback falls Bild nicht lädt */
}

.portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 34px;
  box-shadow: 0 0 70px 0 #000d;
  pointer-events: none;
  user-select: none;
  animation: fadeZoomInPortrait 12s cubic-bezier(.28,.84,.42,1) forwards;
  
  transform: scale(1);
}

@keyframes fadeZoomInPortrait {
  from { transform: scale(1);}
  to   { transform: scale(1.1);}
}


/* ============================
   🔳 OVERLAY-BALKEN (unten, exakt bündig am Bild)
============================ */
.manager-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: 100%;
  padding: 36px 34px 30px 34px;
    background: linear-gradient(
    0deg,
    rgba(0,0,0,0.99) 0%,	
    rgba(0,0,0,0.0) 100%    
  );
  color: #fff;
  border-bottom-left-radius: 34px;
  border-bottom-right-radius: 34px;
  box-sizing: border-box;
  z-index: 2;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  min-height: 140px;
  max-width: 100%;
  overflow: hidden;
}

.overlay-texts {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.overlay-title-row {
  font-size: 4rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.05;
}

.overlay-profession {
  font-size: 2rem;
  font-weight: 400;
  opacity: 0.98;
  margin-top: 0.15em;    /* Kleiner Abstand zum Namen */
  margin-bottom: 0.85em; /* Größerer Abstand nach unten */
}

.overlay-meta {
  font-size: 1.01rem;
  opacity: 0.78;
  font-weight: 400;
  letter-spacing: 0.03em;
}


.overlay-meta .meta-icon svg {
  vertical-align: middle !important;
  display: inline;
}



/* Gemeinsamer Klickbereich für DELETE */
.meta-delete-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  color: #e57373; /* Standard-Rot wie vorher */
  font-weight: 700;
  cursor: pointer;
  transition: color 0.2s ease, filter 0.2s ease;
}

.meta-delete-wrapper:hover {
  color: #ff8a80; /* etwas helleres Rot beim Hover */
  filter: drop-shadow(0 0 3px rgba(255, 138, 128, 0.6)); /* leichter Glow */
}

.meta-delete-wrapper svg {
  stroke: currentColor; /* Icon übernimmt Textfarbe */
}



/* ============================
   📱 Responsive Portrait Lightbox
============================ */
@media (max-width: 800px) {
  .lightbox-inner {
    max-width: 98vw;
    max-height: 98vw;
    min-width: 0;
    min-height: 0;
    width: 98vw;
    height: 98vw;
  }
  .portrait-box {
    border-radius: 20px;
  }
  .manager-overlay {
    padding: 30px 30px 30px 30px;
    min-height: 100px;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
  }
  .overlay-title-row { font-size: 1.23rem; }
  .overlay-chat-btn { font-size: 0.97rem; height: 38px; padding: 0 16px; }
}



/* Pro-Logo */
.pro-logo {
  max-width: 140px;
  margin-bottom: 8px;
  margin-top: 20px;
  display: block;
  opacity: 0.75;
  transition: opacity 0.3s, transform 0.3s;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
.pro-logo:hover {
  opacity: 1;
  transform: scale(1.05);
}




/* Sidebar-Charakterbild mit Grayscale, Blue-Border, Hover-Effekt */
.chat-sidebar-photo.char-preview {
  width: 130px;          /* größer als Generator, aber gleiche Optik */
  height: 130px;
  border-radius: 14px;
  object-fit: cover;
  background: #101216;
  border: 2.5px solid #3b4251;
  filter: grayscale(100%);
  transition: filter 0.45s, border-color 0.3s, box-shadow 0.3s;
  cursor: pointer;
  box-shadow: 0 4px 18px 0 rgba(10,12,18,0.08);
}
.chat-sidebar-photo.char-preview:hover {
  filter: grayscale(0%);
  border-color: #6ca5ff;
  box-shadow: 0 8px 30px 0 rgba(59,130,246,0.17);
}


/* Sidebar: dezenter Blauton + sanftes Pulsieren */
#sidebar.sidebar-attention {
  background-color: #1f2937; /* Basis-Grau-Blau, sehr dezent */
  animation: sidebarGlowSoft 1.4s ease-in-out infinite,
             sidebarBgBluePulseSoft 3.2s ease-in-out infinite;
}

/* Außen-Glow sehr subtil */
@keyframes sidebarGlowSoft {
  0%   { box-shadow: 0 0 0 rgba(96,165,250,0.00); }
  50%  { box-shadow: 0 0 18px rgba(96,165,250,0.25); }
  100% { box-shadow: 0 0 0 rgba(96,165,250,0.00); }
}

/* Innerhalb dezenter Blautöne pulsieren */
@keyframes sidebarBgBluePulseSoft {
  0%, 100% {
    background-color: #1f2937; /* Dunkles Grau-Blau */
  }
  50% {
    background-color: #243045; /* Etwas helleres Grau-Blau */
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  #sidebar.sidebar-attention {
    animation: none;
  }
}

/* ================================
   💬 Generator: ResponseBox & Typing Indicator (clean)
   ================================ */

/* 1) Response-Container: normaler Block-Flow, Start oben links */
#responseBox {
  /* deine Höhe/Scrollbar definiert weiter oben – hier nur Layoutfeinheiten */
  padding: 0px 0px;
  text-align: left;
  overflow-y: auto; /* falls noch nicht gesetzt */
}

/* 2) Bubble-Resets nur innerhalb des Generators */
#responseBox .message {
  margin: 0;
}
#responseBox .message .msg-inner {
  display: block;
  padding: 0;
  line-height: 1.6;
  min-height: 1.6em; /* verhindert Jump beim Umschalten */
  font-size: 1rem;
}

/* 3) Typing Indicator – exakt wie im Chat, aber lokal auf #responseBox begrenzt */
#responseBox .typing {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  white-space: nowrap;
  color: #93c5fd;  /* helle Blautöne */
}
#responseBox .typing .who {
  font-style: italic;
  opacity: .9;
}
#responseBox .typing .dots {
  display: inline-flex;
  gap: .22em;
  transform: translateY(1px);
}
#responseBox .typing .dot {
  width: .38em;
  height: .38em;
  border-radius: 50%;
  background-color: #93c5fd;
  opacity: .6;
  animation: typingDot 1.2s infinite ease-in-out;
}
#responseBox .typing .dot:nth-child(2) { animation-delay: .15s; }
#responseBox .typing .dot:nth-child(3) { animation-delay: .30s; }

@keyframes typingDot {
  0%, 80%, 100% { transform: translateY(0);   opacity: .6; }
  40%           { transform: translateY(-2px); opacity: 1; }
}
