/* ═══════════════════════════════════════════════════════
   ZAPATA CONCRETE — AI Lead Chatbot
   v2 — Visual refresh: refined bubbles, better spacing
════════════════════════════════════════════════════════ */

:root {
  --chat-primary:      #8DC634;
  --chat-primary-dark: #6fa028;
  --chat-primary-glow: rgba(141, 198, 52, 0.28);
  --chat-secondary:    #14579E;
  --chat-bg:           #0D1117;
  --chat-surface:      #131923;
  --chat-surface-2:    #1C2535;
  --chat-surface-3:    #242F42;
  --chat-border:       rgba(255, 255, 255, 0.07);
  --chat-border-soft:  rgba(255, 255, 255, 0.04);
  --chat-text:         #E8ECF0;
  --chat-text-muted:   rgba(232, 236, 240, 0.38);
  --chat-shadow:       0 32px 96px rgba(0, 0, 0, 0.65), 0 8px 32px rgba(0, 0, 0, 0.4);
  --chat-radius:       22px;
  --chat-btn-size:     62px;
  --chat-width:        390px;
  --chat-height:       580px;
  --chat-z:            999999;
}

/* ── Reset ── */
#zc-chatbot-widget,
#zc-chatbot-widget * {
  box-sizing: border-box;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════════════════
   FLOATING BUTTON
════════════════════════════════════════════════════════ */
#zc-chat-btn {
  position: fixed;
  bottom: 26px;
  right: 26px;
  width: var(--chat-btn-size);
  height: var(--chat-btn-size);
  border-radius: 18px;
  background: linear-gradient(145deg, #9ED63E 0%, var(--chat-primary) 45%, var(--chat-primary-dark) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--chat-z);
  box-shadow:
    0 8px 28px var(--chat-primary-glow),
    0 3px 10px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255,255,255,0.2);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease;
  animation: zcBtnPulse 3.5s ease-in-out infinite;
  outline: none;
}

#zc-chat-btn:hover {
  transform: scale(1.08) translateY(-3px);
  box-shadow:
    0 18px 52px rgba(141, 198, 52, 0.5),
    0 5px 16px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255,255,255,0.2);
  animation: none;
}

#zc-chat-btn.is-open {
  background: linear-gradient(145deg, #1e2a3d 0%, #131923 100%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 3px 10px rgba(0, 0, 0, 0.55);
  animation: none;
}

.zc-btn-icon {
  transition: transform 0.35s ease, opacity 0.25s ease;
  position: absolute;
}
#zc-chat-btn.is-open .zc-btn-icon {
  opacity: 0;
  transform: scale(0.5) rotate(90deg);
}

.zc-btn-close {
  position: absolute;
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
  transition: transform 0.35s ease, opacity 0.25s ease;
}
#zc-chat-btn.is-open .zc-btn-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Badge */
#zc-notif-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  background: #F04040;
  border-radius: 50%;
  border: 2.5px solid #0D1117;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 800;
  color: #fff;
  font-family: 'Inter', sans-serif;
  transform: scale(0);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
#zc-notif-badge.show { transform: scale(1); }

@keyframes zcBtnPulse {
  0%, 100% { box-shadow: 0 8px 28px var(--chat-primary-glow), 0 3px 10px rgba(0,0,0,0.55); }
  50%       { box-shadow: 0 8px 44px rgba(141,198,52,0.52), 0 3px 10px rgba(0,0,0,0.55); }
}

/* ═══════════════════════════════════════════════════════
   CHAT CONTAINER
════════════════════════════════════════════════════════ */
#zc-chat-container {
  position: fixed;
  bottom: 104px;
  right: 26px;
  width: var(--chat-width);
  height: var(--chat-height);
  background: var(--chat-bg);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: calc(var(--chat-z) - 1);
  transform: scale(0.9) translateY(18px);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom right;
  transition: transform 0.42s cubic-bezier(0.34, 1.4, 0.64, 1),
              opacity 0.3s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#zc-chat-container.is-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
#zc-chat-header {
  padding: 14px 16px 13px;
  background: linear-gradient(160deg, #172035 0%, #0f1825 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}

/* Green accent line at bottom of header */
#zc-chat-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(
    to right,
    var(--chat-primary) 0%,
    rgba(141,198,52,0.4) 50%,
    transparent 100%
  );
}

.zc-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, #9ED63E 0%, var(--chat-primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.88rem;
  font-weight: 900;
  color: #0B0E14;
  font-family: 'Anton', 'Arial Black', sans-serif;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 14px rgba(141,198,52,0.3), inset 0 1px 0 rgba(255,255,255,0.25);
}

.zc-header-info { flex: 1; min-width: 0; }

.zc-header-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.zc-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}

.zc-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chat-primary);
  box-shadow: 0 0 8px rgba(141,198,52,0.9);
  flex-shrink: 0;
  animation: zcStatusPulse 2s ease-in-out infinite;
}

.zc-header-status span:last-child {
  font-size: 0.64rem;
  color: rgba(141,198,52,0.75);
  font-weight: 500;
  letter-spacing: 0.04em;
}

@keyframes zcStatusPulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

.zc-header-close {
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(255,255,255,0.07);
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(232,236,240,0.45);
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
  outline: none;
}
.zc-header-close:hover {
  background: rgba(255,255,255,0.13);
  color: var(--chat-text);
}

/* ═══════════════════════════════════════════════════════
   MESSAGES AREA
════════════════════════════════════════════════════════ */
#zc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(20,87,158,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 85% 100%, rgba(141,198,52,0.06) 0%, transparent 55%),
    var(--chat-bg);
}

