/* ==========================================================================
   TERMIN-AGENT CHAT WIDGET - HIGH-END UI/UX DESIGN SYSTEM
   Tailwind-inspired, Glassmorphism, Micro-Interactions & Mobile-First
   ========================================================================== */

:root {
  --ta-primary: #2563eb;
  --ta-primary-hover: #1d4ed8;
  --ta-primary-light: #eff6ff;
  --ta-accent: #06b6d4;
  --ta-accent-gradient: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  --ta-bg-surface: rgba(255, 255, 255, 0.92);
  --ta-bg-glass: rgba(255, 255, 255, 0.78);
  --ta-border-glass: rgba(255, 255, 255, 0.4);
  --ta-text-main: #0f172a;
  --ta-text-muted: #64748b;
  --ta-text-light: #94a3b8;
  --ta-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --ta-shadow-lg: 0 20px 35px -10px rgba(15, 23, 42, 0.2), 0 1px 3px rgba(0, 0, 0, 0.05);
  --ta-shadow-glow: 0 10px 25px -5px rgba(37, 99, 235, 0.4);
  --ta-danger: #ef4444;
  --ta-danger-bg: #fef2f2;
  --ta-radius-xl: 20px;
  --ta-radius-lg: 14px;
  --ta-radius-md: 10px;
  --ta-radius-full: 9999px;
  --ta-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ta-z-index: 999999;
}

/* Dark Mode Variables Support */
@media (prefers-color-scheme: dark) {
  :root {
    --ta-bg-surface: rgba(15, 23, 42, 0.94);
    --ta-bg-glass: rgba(30, 41, 59, 0.82);
    --ta-border-glass: rgba(255, 255, 255, 0.12);
    --ta-text-main: #f8fafc;
    --ta-text-muted: #94a3b8;
    --ta-text-light: #cbd5e1;
    --ta-shadow-lg: 0 25px 45px -10px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
  }
}

/* Floating Action Button (FAB) */
#termin-agent-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--ta-z-index);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease, visibility 0.25s ease;
  font-family: var(--ta-font);
}

#termin-agent-fab:hover {
  transform: scale(1.06);
}

.ta-fab-button {
  width: 62px;
  height: 62px;
  min-width: 62px;
  min-height: 62px;
  max-width: 62px;
  max-height: 62px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  box-sizing: border-box;
  border-radius: var(--ta-radius-full);
  background: var(--ta-accent-gradient);
  background-clip: padding-box;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 8px 24px -4px rgba(0, 0, 0, 0.35), var(--ta-shadow-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  border: 2.5px solid #ffffff;
  position: relative;
  transition: all 0.3s ease;
}

.ta-fab-button svg {
  width: 30px;
  height: 30px;
  transition: transform 0.3s ease;
}

.ta-fab-badge-pulse {
  position: absolute;
  top: 0;
  right: 0;
  width: 16px;
  height: 16px;
  background-color: #10b981;
  border: 2px solid #ffffff;
  border-radius: var(--ta-radius-full);
}

.ta-fab-badge-pulse::after {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: var(--ta-radius-full);
  border: 2px solid #10b981;
  animation: ta-pulse 2s infinite ease-out;
}

@keyframes ta-pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  70% {
    transform: scale(2.2);
    opacity: 0;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.ta-fab-tooltip {
  background: var(--ta-bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--ta-text-main);
  padding: 8px 16px;
  border-radius: var(--ta-radius-full);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--ta-shadow-sm);
  border: 1px solid var(--ta-border-glass);
  white-space: nowrap;
  animation: ta-fade-in 0.4s ease;
}

/* Tooltip, Pulse & FAB ausblenden wenn Chat geöffnet ist (verhindert Überlagerung & Platzverlust) */
#termin-agent-root.ta-chat-active #termin-agent-fab {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  display: none !important;
  transform: scale(0.6) !important;
}

#termin-agent-root.ta-chat-active .ta-fab-tooltip,
#termin-agent-root.ta-chat-active .ta-fab-badge-pulse {
  display: none !important;
}

