/* ═══════════════════════════════════════════
   EireCoach Chat Widget  –  coach-widget.css
   ═══════════════════════════════════════════ */

:root {
  --ec-black:     #0c0c0e;
  --ec-dark:      #13131a;
  --ec-card:      #1a1a24;
  --ec-border:    #2a2a3a;
  --ec-amber:     #f59e0b;
  --ec-amber-lt:  #fbbf24;
  --ec-amber-dk:  #d97706;
  --ec-white:     #f0ede8;
  --ec-muted:     #7a7a8c;
  --ec-user-bg:   #f59e0b;
  --ec-user-fg:   #0c0c0e;
  --ec-bot-bg:    #1f1f2e;
  --ec-bot-fg:    #f0ede8;
  --ec-font:      'Outfit', sans-serif;
  --ec-display:   'Playfair Display', serif;
  --ec-radius:    14px;
}

/* ── Bubble ── */
#ec-chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 64px;
  height: 64px;
  background: var(--ec-amber);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(245,158,11,0.5), 0 2px 8px rgba(0,0,0,0.4);
  transition: transform .2s, box-shadow .2s, opacity 0.3s ease;
  user-select: none;
  font-size: 28px;
  opacity: 0;
  pointer-events: none;
}
#ec-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(245,158,11,0.65), 0 2px 8px rgba(0,0,0,0.4);
}
#ec-chat-bubble:active { transform: scale(0.97); }

#ec-chat-bubble::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(245,158,11,0.35);
  animation: ec-pulse 2.5s ease-out infinite;
}
@keyframes ec-pulse {
  0%   { transform: scale(1);   opacity: 1; }
  70%  { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

#ec-bubble-dot {
  position: absolute;
  top: 2px; right: 2px;
  width: 14px; height: 14px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid var(--ec-dark);
  animation: ec-dot-pop .3s ease;
}
@keyframes ec-dot-pop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ── Panel ── */
#ec-chat-panel {
  position: fixed;
  bottom: 108px;
  right: 28px;
  z-index: 9998;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: var(--ec-dark);
  border: 1px solid var(--ec-border);
  border-radius: var(--ec-radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(245,158,11,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--ec-font);
  transform-origin: bottom right;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), opacity .18s ease;
}
#ec-chat-panel.ec-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
#ec-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--ec-black);
  border-bottom: 1px solid var(--ec-border);
  flex-shrink: 0;
}
.ec-header-avatar {
  width: 40px; height: 40px;
  background: rgba(245,158,11,0.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  border: 1px solid rgba(245,158,11,0.2);
}
.ec-header-info { flex: 1; }
.ec-header-name {
  font-family: var(--ec-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ec-white);
  line-height: 1;
}
.ec-header-status {
  font-size: 11px;
  color: #4ade80;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}
.ec-header-status::before {
  content: '';
  width: 6px; height: 6px;
  background: #4ade80;
  border-radius: 50%;
  display: block;
}
#ec-reset-btn {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--ec-border);
  border-radius: 6px;
  color: var(--ec-muted);
  cursor: pointer;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
#ec-reset-btn:hover { background: rgba(255,255,255,0.1); color: var(--ec-white); }
#ec-chat-close {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--ec-border);
  border-radius: 6px;
  color: var(--ec-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
#ec-chat-close:hover { background: rgba(255,255,255,0.1); color: var(--ec-white); }

/* ── Quick action buttons ── */
#ec-action-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 10px 4px;
  background: var(--ec-card);
  border-bottom: 1px solid var(--ec-border);
  flex-shrink: 0;
}
.ec-action-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  background: var(--ec-dark);
  border: 1px solid var(--ec-border);
  border-radius: 8px;
  font-family: var(--ec-font);
  font-size: 12px;
  font-weight: 500;
  color: var(--ec-white);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: left;
  line-height: 1.3;
}
.ec-action-btn:hover {
  border-color: rgba(245,158,11,0.5);
  background: rgba(245,158,11,0.06);
  color: var(--ec-amber-lt);
}
.ec-action-icon { font-size: 15px; flex-shrink: 0; }

/* ── Messages ── */
#ec-float-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 260px;
  max-height: 300px;
  scroll-behavior: smooth;
  background: var(--ec-dark);
}
#ec-float-messages::-webkit-scrollbar { width: 4px; }
#ec-float-messages::-webkit-scrollbar-track { background: transparent; }
#ec-float-messages::-webkit-scrollbar-thumb { background: var(--ec-border); border-radius: 4px; }

