/* ═══════════════════════════════════════════
   E.T JIREH REMODELING — Chatbot Styles
   ═══════════════════════════════════════════ */

:root {
  --cb-primary: #E6B10A;
  --cb-primary-hover: #F5CC3A;
  --cb-secondary: #177237;
  --cb-bg-deep: #0D1F12;
  --cb-bg-surface: #122A18;
  --cb-bg-card: #1A3522;
  --cb-text: #F5F2EB;
  --cb-text-muted: rgba(245, 242, 235, 0.5);
  --cb-border: rgba(245, 242, 235, 0.1);
  --cb-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(23, 114, 55, 0.15);
  --cb-radius: 20px;
}

/* ── FLOATING TRIGGER — Side Tab ── */
.cb-trigger {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 0;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  outline: none;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cb-trigger:hover {
  transform: translateY(-50%) translateX(-4px);
}

.cb-trigger-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 120px;
  background: linear-gradient(180deg, var(--cb-primary) 0%, #c4960a 100%);
  border-radius: 14px 0 0 14px;
  box-shadow: -4px 4px 24px rgba(0, 0, 0, 0.35), -2px 0 12px rgba(230, 177, 10, 0.2);
  position: relative;
  overflow: hidden;
}

.cb-trigger-tab::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  border-radius: inherit;
}

.cb-trigger-tab::after {
  content: '';
  position: absolute;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
  top: -20px;
  left: -20px;
  animation: cb-shimmer 3s ease-in-out infinite;
}

@keyframes cb-shimmer {
  0%, 100% { opacity: 0; transform: translate(-20px, -20px); }
  50% { opacity: 1; transform: translate(10px, 40px); }
}

.cb-trigger-icon {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.cb-trigger-icon svg,
.cb-trigger-icon > span:first-child svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.cb-trigger:hover .cb-trigger-icon svg {
  transform: scale(1.1);
}

/* Keep SVG icon upright inside vertical tab */
.cb-trigger-icon > span:first-child {
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: horizontal-tb;
}

.cb-trigger-icon span {
  font-family: 'Inter', 'Space Grotesk', sans-serif;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--cb-bg-deep);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  line-height: 1;
}

/* Pulse ring */
.cb-trigger-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 14px 0 0 14px;
  border: 2px solid var(--cb-primary);
  opacity: 0;
  animation: cb-pulse-ring 2.5s ease-out infinite;
}

@keyframes cb-pulse-ring {
  0% { opacity: 0.6; inset: -2px; }
  100% { opacity: 0; inset: -16px; }
}

/* Badge */
.cb-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 18px;
  height: 18px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid var(--cb-bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}

.cb-badge.visible {
  opacity: 1;
  transform: scale(1);
}

/* Active state — icon swap */
.cb-trigger.active .cb-trigger-tab {
  background: linear-gradient(180deg, var(--cb-bg-surface) 0%, var(--cb-bg-deep) 100%);
  box-shadow: -4px 4px 24px rgba(0, 0, 0, 0.5);
}

.cb-trigger.active .cb-trigger-tab::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 50%);
}

.cb-trigger.active .cb-trigger-pulse {
  display: none;
}

/* ── CHAT WINDOW ── */
.cb-container {
  position: fixed;
  bottom: 24px;
  right: 64px;
  width: 390px;
  height: 540px;
  background: var(--cb-bg-deep);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  border: 1px solid var(--cb-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateX(30px) scale(0.95);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cb-container.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(1);
}

/* ── HEADER ── */
.cb-header {
  background: linear-gradient(135deg, var(--cb-bg-surface) 0%, var(--cb-bg-deep) 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--cb-border);
  flex-shrink: 0;
}

.cb-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cb-primary) 0%, #c4960a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cb-header-avatar svg {
  width: 22px;
  height: 22px;
}

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

.cb-header-name {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: var(--cb-text);
  line-height: 1.2;
}

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

.cb-header-status-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  animation: cb-status-pulse 2s ease-in-out infinite;
}

@keyframes cb-status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.cb-header-status span {
  font-size: 11px;
  color: var(--cb-text-muted);
  font-weight: 500;
}

.cb-header-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(245, 242, 235, 0.06);
  color: var(--cb-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.cb-header-close:hover {
  background: rgba(245, 242, 235, 0.12);
  color: var(--cb-text);
}

/* ── MESSAGES ── */
.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.cb-messages::-webkit-scrollbar {
  width: 4px;
}
.cb-messages::-webkit-scrollbar-track {
  background: transparent;
}
.cb-messages::-webkit-scrollbar-thumb {
  background: rgba(245, 242, 235, 0.1);
  border-radius: 4px;
}

.cb-msg {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  animation: cb-msg-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  word-wrap: break-word;
}

@keyframes cb-msg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.cb-msg.bot {
  align-self: flex-start;
  background: var(--cb-bg-card);
  color: var(--cb-text);
  border-bottom-left-radius: 4px;
}

.cb-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--cb-primary) 0%, #c4960a 100%);
  color: var(--cb-bg-deep);
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

.cb-msg a {
  color: var(--cb-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cb-msg.user a {
  color: var(--cb-bg-deep);
}

.cb-msg ul, .cb-msg ol {
  margin: 6px 0;
  padding-left: 18px;
}
.cb-msg li {
  margin-bottom: 3px;
}
.cb-msg strong {
  font-weight: 700;
}

/* Typing */
.cb-typing {
  align-self: flex-start;
  background: var(--cb-bg-card);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 14px 20px;
  display: flex;
  gap: 5px;
  animation: cb-msg-in 0.3s ease;
}

.cb-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--cb-text-muted);
  border-radius: 50%;
  animation: cb-typing-bounce 1.4s ease-in-out infinite;
}
.cb-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.cb-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes cb-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ── QUICK BUTTONS ── */
.cb-quick {
  padding: 4px 16px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.cb-quick-btn {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid rgba(230, 177, 10, 0.3);
  background: rgba(230, 177, 10, 0.06);
  color: var(--cb-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.cb-quick-btn:hover {
  background: var(--cb-primary);
  color: var(--cb-bg-deep);
  border-color: var(--cb-primary);
  transform: translateY(-1px);
}

/* ── INPUT AREA ── */
.cb-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--cb-border);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: var(--cb-bg-surface);
}

.cb-textarea {
  flex: 1;
  background: rgba(245, 242, 235, 0.06);
  border: 1px solid var(--cb-border);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--cb-text);
  font-size: 13.5px;
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.4;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  outline: none;
  transition: border-color 0.2s;
}

.cb-textarea::placeholder {
  color: var(--cb-text-muted);
}

.cb-textarea:focus {
  border-color: var(--cb-primary);
}

.cb-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--cb-primary) 0%, #c4960a 100%);
  color: var(--cb-bg-deep);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.cb-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(230, 177, 10, 0.3);
}

.cb-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.cb-send-btn svg {
  width: 18px;
  height: 18px;
}

/* ── Powered by ── */
.cb-powered {
  text-align: center;
  padding: 6px;
  font-size: 9px;
  color: rgba(245, 242, 235, 0.2);
  font-weight: 500;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .cb-container {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    transform: translateY(20px);
  }
  .cb-container.open {
    transform: translateY(0);
  }

  .cb-trigger {
    top: auto;
    bottom: 20px;
    right: 0;
    transform: none;
  }
  .cb-trigger:hover {
    transform: translateX(-4px);
  }
  .cb-trigger-tab {
    height: 56px;
    width: 48px;
  }
  .cb-trigger-icon span {
    display: none;
  }
}