/* Chat Container */
#termin-agent-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 410px;
  max-width: calc(100vw - 32px);
  height: 680px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  z-index: var(--ta-z-index);
  display: flex;
  flex-direction: column;
  background: var(--ta-bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--ta-border-glass);
  border-radius: var(--ta-radius-xl);
  box-shadow: var(--ta-shadow-lg);
  font-family: var(--ta-font);
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#termin-agent-window.ta-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Chat Header */
.ta-header {
  padding: 14px 18px;
  background: var(--ta-bg-glass);
  border-bottom: 1px solid var(--ta-border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.ta-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  max-width: 42px;
  max-height: 42px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ta-accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  font-size: 18px;
  position: relative;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
  transition: all 0.25s ease;
  box-sizing: border-box;
}

.ta-avatar.ta-has-logo {
  background: #ffffff;
  padding: 4px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
}

.ta-avatar-img {
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 50%;
  display: block;
}

.ta-status-dot {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 11px;
  height: 11px;
  min-width: 11px;
  min-height: 11px;
  background-color: #10b981;
  border: 2px solid #fff;
  border-radius: 50%;
  box-sizing: border-box;
  flex-shrink: 0;
  z-index: 2;
}

.ta-header-text {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.ta-header-text h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ta-text-main);
  line-height: 1.25;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ta-header-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #10b981;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ta-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ta-icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--ta-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ta-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ta-text-main);
}

/* Notfall-Banner */
.ta-emergency-banner {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  padding: 12px 16px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: ta-slide-down 0.3s ease;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.ta-emergency-banner.ta-active {
  display: flex;
}

.ta-emergency-text {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
}

.ta-emergency-btn {
  background: #ffffff;
  color: #dc2626;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--ta-radius-full);
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  transition: transform 0.2s ease;
}

.ta-emergency-btn:hover {
  transform: scale(1.05);
}

/* Chat Messages Container */
.ta-messages-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  scroll-padding-top: 14px;
}

.ta-messages-body::-webkit-scrollbar {
  width: 6px;
}

.ta-messages-body::-webkit-scrollbar-thumb {
  background-color: rgba(100, 116, 139, 0.2);
  border-radius: var(--ta-radius-full);
}