#zc-messages::-webkit-scrollbar { width: 3px; }
#zc-messages::-webkit-scrollbar-track { background: transparent; }
#zc-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
}

/* ── Bubble wrapper ── */
.zc-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: zcMsgIn 0.32s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes zcMsgIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.zc-msg.user { align-self: flex-end; align-items: flex-end; }
.zc-msg.bot  { align-self: flex-start; align-items: flex-start; }

/* ── Bot bubble ── */
.zc-msg.bot .zc-msg-bubble {
  background: var(--chat-surface-2);
  border: 1px solid rgba(255,255,255,0.07);
  border-left: 3px solid rgba(141,198,52,0.5);
  color: var(--chat-text);
  border-radius: 4px 16px 16px 16px;
  padding: 14px 18px;
  font-size: 0.84rem;
  line-height: 1.65;
  word-break: break-word;
}

/* ── User bubble ── */
.zc-msg.user .zc-msg-bubble {
  background: linear-gradient(145deg, #9ED63E 0%, var(--chat-primary) 55%, #5e8a1e 100%);
  color: #0B0E14;
  font-weight: 600;
  border-radius: 16px 4px 16px 16px;
  padding: 13px 18px;
  font-size: 0.84rem;
  line-height: 1.55;
  word-break: break-word;
  box-shadow: 0 3px 12px rgba(141,198,52,0.25);
}

/* Rich text inside bot bubble */
.zc-msg.bot .zc-msg-bubble a {
  color: var(--chat-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.zc-msg.bot .zc-msg-bubble strong { color: #fff; font-weight: 650; }
.zc-msg.bot .zc-msg-bubble em { color: rgba(232,236,240,0.65); font-style: italic; }
.zc-msg.bot .zc-msg-bubble ul {
  padding-left: 16px;
  margin-top: 6px;
  list-style: disc;
}
.zc-msg.bot .zc-msg-bubble li { margin-bottom: 4px; }
.zc-msg.bot .zc-msg-bubble br + br { display: block; content: ''; margin-top: 4px; }

/* Timestamp */
.zc-msg-time {
  font-size: 0.58rem;
  color: var(--chat-text-muted);
  margin-top: 4px;
  padding: 0 6px;
  letter-spacing: 0.03em;
}

/* ── Typing indicator ── */
#zc-typing {
  display: none;
  align-self: flex-start;
  animation: zcMsgIn 0.3s ease both;
}
#zc-typing.show { display: flex; }

.zc-typing-bubble {
  background: var(--chat-surface-2);
  border: 1px solid rgba(255,255,255,0.07);
  border-left: 2px solid rgba(141,198,52,0.35);
  border-radius: 4px 16px 16px 16px;
  padding: 12px 18px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.zc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chat-primary);
  animation: zcDotBounce 1.3s ease-in-out infinite;
}
.zc-dot:nth-child(2) { animation-delay: 0.18s; }
.zc-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes zcDotBounce {
  0%,60%,100% { transform: translateY(0);   opacity: 0.3; }
  30%          { transform: translateY(-7px); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════
   QUICK BUTTONS — horizontal scroll, no wrap
════════════════════════════════════════════════════════ */
#zc-quick-btns {
  position: relative;
  padding: 9px 14px;
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  border-top: 1px solid rgba(255,255,255,0.05);
  background: linear-gradient(180deg, #131923 0%, #0f1520 100%);
  flex-shrink: 0;
}
/* Fade-out on right edge to hint at scroll */
#zc-quick-btns::after {
  content: '';
  position: sticky;
  right: 0;
  flex-shrink: 0;
  width: 32px;
  background: linear-gradient(to right, transparent, #0f1520);
  pointer-events: none;
}
#zc-quick-btns::-webkit-scrollbar { display: none; }
#zc-quick-btns { -ms-overflow-style: none; scrollbar-width: none; }
#zc-quick-btns:empty { display: none; }

.zc-quick-btn {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(232,236,240,0.8);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(141,198,52,0.22);
  border-radius: 20px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.22s ease;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.01em;
  line-height: 1;
  outline: none;
}
.zc-quick-btn:hover {
  background: rgba(141,198,52,0.13);
  border-color: var(--chat-primary);
  color: var(--chat-primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(141,198,52,0.15);
}
.zc-quick-btn:active { transform: translateY(0); }

/* ═══════════════════════════════════════════════════════
   INPUT AREA
════════════════════════════════════════════════════════ */
#zc-input-area {
  padding: 10px 12px 12px;
  background: var(--chat-surface);
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

#zc-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 13px;
  padding: 10px 14px;
  font-size: 0.81rem;
  color: var(--chat-text);
  font-family: 'Inter', sans-serif;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.22s, background 0.22s;
  outline: none;
}
#zc-input::placeholder { color: var(--chat-text-muted); }
#zc-input:focus {
  border-color: rgba(141,198,52,0.4);
  background: rgba(255,255,255,0.07);
}

#zc-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(145deg, #9ED63E 0%, var(--chat-primary-dark) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.25s ease,
              opacity 0.2s;
  box-shadow: 0 4px 14px rgba(141,198,52,0.35);
  outline: none;
}
#zc-send-btn:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 6px 22px rgba(141,198,52,0.5);
}
#zc-send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — Mobile full screen
════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  #zc-chat-container {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
    transform-origin: bottom center;
  }
  #zc-chat-btn {
    bottom: 18px;
    right: 18px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
  }
  .zc-msg { max-width: 90%; }
}
