/* ═══════════════════════════════════════════════
   Dublin Battery Replacements – battery-widget.css
   ═══════════════════════════════════════════════ */

:root {
  --ec-black:     #0a0a0c;
  --ec-dark:      #111318;
  --ec-card:      #191c24;
  --ec-border:    #252a38;
  --ec-red:       #e81c2e;
  --ec-red-lt:    #ff3345;
  --ec-red-dk:    #c4172a;
  --ec-navy:      #0c2957;
  --ec-navy-lt:   #1a3f7a;
  --ec-white:     #f0f2f8;
  --ec-muted:     #6a7080;
  --ec-user-bg:   #e81c2e;
  --ec-user-fg:   #ffffff;
  --ec-bot-bg:    #1a1f2e;
  --ec-bot-fg:    #f0f2f8;
  --ec-font:      'Outfit', sans-serif;
  --ec-radius:    14px;
}

/* ── Bubble ── */
#ec-chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 64px;
  height: 64px;
  background: var(--ec-red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(232,28,46,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: 1;
  pointer-events: all;
}
#ec-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(232,28,46,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(232,28,46,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: var(--ec-navy);
  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(232,28,46,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-navy);
  border-bottom: 1px solid var(--ec-border);
  flex-shrink: 0;
}
.ec-header-avatar {
  width: 40px; height: 40px;
  background: rgba(232,28,46,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  border: 1px solid rgba(232,28,46,0.3);
}
.ec-header-info { flex: 1; }
.ec-header-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ec-white);
  line-height: 1;
  letter-spacing: 0.2px;
}
.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.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: rgba(255,255,255,0.6);
  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.15); color: var(--ec-white); }
#ec-chat-close {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: rgba(255,255,255,0.6);
  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.15); 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(232,28,46,0.5);
  background: rgba(232,28,46,0.06);
  color: var(--ec-red-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-red);
  color: #ffffff;
}
.ec-contact-phone:hover { background: var(--ec-red-lt); color: #ffffff; }
.ec-contact-whatsapp {
  background: #25D366;
  color: #ffffff;
}
.ec-contact-whatsapp:hover { background: #1fb855; color: #ffffff; }

/* ── 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 {
  flex: 1;
  background: #d8d8e0;
  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 { color: #555; }
#ec-float-input:focus { border-color: var(--ec-red); background: #e4e4ec; }

#ec-float-send {
  width: 38px; height: 38px;
  background: var(--ec-red);
  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 { background: var(--ec-red-lt); transform: scale(1.05); }
#ec-float-send svg { width: 16px; height: 16px; fill: #ffffff; }
#ec-float-send:disabled, #ec-float-input:disabled { opacity: 0.5; cursor: not-allowed; }
#ec-float-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;
  }
}
