/* ════════════════════════════════════════════════════════════
   ChatHeld Floating Widget Styles (GrowTracker Forest Emerald)
   ════════════════════════════════════════════════════════════ */

#chatheld-widget-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Floating Call Action Button (Über dem Chat) */
.chatheld-call-fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4), 0 3px 10px rgba(0, 0, 0, 0.35);
  border: 1.5px solid rgba(134, 239, 172, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, background 0.25s ease;
  user-select: none;
}

.chatheld-call-fab:hover {
  transform: scale(1.1) translateY(-2px);
  background: linear-gradient(135deg, #16a34a 0%, #4ade80 100%);
  box-shadow: 0 12px 28px rgba(34, 197, 94, 0.55), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.chatheld-call-fab:active {
  transform: scale(0.92);
}

.chatheld-call-fab-icon {
  width: 22px;
  height: 22px;
  color: #ffffff;
}

.chatheld-call-fab.active {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  border-color: #fca5a5;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.7);
  animation: callFabPulse 1.4s infinite;
}

@keyframes callFabPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Floating Action Button */
.chatheld-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0F4D0F 0%, #166534 60%, #15803d 100%);
  box-shadow: 0 10px 25px rgba(15, 77, 15, 0.45), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(74, 222, 128, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, background 0.25s ease;
  position: relative;
  user-select: none;
}

.chatheld-fab:hover {
  transform: scale(1.08) translateY(-2px);
  background: linear-gradient(135deg, #145a14 0%, #15803d 60%, #22c55e 100%);
  box-shadow: 0 14px 32px rgba(34, 197, 94, 0.35), 0 4px 14px rgba(0, 0, 0, 0.5);
}

.chatheld-fab:active {
  transform: scale(0.95);
}

.chatheld-fab-icon {
  width: 26px;
  height: 26px;
  color: #e8f0e9;
  transition: transform 0.3s ease;
}

.chatheld-fab.open .chatheld-fab-icon {
  transform: rotate(90deg);
}

/* Chat Window Modal */
.chatheld-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 390px;
  max-width: calc(100vw - 48px);
  height: 590px;
  max-height: calc(100vh - 120px);
  background: #0b0f0c;
  border: 1px solid rgba(74, 222, 128, 0.18);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1), transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(24px);
}

.chatheld-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header - Schlank, clean, nur "ChatHeld" */
.chatheld-header {
  padding: 14px 18px;
  background: linear-gradient(180deg, #141a15 0%, #0e140f 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chatheld-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatheld-avatar-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.chatheld-avatar {
  width: 38px;
  height: 38px;
  background: #141a15;
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.2);
}

.chatheld-header-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.chatheld-online-dot {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 10px;
  height: 10px;
  background-color: #22c55e;
  border: 2px solid #0e140f;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
  z-index: 2;
}

.chatheld-header-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.chatheld-header-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #e8f0e9;
}

.chatheld-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatheld-btn-icon {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #718c74;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chatheld-btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e8f0e9;
  border-color: rgba(255, 255, 255, 0.15);
}

.chatheld-call-btn {
  color: #4ade80;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.25);
}

