/* ==========================================================================
   MartinaChat – Busslehner Apartments
   Gastfreundliche Chat-Host für Busslehner Apartments.
   Alle Klassen mit "sc-" prefix, damit nichts mit der Hauptseite kollidiert.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&display=swap");

:root {
  --sc-bg: #faf6f0;
  --sc-surface: #ffffff;
  --sc-surface-soft: #f4efe5;
  --sc-text: #2a2520;
  --sc-text-soft: #5a4e44;
  --sc-muted: #8a7e72;
  --sc-border: #e8e1d4;
  --sc-border-strong: #d4c9b6;
  --sc-accent: #2d4a3e;
  --sc-accent-hover: #1f3429;
  --sc-accent-soft: #eaeee9;
  --sc-bubble-user: #2d4a3e;
  --sc-bubble-bot: #f4efe5;
  --sc-shadow-lg: 0 24px 60px -20px rgba(45, 60, 50, 0.28),
    0 8px 16px -8px rgba(45, 60, 50, 0.12);
  --sc-shadow-button: 0 10px 28px -8px rgba(45, 74, 62, 0.4),
    0 4px 10px -2px rgba(45, 74, 62, 0.25);
  --sc-radius: 14px;
  --sc-radius-sm: 8px;
  --sc-display: "Fraunces", Georgia, "Times New Roman", serif;
  --sc-body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* --- Floating Martina button ---------------------------------------------- */

.sc-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  background: var(--sc-surface) center/cover no-repeat;
  cursor: pointer;
  box-shadow: var(--sc-shadow-button);
  padding: 0;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s ease;
  font-family: var(--sc-body);
  /* gentle "I'm waving" animation */
  animation: sc-greet 6s ease-in-out 2s infinite;
}

.sc-toggle::after {
  /* small label that appears on first load */
  content: "Hallo, ich bin Martina";
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  background: var(--sc-text);
  color: var(--sc-bg);
  font-family: var(--sc-display);
  font-size: 14px;
  font-weight: 500;
  font-variation-settings: "opsz" 24;
  letter-spacing: -0.005em;
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: 100px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.3);
}

.sc-toggle::before {
  /* little arrow on the bubble */
  content: "";
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: var(--sc-text);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sc-toggle:hover::after,
.sc-toggle:hover::before,
.sc-toggle.sc-show-tip::after,
.sc-toggle.sc-show-tip::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.sc-toggle:hover {
  transform: translateY(-3px) scale(1.04);
  animation: none;
}

.sc-toggle:active {
  transform: translateY(0) scale(0.98);
}

.sc-toggle[aria-expanded="true"] {
  animation: none;
}

.sc-toggle[aria-expanded="true"]::after,
.sc-toggle[aria-expanded="true"]::before {
  display: none;
}

@keyframes sc-greet {
  0%, 92%, 100% { transform: rotate(0deg); }
  94% { transform: rotate(-6deg); }
  96% { transform: rotate(6deg); }
  98% { transform: rotate(-3deg); }
}

/* --- Panel ---------------------------------------------------------------- */

.sc-panel {
  position: fixed;
  bottom: 116px;
  right: 24px;
  z-index: 9999;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 620px;
  max-height: calc(100vh - 145px);
  background: var(--sc-bg);
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius);
  box-shadow: var(--sc-shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--sc-body);
  color: var(--sc-text);
  font-size: 15px;
  line-height: 1.5;
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.sc-panel[data-open="true"] {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 540px) {
  .sc-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }
  .sc-toggle { bottom: 16px; right: 16px; }
}

/* --- Header --------------------------------------------------------------- */

.sc-header {
  padding: 14px 16px 14px 14px;
  border-bottom: 1px solid var(--sc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--sc-surface);
}

.sc-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sc-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: center/cover no-repeat;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
  position: relative;
}

.sc-avatar::after {
  /* online dot */
  content: "";
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #5d8a5e;
  border: 2px solid var(--sc-surface);
}

.sc-eyebrow {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sc-muted);
  font-weight: 500;
  display: block;
  margin-bottom: 1px;
  line-height: 1;
}

.sc-title {
  font-family: var(--sc-display);
  font-size: 18px;
  font-weight: 500;
  font-variation-settings: "opsz" 24, "SOFT" 50;
  letter-spacing: -0.005em;
  color: var(--sc-text);
  margin: 0;
  line-height: 1.15;
}