/* Message Bubbles */
.ta-message {
  display: flex;
  gap: 10px;
  max-width: 86%;
  animation: ta-msg-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ta-message.ta-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ta-message.ta-bot {
  align-self: flex-start;
}

.ta-msg-content {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ta-message.ta-bot .ta-msg-content {
  background: var(--ta-bg-glass);
  color: var(--ta-text-main);
  border: 1px solid var(--ta-border-glass);
  border-top-left-radius: 4px;
}

.ta-message.ta-user .ta-msg-content {
  background: var(--ta-accent-gradient);
  color: #ffffff;
  border-top-right-radius: 4px;
}

.ta-msg-time {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
  margin-top: 4px;
  text-align: right;
  line-height: 1.2;
}

.ta-message.ta-user .ta-msg-time {
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.ta-message.ta-bot .ta-msg-time {
  color: #64748b;
}

@media (prefers-color-scheme: dark) {
  .ta-message.ta-bot .ta-msg-time {
    color: #cbd5e1;
  }
}

/* Interaktive Slot-Karten (Legacy) */
.ta-slots-container {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==========================================================================
   CAL.COM STYLE INTERACTIVE MONTH & TIME PICKER
   ========================================================================== */

#termin-agent-window.ta-has-calendar {
  width: 490px;
  max-width: calc(100vw - 20px);
}

.ta-message.ta-has-calendar-msg {
  max-width: 100% !important;
  width: 100%;
}

.ta-calendar-picker {
  background: #090e1a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 8px 10px;
  margin-top: 6px;
  color: #f8fafc;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.ta-cal-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ta-cal-service-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}

.ta-cal-duration-chip {
  background: rgba(37, 99, 235, 0.2);
  border: 1px solid rgba(37, 99, 235, 0.4);
  color: #60a5fa;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 9999px;
}

/* Zwei-Spalten-Layout wie bei Cal.com */
.ta-cal-body {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 10px;
}

@media (max-width: 520px) {
  .ta-cal-body {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* Links: Monatskalender */
.ta-cal-month-col {
  display: flex;
  flex-direction: column;
}

.ta-cal-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ta-cal-month-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.ta-cal-nav-buttons {
  display: flex;
  gap: 4px;
}

.ta-cal-nav-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.ta-cal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Wochentage-Kopfzeile */
.ta-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 3px;
}

.ta-cal-weekday {
  font-size: 9.5px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  padding: 2px 0;
}

/* Tage-Grid */
.ta-cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.ta-cal-day-cell {
  height: 24px;
  max-width: 28px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  color: #475569;
  user-select: none;
  position: relative;
  transition: all 0.15s ease;
}

.ta-cal-day-cell.ta-empty {
  visibility: hidden;
}

.ta-cal-day-cell.ta-has-slots {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.ta-cal-day-cell.ta-has-slots:hover {
  background: #334155;
  border-color: rgba(59, 130, 246, 0.5);
  transform: scale(1.05);
}

.ta-cal-day-cell.ta-selected {
  background: #ffffff !important;
  color: #0f172a !important;
  font-weight: 800;
  border-color: #ffffff !important;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

.ta-cal-day-cell.ta-is-today::after {
  content: "";
  position: absolute;
  bottom: 2px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background-color: #38bdf8;
}

.ta-cal-day-cell.ta-selected.ta-is-today::after {
  background-color: #0f172a;
}

/* Rechts: Zeitspalte */
.ta-cal-times-col {
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding-left: 10px;
}

@media (max-width: 520px) {
  .ta-cal-times-col {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-left: 0;
    padding-top: 8px;
  }
}

.ta-cal-times-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.ta-cal-times-day-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #ffffff;
}

.ta-cal-times-badge {
  font-size: 9.5px;
  color: #94a3b8;
}

.ta-cal-times-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 165px;
  overflow-y: auto;
  padding-right: 2px;
}

@media (max-width: 520px) {
  .ta-cal-times-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    max-height: none;
  }
}

.ta-cal-times-list::-webkit-scrollbar {
  width: 3px;
}
.ta-cal-times-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.ta-cal-time-btn {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  user-select: none;
}

.ta-cal-time-btn:hover {
  background: var(--ta-primary);
  border-color: #3b82f6;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.3);
}

.ta-cal-time-btn:active {
  transform: scale(0.98);
}

/* Deaktivierter & ausgegrauter Kalender nach Terminbuchung */
.ta-calendar-picker.ta-disabled {
  opacity: 0.55;
  filter: grayscale(0.25);
  pointer-events: none !important;
  user-select: none;
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: none;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.ta-calendar-picker.ta-disabled .ta-cal-nav-btn,
.ta-calendar-picker.ta-disabled .ta-cal-day-cell,
.ta-calendar-picker.ta-disabled .ta-cal-time-btn {
  cursor: not-allowed !important;
  pointer-events: none !important;
}

.ta-calendar-picker.ta-disabled .ta-cal-day-cell:hover,
.ta-calendar-picker.ta-disabled .ta-cal-time-btn:hover {
  transform: none !important;
  box-shadow: none !important;
}

.ta-calendar-picker.ta-disabled .ta-cal-time-btn.ta-chosen-slot {
  opacity: 1 !important;
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: #10b981 !important;
  color: #34d399 !important;
  font-weight: 700 !important;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3) !important;
}

.ta-cal-booked-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ta-cal-absence-alert {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ta-slots-title {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--ta-primary);
  margin-bottom: 2px;
}

.ta-slot-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid rgba(37, 99, 235, 0.2);
  border-radius: var(--ta-radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
}

@media (prefers-color-scheme: dark) {
  .ta-slot-card {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(37, 99, 235, 0.35);
  }
}

.ta-slot-card:hover {
  border-color: var(--ta-primary);
  background: var(--ta-primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.ta-slot-date {
  font-size: 13px;
  font-weight: 700;
  color: var(--ta-text-main);
}

.ta-slot-time {
  font-size: 12px;
  color: var(--ta-text-muted);
}

.ta-slot-btn {
  background: var(--ta-primary);
  color: #ffffff;
  border: none;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  pointer-events: none;
}

/* Buchungsbestätigungs-Karte */
.ta-booking-card {
  background: rgba(16, 185, 129, 0.1);
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--ta-radius-md);
  padding: 12px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ta-booking-badge {
  color: #059669;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Kalender-Sync Buttons */
.ta-cal-sync-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(16, 185, 129, 0.25);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ta-cal-sync-title {
  font-size: 11px;
  font-weight: 600;
  color: #059669;
}

.ta-cal-sync-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ta-cal-sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  line-height: 1;
}

.ta-cal-google {
  background: #2563eb;
  color: #ffffff !important;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.2);
}

.ta-cal-google:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.ta-cal-ics {
  background: var(--ta-bg-surface);
  color: var(--ta-text-main) !important;
  border: 1px solid var(--ta-border-glass);
}

.ta-cal-ics:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #059669;
  transform: translateY(-1px);
}

/* Voice Input Button */
.ta-voice-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--ta-radius-full);
  background: transparent;
  border: 1px solid var(--ta-border-glass);
  color: var(--ta-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ta-voice-btn:hover {
  color: var(--ta-primary);
  border-color: var(--ta-primary);
  background: rgba(37, 99, 235, 0.08);
}

.ta-voice-btn.ta-recording {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
  animation: ta-pulse-red 1.2s infinite ease-in-out;
}

@keyframes ta-pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.ta-cancellation-card {
  background: rgba(239, 68, 68, 0.1);
  border: 1.5px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--ta-radius-md);
  padding: 12px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ta-cancellation-badge {
  color: #ef4444;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ta-cancellation-email-note {
  font-size: 11.5px;
  color: #10b981;
  display: flex;
  align-items: center;
  margin-top: 4px;
  font-weight: 500;
}

.ta-rebook-btn {
  margin-top: 8px;
  background: var(--ta-primary, #2563eb);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s ease;
  width: 100%;
}

.ta-rebook-btn:hover {
  opacity: 0.9;
}

/* Quick Replies Chips */
.ta-quick-replies {
  padding: 8px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  background: var(--ta-bg-glass);
  border-top: 1px solid var(--ta-border-glass);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  max-height: 105px;
  overflow-y: auto;
  overflow-x: hidden;
}

.ta-quick-replies::-webkit-scrollbar {
  width: 4px;
}

.ta-quick-replies::-webkit-scrollbar-track {
  background: transparent;
}

.ta-quick-replies::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.ta-chip-btn {
  background: var(--ta-bg-surface);
  border: 1px solid var(--ta-border-glass);
  color: var(--ta-text-main);
  padding: 5px 12px;
  border-radius: var(--ta-radius-full);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
  max-width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
  box-sizing: border-box;
  flex: 0 1 auto;
}

.ta-chip-btn:hover {
  background: var(--ta-primary);
  color: #ffffff;
  border-color: var(--ta-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.ta-chip-btn:active {
  transform: translateY(0);
}

/* Typing Indicator */
.ta-typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--ta-bg-glass);
  border: 1px solid var(--ta-border-glass);
  border-radius: 18px;
  border-top-left-radius: 4px;
  width: fit-content;
}

.ta-typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--ta-text-muted);
  border-radius: 50%;
  animation: ta-bounce 1.4s infinite ease-in-out;
}

.ta-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.ta-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes ta-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-6px);
  }
}

/* Footer / Input Area */
.ta-footer {
  padding: 12px 16px;
  background: var(--ta-bg-glass);
  border-top: 1px solid var(--ta-border-glass);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Foto Upload Vorschau */
.ta-photo-preview-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 8px;
}

.ta-photo-preview-bar.ta-visible {
  display: flex;
}

.ta-photo-thumbnail {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--ta-primary);
}