.chatheld-call-btn:hover {
  background: rgba(34, 197, 94, 0.25);
  color: #ffffff;
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.chatheld-call-btn.active {
  background: #dc2626;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
  animation: callPulse 1.5s infinite;
}

@keyframes callPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* User Info Bar */
.chatheld-user-bar {
  padding: 8px 16px;
  background: rgba(34, 197, 94, 0.05);
  border-bottom: 1px solid rgba(34, 197, 94, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #86efac;
}

.chatheld-user-bar a {
  color: #4ade80;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

/* Messages Area */
.chatheld-messages {
  flex: 1;
  padding: 18px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chatheld-msg {
  max-width: 86%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: chatFadeIn 0.2s ease forwards;
}

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

.chatheld-msg.bot {
  align-self: flex-start;
  background: #141a15;
  color: #e8f0e9;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chatheld-msg.bot a {
  color: #4ade80;
  text-decoration: underline;
}

.chatheld-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0F4D0F 0%, #15803d 100%);
  color: #ffffff;
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-bottom-right-radius: 3px;
  box-shadow: 0 4px 12px rgba(15, 77, 15, 0.35);
}

/* Quick Replies */
.chatheld-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.chatheld-quick-btn {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.22);
  color: #86efac;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.chatheld-quick-btn:hover {
  background: #166534;
  color: #ffffff;
  border-color: #22c55e;
  transform: translateY(-1px);
}

/* Input Area */
.chatheld-footer {
  padding: 12px 16px;
  background: #0b0f0c;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.chatheld-input-box {
  display: flex;
  align-items: center;
  background: #141a15;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  padding: 4px 6px 4px 16px;
  transition: all 0.2s ease;
}

.chatheld-input-box:focus-within {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
  background: #172018;
}

.chatheld-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #e8f0e9;
  font-size: 13.5px;
  outline: none;
}

.chatheld-input::placeholder {
  color: #718c74;
}

.chatheld-send-btn {
  background: linear-gradient(135deg, #0F4D0F 0%, #15803d 100%);
  border: 1px solid rgba(74, 222, 128, 0.3);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.chatheld-send-btn:hover {
  background: linear-gradient(135deg, #145a14 0%, #22c55e 100%);
  transform: scale(1.06);
}

/* Ticket Modal inside chat */
.chatheld-ticket-view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #0b0f0c;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 22px 20px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.22s ease;
}

.chatheld-ticket-view.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.chatheld-ticket-view h3 {
  margin: 0 0 12px 0;
  font-size: 17px;
  font-weight: 700;
  color: #e8f0e9;
}

.chatheld-form-group {
  margin-bottom: 12px;
}

.chatheld-form-group label {
  display: block;
  font-size: 12px;
  color: #718c74;
  margin-bottom: 4px;
}

.chatheld-form-input {
  width: 100%;
  background: #141a15;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 9px 12px;
  color: #e8f0e9;
  font-size: 13px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s;
}

.chatheld-form-input:focus {
  border-color: #22c55e;
}

.chatheld-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.chatheld-btn-primary {
  flex: 1;
  background: linear-gradient(135deg, #0F4D0F 0%, #15803d 100%);
  color: #ffffff;
  border: 1px solid rgba(74, 222, 128, 0.3);
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.chatheld-btn-primary:hover {
  background: linear-gradient(135deg, #145a14 0%, #22c55e 100%);
}

.chatheld-btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #718c74;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.chatheld-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e8f0e9;
}

/* ════════════════════════════════════════════════════════════
   In-Call Phone Screen (Telefonat UI mit Live-Transcript & Wave)
   ════════════════════════════════════════════════════════════ */
.chatheld-call-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, #090e0a 0%, #0d160f 100%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 20px 18px;
  box-sizing: border-box;
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  pointer-events: none;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(20px);
}

.chatheld-call-screen.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.chatheld-call-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chatheld-call-status-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #4ade80;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 4px 10px;
  border-radius: 999px;
  animation: callBadgePulse 2s infinite;
}

@keyframes callBadgePulse {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

.chatheld-call-timer {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
}

.chatheld-call-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 14px;
}

.chatheld-call-avatar-pulse {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111a12;
  border: 2px solid rgba(74, 222, 128, 0.4);
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.25);
}

.chatheld-call-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
}

.chatheld-call-name {
  margin: 10px 0 2px 0;
  font-size: 18px;
  font-weight: 800;
  color: #f1f5f9;
}

.chatheld-call-sub {
  margin: 0;
  font-size: 12px;
  color: #86efac;
}

/* Audio Wave Animation */
.chatheld-audio-wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  margin-top: 10px;
}

.chatheld-audio-wave .wave-bar {
  width: 3px;
  height: 6px;
  background: #4ade80;
  border-radius: 99px;
  transition: height 0.15s ease;
}

.chatheld-audio-wave.speaking .wave-bar:nth-child(1) { animation: waveAnim 0.8s infinite ease-in-out; }
.chatheld-audio-wave.speaking .wave-bar:nth-child(2) { animation: waveAnim 0.8s infinite ease-in-out 0.15s; }
.chatheld-audio-wave.speaking .wave-bar:nth-child(3) { animation: waveAnim 0.8s infinite ease-in-out 0.3s; }
.chatheld-audio-wave.speaking .wave-bar:nth-child(4) { animation: waveAnim 0.8s infinite ease-in-out 0.45s; }
.chatheld-audio-wave.speaking .wave-bar:nth-child(5) { animation: waveAnim 0.8s infinite ease-in-out 0.6s; }

@keyframes waveAnim {
  0%, 100% { height: 6px; }
  50% { height: 22px; }
}

/* Live Transcript Log */
.chatheld-call-transcript {
  flex: 1;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chatheld-transcript-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 8px;
}

.chatheld-transcript-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chatheld-transcript-entry {
  font-size: 12.5px;
  line-height: 1.45;
  padding: 6px 10px;
  border-radius: 8px;
}

.chatheld-transcript-entry.bot {
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  border-left: 3px solid #22c55e;
}

.chatheld-transcript-entry.user {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  border-left: 3px solid #60a5fa;
}

/* Call Footer Hangup */
.chatheld-call-footer {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.chatheld-hangup-btn {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  border: none;
  border-radius: 999px;
  color: #ffffff;
  padding: 11px 28px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}

.chatheld-hangup-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.65);
}

.chatheld-hangup-btn:active {
  transform: scale(0.96);
}
