/* style.css — Hätti auf ichdochnicht.de/haetti
   Layered on top of shared.css (Soft & Warm design system) */

/* Chat shell */
.chat-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 120px);
  min-height: calc(100dvh - 120px);
}

.chat-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem 0.25rem;
}

/* Message bubbles */
.bubble {
  max-width: 85%;
  padding: 0.85rem 1.1rem;
  border-radius: 18px;
  line-height: 1.55;
  animation: fadeUp 0.35s ease both;
  font-size: 1rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.bubble-haetti {
  align-self: flex-start;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  border-top-left-radius: 6px;
}

.bubble-user {
  align-self: flex-end;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-top-right-radius: 6px;
}

.bubble-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 0.3rem;
  padding: 1rem 1.1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  border-top-left-radius: 6px;
}

.bubble-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: typing-pulse 1.2s infinite ease-in-out;
}

.bubble-typing span:nth-child(2) { animation-delay: 0.15s; }
.bubble-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-pulse {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* Einstiegsfragen-Chips */
.chip-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.25rem 0.25rem 0.5rem;
  animation: fadeUp 0.35s ease both;
}

.chip {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: 100px;
  padding: 0.55rem 1.1rem;
  font-family: 'Nunito', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.15s;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

/* Crisis banner */
.crisis-banner {
  font-size: 0.78rem;
  color: var(--text-soft);
  text-align: center;
  padding: 0.5rem 0.75rem;
  margin: 0.5rem 0;
  border-top: 1px dashed var(--card-border);
  border-bottom: 1px dashed var(--card-border);
}

.crisis-banner strong {
  color: var(--accent-dark);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Composer */
.composer {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  padding: 0.75rem 0;
}

.composer-input {
  flex: 1;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  border-radius: 24px;
  padding: 0.8rem 1.1rem;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  color: var(--text);
  resize: none;
  max-height: 180px;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.composer-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.composer-send {
  border: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.composer-send:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.composer-send:disabled {
  background: var(--text-soft);
  cursor: not-allowed;
  opacity: 0.4;
}

.composer-send svg {
  width: 20px;
  height: 20px;
  transform: translateX(-1px);
}

.chat-footer {
  text-align: center;
  padding: 0.5rem 0;
}

.save-row {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.35rem 0 0.5rem;
}

.btn-save {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--card-border);
  border-radius: 100px;
  padding: 0.45rem 1.1rem;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-save:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.btn-save:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0 0.25rem;
}

/* Aktion unter der Zusammenfassungs-Bubble */
.summary-actions {
  align-self: flex-start;
  padding: 0 0.25rem;
  margin-top: -0.25rem;
  animation: fadeUp 0.35s ease both;
}

.link-button {
  background: none;
  border: none;
  color: var(--text-soft);
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: color 0.2s, text-decoration-color 0.2s;
  padding: 0.4rem 0.8rem;
}

.link-button:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(45, 42, 38, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  animation: fadeIn 0.25s ease both;
}

.modal-backdrop.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--card-bg);
  border-radius: 20px;
  max-width: 520px;
  width: 100%;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  position: relative;
  animation: fadeUp 0.35s ease both;
}

.modal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 2rem;
  right: 2rem;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  border-radius: 2px;
}

.modal-title {
  font-family: 'Lora', serif;
  font-weight: 700;
  font-size: 1.6rem;
  margin: 0.5rem 0 1rem;
  color: var(--text);
}

.modal-title em {
  color: var(--accent-dark);
}

.modal-body {
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 1.5rem;
}

.modal-body p {
  margin-bottom: 0.9rem;
}

.modal-body .lead {
  font-size: 1.1rem;
  font-family: 'Lora', serif;
  font-style: italic;
  color: var(--text);
}

.modal-body .muted {
  font-size: 0.9rem;
  color: var(--text-soft);
  padding: 0.75rem 1rem;
  background: var(--bg-warm);
  border-radius: 10px;
}

.modal-body ul {
  padding-left: 1.3rem;
  margin-bottom: 1rem;
}

.modal-body li {
  margin-bottom: 0.4rem;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.6rem 0;
  cursor: pointer;
  font-size: 0.95rem;
}

.checkbox-row input[type="checkbox"] {
  margin-top: 0.25rem;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  align-items: center;
}

.modal-actions.stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.75rem 1.8rem;
  border-radius: 100px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: var(--text-soft);
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

/* Print (PDF-Sicherung über den Druckdialog) */
.print-header {
  display: none;
}

@media print {
  @page {
    margin: 1.8cm;
  }

  .site-header,
  .crisis-banner,
  .composer,
  .chat-footer,
  .modal-backdrop,
  .bubble-typing,
  .chip-row,
  .summary-actions {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .chat-shell {
    display: block;
    min-height: 0;
    max-width: 100%;
    padding: 0;
  }

  .print-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding-bottom: 0.6rem;
    margin-bottom: 1.2rem;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.85rem;
    color: var(--text-soft);
  }

  .print-brand {
    font-family: 'Lora', serif;
    font-weight: 600;
    color: var(--text);
  }

  .chat-thread {
    display: block;
    padding: 0;
  }

  .bubble {
    display: block;
    max-width: 100%;
    margin: 0 0 1rem;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: none !important;
    color: var(--text);
    animation: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .bubble::before {
    display: block;
    font-family: 'Nunito', sans-serif;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-soft);
    margin-bottom: 0.15rem;
  }

  .bubble-haetti::before { content: "Hätti"; }
  .bubble-user::before { content: "Du"; }

  /* Nur-Zusammenfassung-Modus */
  body.print-summary .bubble { display: none !important; }
  body.print-summary .bubble-summary { display: block !important; }
  body.print-summary .bubble-summary::before { content: "Dein Austausch mit Hätti — was dabei rauskam"; }
}

/* Mobile */
@media (max-width: 600px) {
  .chat-shell {
    padding: 0.5rem 0.75rem 1.5rem;
  }
  .bubble {
    max-width: 92%;
    font-size: 0.98rem;
  }
  .chip {
    font-size: 0.88rem;
  }
  .modal-card {
    padding: 1.5rem;
  }
  .modal-title {
    font-size: 1.35rem;
  }
}