.ta-photo-info {
  flex: 1;
  font-size: 11px;
  color: var(--ta-text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ta-photo-remove-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ta-danger);
  font-size: 14px;
  font-weight: bold;
}

.ta-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ta-input-field {
  flex: 1;
  background: var(--ta-bg-surface);
  border: 1px solid var(--ta-border-glass);
  color: var(--ta-text-main);
  border-radius: var(--ta-radius-full);
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.ta-input-field:focus {
  border-color: var(--ta-primary);
}

.ta-upload-label {
  cursor: pointer;
  padding: 8px;
  color: var(--ta-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.ta-upload-label:hover {
  color: var(--ta-primary);
}

.ta-send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--ta-radius-full);
  background: var(--ta-accent-gradient);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
  transition: transform 0.2s ease;
}

.ta-send-btn:hover {
  transform: scale(1.06);
}

.ta-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Animations */
@keyframes ta-msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ta-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes ta-slide-down {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

/* Positionierung Links */
#termin-agent-root.ta-pos-left #termin-agent-fab {
  left: 24px;
  right: auto;
}

#termin-agent-root.ta-pos-left #termin-agent-window {
  left: 24px;
  right: auto;
}

/* White-Label / Powered By Badge */
.ta-powered-by {
  text-align: center;
  padding: 6px 12px 10px;
  font-size: 11px;
  color: var(--ta-text-light);
  background: transparent;
  user-select: none;
}

