/* ============================================================
   Objektbesuch-Agent — Mobile-First CSS
   Zitzelsberger Gebäudereinigung GmbH
   ============================================================ */

:root {
  --blau-dunkel:  #00a7b7;
  --blau-mittel:  #2d6ea0;
  --blau-hell:    #e8f1f9;
  --gruen:        #2e7d32;
  --gruen-hell:   #e8f5e9;
  --rot:          #c62828;
  --grau-hell:    #f4f6f8;
  --grau-rand:    #dde3ea;
  --text:         #212121;
  --text-hell:    #666;
  --weiss:        #ffffff;
  --radius:       12px;
  --schatten:     0 2px 12px rgba(0,0,0,0.10);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  background: var(--grau-hell);
  color: var(--text);
  overflow: hidden;
}

/* ── Layout ──────────────────────────────────────────── */

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;        /* dynamic viewport height für Mobile */
  max-width: 700px;
  margin: 0 auto;
  background: var(--weiss);
  box-shadow: var(--schatten);
}

/* ── Header ──────────────────────────────────────────── */

.header {
  background: var(--blau-dunkel);
  color: var(--weiss);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-logo {
  font-size: 22px;
}

.header-logo-img {
  height: 22px;
  width: auto;
  display: block;
  opacity: 0.95;
}

.header-text h1 {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.header-text p {
  font-size: 11px;
  opacity: 0.75;
}

.header-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  opacity: 0.85;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf50;
  animation: puls 2s infinite;
}

.status-dot.offline {
  background: #ef5350;
  animation: none;
}

@keyframes puls {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Chat-Bereich ─────────────────────────────────────── */

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Nachrichten */

.nachricht {
  display: flex;
  max-width: 85%;
  animation: einblenden 0.25s ease;
}

@keyframes einblenden {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nachricht.assistent {
  align-self: flex-start;
}

.nachricht.nutzer {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.nachricht-bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
}

.assistent .nachricht-bubble {
  background: var(--blau-hell);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.nutzer .nachricht-bubble {
  background: var(--blau-mittel);
  color: var(--weiss);
  border-bottom-right-radius: 4px;
}

.nachricht-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 2px;
}

.assistent .nachricht-avatar {
  background: var(--blau-dunkel);
  margin-right: 8px;
}

.nutzer .nachricht-avatar {
  background: var(--blau-mittel);
  margin-left: 8px;
}

/* Tipp-Indikator */

.tipp-indikator {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 8px 14px;
  background: var(--blau-hell);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
}

.tipp-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blau-mittel);
  margin: 0 2px;
  animation: hüpfen 1.2s infinite;
}

.tipp-dots span:nth-child(2) { animation-delay: 0.2s; }
.tipp-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes hüpfen {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Abschluss-Banner */

.abschluss-banner {
  background: var(--gruen-hell);
  border: 1px solid var(--gruen);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
  color: var(--gruen);
  font-weight: 600;
  font-size: 15px;
}

/* ── Eingabebereich ───────────────────────────────────── */

.eingabe-container {
  padding: 12px 16px;
  background: var(--weiss);
  border-top: 1px solid var(--grau-rand);
  flex-shrink: 0;
}

.aufnahme-status {
  text-align: center;
  font-size: 12px;
  color: var(--text-hell);
  min-height: 18px;
  margin-bottom: 8px;
  transition: color 0.2s;
}

.aufnahme-status.aktiv {
  color: var(--rot);
  font-weight: 600;
}

.aufnahme-status.verarbeitung {
  color: var(--blau-mittel);
}

.eingabe-zeile {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.text-eingabe {
  flex: 1;
  border: 1.5px solid var(--grau-rand);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.text-eingabe:focus {
  border-color: var(--blau-mittel);
}

.text-eingabe::placeholder {
  color: #aaa;
}

.btn-rund {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  transition: transform 0.1s, background 0.2s;
  -webkit-appearance: none;
}

.btn-rund:active {
  transform: scale(0.92);
}

.btn-mikrofon {
  background: var(--blau-dunkel);
  color: var(--weiss);
}

.btn-mikrofon.aufnahme {
  background: var(--rot);
  animation: aufnahme-puls 1s infinite;
}

@keyframes aufnahme-puls {
  0%, 100% { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(198, 40, 40, 0); }
}

.btn-senden {
  background: var(--blau-mittel);
  color: var(--weiss);
}

.btn-senden:disabled {
  background: var(--grau-rand);
  cursor: not-allowed;
}

.btn-senden:not(:disabled):active {
  transform: scale(0.92);
}

/* ── Hinweis-Box ──────────────────────────────────────── */

.hinweis {
  font-size: 11px;
  color: var(--text-hell);
  text-align: center;
  margin-top: 6px;
  line-height: 1.4;
}

/* ── Scrollbar ────────────────────────────────────────── */

.chat-container::-webkit-scrollbar { width: 4px; }
.chat-container::-webkit-scrollbar-thumb { background: var(--grau-rand); border-radius: 2px; }

/* ── Login-Screen ────────────────────────────────────── */

.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  padding: 20px;
  background: linear-gradient(135deg, var(--blau-dunkel), var(--blau-mittel));
}

.login-card {
  background: var(--weiss);
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.login-logo {
  font-size: 48px;
  margin-bottom: 12px;
}

.login-logo-img {
  display: block;
  width: 220px;
  max-width: 60vw;
  height: auto;
  margin: 0 auto 24px auto;
}

.login-card h1 {
  font-size: 20px;
  color: var(--blau-dunkel);
  margin-bottom: 4px;
}

.login-firma {
  font-size: 13px;
  color: var(--text-hell);
  margin-bottom: 20px;
}

.login-hinweis {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 24px;
  line-height: 1.5;
}

.btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blau-dunkel);
  color: var(--weiss);
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
}

.btn-login:hover {
  background: var(--blau-mittel);
}

.login-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--grau-rand);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 10px;
  outline: none;
  transition: border-color 0.2s;
}

.login-input:focus {
  border-color: var(--blau-mittel);
}

.test-badge {
  display: inline-block;
  background: #fff3cd;
  color: #856404;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.login-datenschutz {
  font-size: 11px;
  color: var(--text-hell);
  margin-top: 16px;
}

/* ── App-Content (nach Login) ────────────────────────── */

.app-content {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* ── Responsive ───────────────────────────────────────── */

@media (min-width: 700px) {
  .app {
    margin: 20px auto;
    height: calc(100dvh - 40px);
    border-radius: var(--radius);
  }
}
