/* Etod Support — floating panel + pin player (TBot phase 1) */

:root {
  --es-amber: #f59e0b;
  --es-amber-dark: #d97706;
  --es-navy: #0f172a;
  --es-border: #e2e8f0;
  --es-surface: #ffffff;
  --es-muted: #64748b;
  --es-indigo: #6366f1;
}

/* Header trigger */
.es-head-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(217, 119, 6, 0.12));
  color: var(--es-amber-dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}
.es-head-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25); }
.es-head-btn.active { background: linear-gradient(135deg, var(--es-amber), var(--es-amber-dark)); color: #fff; }
.es-head-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.es-reply-text { font-size: 0.88rem; line-height: 1.65; margin-bottom: 6px; white-space: pre-wrap; }
.es-reply-text.es-streaming { min-height: 1.2em; }
.es-reply-agent:not(:empty) {
  margin: 12px 0 8px;
  padding-top: 10px;
  border-top: 2px dashed rgba(99, 102, 241, 0.28);
}
.es-reply-agent.es-agent-visible .es-agent-block {
  animation: es-agent-in 0.4s ease forwards;
}
@keyframes es-agent-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.es-cursor { color: var(--es-amber-dark); animation: es-blink 0.7s step-end infinite; }
@keyframes es-blink { 50% { opacity: 0; } }
.es-agent-block {
  margin: 14px 0 10px;
  padding: 14px 14px 12px;
  border-radius: 14px;
  border: 2px solid rgba(99, 102, 241, 0.35);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(245, 158, 11, 0.06));
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
}
.es-agent-block-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--es-indigo);
  margin-bottom: 10px;
}
.es-agent-ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; flex-shrink: 0; }
.es-agent-ic-ai { fill: rgba(99, 102, 241, 0.15); stroke: var(--es-indigo); }
.es-agent-lead { font-size: 0.84rem; line-height: 1.65; margin: 0 0 12px; color: #334155; }
.es-agent-input-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.es-agent-input-opt {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.75rem; padding: 6px 10px; border-radius: 10px;
  background: #fff; border: 1px solid var(--es-border); color: #475569;
}
.es-agent-mode {
  display: flex; gap: 10px; margin-bottom: 12px;
  padding: 10px; border-radius: 10px; background: rgba(255,255,255,0.75);
  border: 1px solid rgba(226, 232, 240, 0.9);
}
.es-agent-mode-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--es-indigo); color: #fff;
  font-size: 0.78rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.es-agent-mode-title { font-weight: 700; font-size: 0.82rem; color: var(--es-navy); margin-bottom: 4px; }
.es-agent-mode-desc { font-size: 0.76rem; color: #64748b; margin: 0 0 8px; line-height: 1.5; }
.es-agent-example {
  font-size: 0.78rem; line-height: 1.55; padding: 8px 10px;
  border-radius: 8px; background: #f8fafc; border-right: 3px solid var(--es-amber);
  color: #1e293b; margin-top: 6px; direction: rtl;
}
.es-agent-example .es-agent-q {
  color: #6366f1;
  font-weight: 800;
  font-size: 0.95em;
  line-height: 1;
  padding: 0 2px;
  user-select: none;
}
.es-agent-foot { font-size: 0.76rem; color: #64748b; margin: 8px 0 0; line-height: 1.5; }

.es-head-title-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 6px;
  color: var(--es-amber-dark);
}
.es-head-title-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.es-panel-head-title { display: flex; align-items: center; gap: 6px; }

/* Backdrop */
.es-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  z-index: 10040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.es-backdrop.open { opacity: 1; pointer-events: auto; }

@media (min-width: 769px) {
  .es-backdrop.open { opacity: 0; pointer-events: none; }
}

/* Panel */
.es-panel {
  position: fixed;
  z-index: 10050;
  background: var(--es-surface);
  border: 1px solid var(--es-border);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1), opacity 0.25s;
}

.es-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.98);
}

@media (min-width: 769px) {
  .es-panel {
    width: 380px;
    max-width: calc(100vw - 24px);
    height: 520px;
    max-height: calc(100dvh - 100px);
    bottom: 20px;
    left: 20px;
    border-radius: 22px;
  }
}

@media (max-width: 768px) {
  .es-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: min(85dvh, 640px);
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
  }
  .es-panel.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .es-panel.hidden { transform: translateY(100%); }
}