.ec-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: ec-msg-in .2s ease;
}
@keyframes ec-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ec-msg.ec-user { flex-direction: row-reverse; }

.ec-msg-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
}
.ec-bot .ec-msg-bubble {
  background: var(--ec-bot-bg);
  color: var(--ec-bot-fg);
  border-bottom-left-radius: 4px;
}
.ec-user .ec-msg-bubble {
  background: var(--ec-user-bg);
  color: var(--ec-user-fg);
  border-bottom-right-radius: 4px;
  font-weight: 600;
}
.ec-msg-time {
  font-size: 10px;
  color: var(--ec-muted);
  flex-shrink: 0;
  margin-bottom: 2px;
}

/* Typing */
.ec-typing-dots { display: flex; gap: 4px; padding: 4px 2px; align-items: center; }
.ec-typing-dots span {
  width: 6px; height: 6px;
  background: var(--ec-muted);
  border-radius: 50%;
  animation: ec-dot-bounce .9s ease-in-out infinite;
}
.ec-typing-dots span:nth-child(2) { animation-delay: .15s; }
.ec-typing-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes ec-dot-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-5px); }
}

/* ── Contact bar ── */
#ec-contact-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  background: var(--ec-card);
  border-top: 1px solid var(--ec-border);
  flex-shrink: 0;
}
.ec-contact-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px;
  border-radius: 8px;
  font-family: var(--ec-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  border: none;
  text-decoration: none;
}
.ec-contact-phone {
  background: var(--ec-amber);
  color: var(--ec-black);
}
.ec-contact-phone:hover { background: var(--ec-amber-lt); }
.ec-contact-book {
  background: #f0f2f8;
  color: #1a2332;
  border: 1px solid #e2e6ef;
  font-size: 12px;
}
.ec-contact-book:hover { border-color: var(--ec-amber); color: var(--ec-amber-dk); }

/* ── Embedded panel contact bar ── */
#ec-emb-contact-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 14px 16px;
  background: #ffffff;
  border-top: 2px solid #e2e6ef;
  flex-shrink: 0;
}

/* ── Input ── */
#ec-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--ec-border);
  flex-shrink: 0;
  background: var(--ec-dark);
}
#ec-float-input, #ec-chat-input {
  flex: 1;
  background: #d8d5ce;
  border: 1px solid #bbb;
  border-radius: 24px;
  padding: 10px 16px;
  font-family: var(--ec-font);
  font-size: 14px;
  color: #111;
  outline: none;
  transition: border-color .2s;
}
#ec-float-input::placeholder, #ec-chat-input::placeholder { color: #555; }
#ec-float-input:focus, #ec-chat-input:focus { border-color: var(--ec-amber); background: #e8e5de; }

#ec-float-send, #ec-emb-send {
  width: 38px; height: 38px;
  background: var(--ec-amber);
  border: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, transform .15s;
  flex-shrink: 0;
}
#ec-float-send:hover, #ec-emb-send:hover { background: var(--ec-amber-lt); transform: scale(1.05); }
#ec-float-send svg, #ec-emb-send svg { width: 16px; height: 16px; fill: var(--ec-black); }
#ec-float-send:disabled, #ec-emb-send:disabled, #ec-float-input:disabled, #ec-chat-input:disabled { opacity: 0.5; cursor: not-allowed; }
#ec-float-send:disabled, #ec-emb-send:disabled { transform: none !important; }

/* ── Mobile full-screen ── */
@media (max-width: 767px) {
  #ec-chat-panel {
    top: 0; bottom: 0; left: 0; right: 0;
    width: 100%; max-width: 100%;
    height: 100%; max-height: 100%;
    border-radius: 0;
    border: none;
    transform-origin: center bottom;
  }
  #ec-chat-panel.ec-open {
    transform: scale(1) translateY(0);
  }
  #ec-float-messages {
    min-height: 0;
    max-height: none;
    flex: 1;
  }
  #ec-chat-bubble {
    bottom: 20px;
    right: 20px;
  }
  #ec-chat-bubble.ec-hidden {
    display: none;
  }
}