.sc-close {
  background: transparent;
  border: 1px solid var(--sc-border);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--sc-text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.sc-close:hover {
  background: var(--sc-surface-soft);
  color: var(--sc-text);
}

/* --- Messages list -------------------------------------------------------- */

.sc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.sc-messages::-webkit-scrollbar { width: 6px; }
.sc-messages::-webkit-scrollbar-track { background: transparent; }
.sc-messages::-webkit-scrollbar-thumb {
  background: var(--sc-border-strong);
  border-radius: 3px;
}

.sc-msg {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: var(--sc-radius-sm);
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: sc-fade-in 0.3s ease;
}

.sc-msg-user {
  align-self: flex-end;
  background: var(--sc-bubble-user);
  color: #f5efe2;
  border-bottom-right-radius: 3px;
}

.sc-msg-bot {
  align-self: flex-start;
  background: var(--sc-bubble-bot);
  color: var(--sc-text);
  border-bottom-left-radius: 3px;
}

.sc-msg-bot a {
  color: var(--sc-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sc-msg-bot strong { font-weight: 600; }

/* Welcome message: special look with Fraunces italic */
.sc-msg-welcome {
  background: transparent;
  padding: 4px 6px 6px;
  max-width: 100%;
  color: var(--sc-text-soft);
  font-family: var(--sc-display);
  font-size: 17px;
  font-style: italic;
  font-variation-settings: "opsz" 24, "SOFT" 100;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

.sc-msg-welcome strong {
  color: var(--sc-accent);
  font-weight: 500;
}

/* Typing indicator */
.sc-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 2px 0;
}
.sc-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sc-muted);
  opacity: 0.4;
  animation: sc-pulse 1.4s infinite ease-in-out;
}
.sc-typing span:nth-child(2) { animation-delay: 0.2s; }
.sc-typing span:nth-child(3) { animation-delay: 0.4s; }

/* --- Suggestions chips ---------------------------------------------------- */

.sc-suggestions {
  padding: 0 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sc-chip {
  background: var(--sc-surface);
  border: 1px solid var(--sc-border-strong);
  color: var(--sc-text-soft);
  padding: 7px 12px;
  border-radius: 100px;
  font-size: 13px;
  font-family: var(--sc-body);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  line-height: 1.2;
}

.sc-chip:hover {
  background: var(--sc-accent-soft);
  border-color: var(--sc-accent);
  color: var(--sc-accent);
}

.sc-chip:active { transform: scale(0.97); }

.sc-suggestions[hidden] { display: none; }

/* --- Input form ----------------------------------------------------------- */

.sc-input {
  border-top: 1px solid var(--sc-border);
  padding: 12px 12px 10px;
  background: var(--sc-surface);
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.sc-textarea {
  flex: 1;
  border: 1px solid var(--sc-border-strong);
  background: var(--sc-bg);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: var(--sc-body);
  color: var(--sc-text);
  resize: none;
  max-height: 120px;
  min-height: 40px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s;
}

.sc-textarea::placeholder { color: var(--sc-muted); }

.sc-textarea:focus {
  border-color: var(--sc-accent);
}

.sc-send {
  background: var(--sc-accent);
  color: var(--sc-bg);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.sc-send:hover:not(:disabled) { background: var(--sc-accent-hover); }
.sc-send:active:not(:disabled) { transform: scale(0.96); }
.sc-send:disabled { opacity: 0.4; cursor: not-allowed; }

.sc-send svg { width: 18px; height: 18px; }

/* --- Disclaimer footer ---------------------------------------------------- */

.sc-footer {
  padding: 7px 16px 10px;
  background: var(--sc-surface);
  border-top: 1px solid var(--sc-border);
  font-size: 11px;
  color: var(--sc-muted);
  text-align: center;
  letter-spacing: 0.02em;
}

.sc-footer a {
  color: var(--sc-text-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--sc-border-strong);
  transition: color 0.15s, border-color 0.15s;
}

.sc-footer a:hover {
  color: var(--sc-accent);
  border-color: var(--sc-accent);
}

/* --- Animations ----------------------------------------------------------- */

@keyframes sc-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes sc-pulse {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.85); }
  30% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .sc-panel,
  .sc-toggle,
  .sc-send,
  .sc-msg,
  .sc-typing span {
    transition: none;
    animation: none;
  }
}