.ta-powered-by a {
  color: var(--ta-text-muted);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.2px;
  transition: color 0.2s ease;
}

.ta-powered-by a:hover {
  color: var(--ta-primary);
  text-decoration: underline;
}

.ta-legal-sep {
  margin: 0 5px;
  color: var(--ta-text-muted);
  opacity: 0.5;
}

/* Responsive Breakpoints & Mobile Optimization */
@media (min-width: 681px) and (max-width: 768px) {
  #termin-agent-window {
    bottom: 16px;
    right: 16px;
    left: auto;
    top: auto;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 640px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
  }

  #termin-agent-root.ta-pos-left #termin-agent-window {
    left: 16px;
    right: auto;
  }

  #termin-agent-fab {
    bottom: 16px;
    right: 16px;
  }

  #termin-agent-root.ta-pos-left #termin-agent-fab {
    left: 16px;
    right: auto;
  }
}

@media (max-width: 680px) {
  /* Tooltip auf Mobilgeräten ausblenden, damit kein Platz auf der Seite blockiert wird */
  .ta-fab-tooltip {
    display: none !important;
  }

  #termin-agent-fab {
    bottom: 16px !important;
    right: 16px !important;
  }

  #termin-agent-root.ta-pos-left #termin-agent-fab {
    left: 16px !important;
    right: auto !important;
  }

  .ta-fab-button {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    max-width: 56px !important;
    max-height: 56px !important;
  }

  .ta-fab-button svg {
    width: 26px !important;
    height: 26px !important;
  }

  /* Sobald Chat geöffnet ist: FAB ausnahmslos ausblenden */
  #termin-agent-root.ta-chat-active #termin-agent-fab {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* Chat-Fenster wird zur nativen Vollbild-Erfahrung ohne Ränder */
  #termin-agent-window {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    width: 100vw !important;
    min-width: 100% !important;
    min-width: 100vw !important;
    max-width: 100% !important;
    max-width: 100vw !important;
    height: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100% !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    max-height: 100% !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: var(--ta-z-index) !important;
    overflow: hidden !important;
  }

  #termin-agent-window.ta-open {
    transform: translateY(0) !important;
    width: 100% !important;
    width: 100vw !important;
    height: 100% !important;
    height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
  }

  #termin-agent-window.ta-has-calendar {
    width: 100% !important;
    width: 100vw !important;
    max-width: 100% !important;
    max-width: 100vw !important;
    min-width: 100% !important;
  }

  .ta-header {
    padding: 12px 14px;
    border-radius: 0 !important;
    flex-shrink: 0;
  }

  .ta-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    max-height: 36px;
  }

  .ta-header-text h3 {
    font-size: 13.5px;
    line-height: 1.25;
  }

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

  .ta-messages-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px;
  }

  .ta-footer {
    flex-shrink: 0;
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .ta-input-row {
    gap: 6px;
  }

  .ta-input-field {
    font-size: 14px;
    padding: 8px 12px;
  }

  .ta-voice-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
  }

  .ta-send-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .ta-quick-replies {
    padding: 6px 10px;
    gap: 5px;
  }

  .ta-chip-btn {
    padding: 5px 10px;
    font-size: 11.5px;
  }
}