.es-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}
.es-panel-head-title {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--es-navy);
}
.es-panel-head-actions { display: flex; gap: 6px; }
.es-icon-btn {
  width: 32px; height: 32px;
  border: none; border-radius: 10px;
  background: rgba(255,255,255,0.8);
  color: var(--es-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.es-icon-btn:hover { background: #fff; color: var(--es-navy); }

.es-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--es-border);
  overflow-x: auto;
}
.es-tab {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--es-border);
  background: #f8fafc;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--es-muted);
  cursor: pointer;
  font-family: inherit;
}
.es-tab.active {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--es-amber-dark);
}
.es-tab:disabled { opacity: 0.45; cursor: not-allowed; }

.es-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 40%);
}

.es-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 0.82rem;
  line-height: 1.65;
  word-break: break-word;
}
.es-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--es-indigo), #4f46e5);
  color: #fff;
  border-bottom-left-radius: 4px;
}
.es-msg-bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--es-border);
  color: var(--es-navy);
  border-bottom-right-radius: 4px;
}
.es-msg-bot .es-steps { margin-top: 8px; padding-right: 16px; }
.es-msg-bot .es-steps li { margin: 4px 0; }

.es-media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.es-media-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
  color: var(--es-amber-dark);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.es-media-btn:hover { background: rgba(245, 158, 11, 0.16); }

.es-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.es-follow-btn {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  background: transparent;
  font-size: 0.68rem;
  color: var(--es-muted);
  cursor: pointer;
  font-family: inherit;
}

.es-support-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 4px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid;
}
.es-support-tag-ic { font-size: 0.85rem; }
.es-support-tag-complaint { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.es-support-tag-feedback { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.es-support-tag-blocked { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.es-support-tag-escalation { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }

.es-composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 12px;
  border-top: 1px solid var(--es-border);
  background: #fff;
}
.es-composer-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.es-composer textarea {
  flex: 1;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  border: 1px solid var(--es-border);
  border-radius: 14px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.82rem;
}
.es-mic-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--es-border);
  border-radius: 14px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}
.es-mic-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.es-mic-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.es-mic-btn.recording {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  animation: es-mic-pulse 1.1s infinite;
}
@keyframes es-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}
.es-send-btn {
  width: 42px; height: 42px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--es-amber), var(--es-amber-dark));
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.es-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.es-send-btn svg { width: 18px; height: 18px; stroke: #fff; fill: none; }

.es-typing {
  align-self: flex-start;
  padding: 8px 12px;
  font-size: 0.75rem;
  color: var(--es-muted);
}

/* Pin player */
.es-player {
  position: fixed;
  z-index: 10060;
  background: #0f172a;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
  width: 320px;
  max-width: calc(100vw - 24px);
}
.es-player.hidden { display: none !important; }
.es-player.pinned {
  bottom: 20px;
  right: 20px;
}
@media (max-width: 768px) {
  .es-player.pinned {
    width: 280px;
    bottom: calc(min(85dvh, 640px) + 12px);
    right: 12px;
  }
}
.es-player-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: move;
}
.es-player-head span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.es-player-body { background: #000; }
.es-player-body video,
.es-player-body audio { width: 100%; display: block; max-height: 180px; }
.es-player-error {
  padding: 8px 10px;
  font-size: 0.72rem;
  color: #b45309;
  background: #fffbeb;
  word-break: break-all;
}
.es-player-controls {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: rgba(255,255,255,0.04);
}
.es-player-controls button {
  flex: 1;
  padding: 6px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 0.68rem;
  cursor: pointer;
  font-family: inherit;
}

.login-help-btn {
  width: 100%;
  margin-top: 12px;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(217, 119, 6, 0.08));
  color: #b45309;
  border-radius: 16px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}
.login-help-btn svg {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none; stroke-width: 1.8;
}
.login-help-btn:hover { background: rgba(245, 158, 11, 0.18); }
.es-cred-box {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.es-cred-box div { margin: 6px 0; font-size: 0.82rem; }
.es-cred-box code {
  display: block;
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #0f172a;
  color: #fde68a;
  font-size: 0.9rem;
  direction: ltr;
  text-align: left;
}
.es-pick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.es-pick-btn {
  text-align: right;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: #fffbeb;
  color: #92400e;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.5;
}
.es-pick-btn:hover { background: #fef3c7; }
