/* =============================================
   Essons AI Concierge - Chat Widget Styles
   ============================================= */

:root {
  --eac-primary: #1a1a2e;
  --eac-primary-light: #16213e;
  --eac-accent: #e94560;
  --eac-accent-hover: #d63851;
  --eac-bg: #ffffff;
  --eac-bg-alt: #f8f9fa;
  --eac-text: #1a1a2e;
  --eac-text-light: #6c757d;
  --eac-border: #e9ecef;
  --eac-bot-bg: #f0f2f5;
  --eac-user-bg: #1a1a2e;
  --eac-user-text: #ffffff;
  --eac-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  --eac-radius: 16px;
  --eac-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Floating Bubble */
.eac-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--eac-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(26, 26, 46, 0.4);
  transition: transform var(--eac-transition), box-shadow var(--eac-transition);
  z-index: 999998;
  outline: none;
}

.eac-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(26, 26, 46, 0.5);
}

.eac-bubble:active {
  transform: scale(0.95);
}

.eac-bubble-icon {
  width: 28px;
  height: 28px;
  transition: opacity var(--eac-transition), transform var(--eac-transition);
}

.eac-bubble.active .eac-icon-chat { display: none; }
.eac-bubble.active .eac-icon-close { display: block; }

/* Pulse animation */
.eac-bubble-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--eac-accent);
  opacity: 0;
  animation: eac-pulse 3s ease-in-out infinite;
  pointer-events: none;
}

.eac-bubble.active .eac-bubble-pulse { display: none; }

@keyframes eac-pulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(1.4); }
}

/* Chat Panel */
.eac-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-height: 600px;
  height: calc(100vh - 140px);
  background: var(--eac-bg);
  border-radius: var(--eac-radius);
  box-shadow: var(--eac-shadow);
  display: flex;
  flex-direction: column;
  z-index: 999997;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: opacity var(--eac-transition), transform var(--eac-transition);
}

.eac-panel.eac-panel-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Header */
.eac-panel-header {
  background: var(--eac-primary);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.eac-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.eac-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--eac-accent);
}

.eac-header-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.eac-header-status {
  font-size: 11px;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 4px;
}

.eac-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2ecc71;
  display: inline-block;
}

.eac-header-actions { display: flex; gap: 4px; }

.eac-header-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background var(--eac-transition);
  display: flex;
  align-items: center;
}

.eac-header-btn:hover { background: rgba(255,255,255,0.2); }

/* Messages */
.eac-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.eac-messages::-webkit-scrollbar { width: 4px; }
.eac-messages::-webkit-scrollbar-track { background: transparent; }
.eac-messages::-webkit-scrollbar-thumb { background: var(--eac-border); border-radius: 4px; }

.eac-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  animation: eac-fadeIn 0.3s ease;
  word-wrap: break-word;
}

@keyframes eac-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.eac-msg-user {
  background: var(--eac-user-bg);
  color: var(--eac-user-text);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.eac-msg-bot a {
  color: var(--eac-accent);
  text-decoration: underline;
}

.eac-msg-bot strong { font-weight: 600; }

.eac-msg-bot ul {
  margin: 6px 0;
  padding-left: 18px;
}

.eac-msg-bot li {
  margin-bottom: 3px;
}

/* Typing indicator */
.eac-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}

.eac-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--eac-text-light);
  animation: eac-typing 1.4s ease-in-out infinite;
}

.eac-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.eac-typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Inline action buttons in bot messages */
.eac-action-btn {
  display: inline-block;
  margin: 4px 4px 4px 0;
  padding: 6px 14px;
  background: var(--eac-primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--eac-transition);
  text-decoration: none;
}

.eac-action-btn:hover {
  background: var(--eac-accent);
  color: #fff;
}

/* Suggested Prompts */
.eac-prompts {
  padding: 8px 16px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  border-top: 1px solid var(--eac-border);
}

.eac-prompt-btn {
  padding: 6px 12px;
  background: var(--eac-bg-alt);
  border: 1px solid var(--eac-border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--eac-text);
  cursor: pointer;
  transition: all var(--eac-transition);
  white-space: nowrap;
}

.eac-prompt-btn:hover {
  background: var(--eac-primary);
  color: #fff;
  border-color: var(--eac-primary);
}

/* Input Area */
.eac-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--eac-border);
  flex-shrink: 0;
}

.eac-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--eac-bg-alt);
  border: 1px solid var(--eac-border);
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
  transition: border-color var(--eac-transition);
}

.eac-input-wrapper:focus-within {
  border-color: var(--eac-primary);
}

.eac-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13.5px;
  line-height: 1.4;
  resize: none;
  outline: none;
  max-height: 80px;
  padding: 8px 0;
  font-family: inherit;
  color: var(--eac-text);
}

.eac-input::placeholder {
  color: var(--eac-text-light);
}

.eac-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--eac-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--eac-transition), transform var(--eac-transition);
}

.eac-send-btn:hover {
  background: var(--eac-accent);
  transform: scale(1.05);
}

.eac-input-footer {
  text-align: center;
  padding-top: 6px;
}

.eac-powered {
  font-size: 10px;
  color: var(--eac-text-light);
  opacity: 0.5;
}

/* Lead capture form inside chat */
.eac-lead-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  background: var(--eac-bg-alt);
  border-radius: 10px;
}

.eac-lead-form input {
  padding: 8px 12px;
  border: 1px solid var(--eac-border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.eac-lead-form input:focus {
  border-color: var(--eac-primary);
}

.eac-lead-form button {
  padding: 8px 16px;
  background: var(--eac-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background var(--eac-transition);
}

.eac-lead-form button:hover {
  background: var(--eac-accent);
}

/* Price estimate card in chat */
.eac-estimate-card {
  background: var(--eac-bg);
  border: 1px solid var(--eac-border);
  border-radius: 10px;
  padding: 12px;
  margin-top: 6px;
}

.eac-estimate-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--eac-primary);
}

.eac-estimate-line {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  padding: 3px 0;
  border-bottom: 1px dotted var(--eac-border);
}

.eac-estimate-total {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 0 2px;
  color: var(--eac-primary);
}

.eac-estimate-disclaimer {
  font-size: 10.5px;
  color: var(--eac-text-light);
  margin-top: 6px;
  font-style: italic;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .eac-panel {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 76px;
    max-height: calc(100vh - 100px);
    height: calc(100vh - 100px);
    border-radius: 12px;
  }

  .eac-bubble {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
  }

  .eac-bubble-icon {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 360px) {
  .eac-panel {
    width: 100vw;
    right: 0;
    bottom: 0;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }

  .eac-bubble {
    bottom: 12px;
    right: 12px;
  }
}

/* Dark mode support (matches Nicex theme dark mode) */
[data-theme="dark"] .eac-panel {
  --eac-bg: #1e1e2f;
  --eac-bg-alt: #2a2a3d;
  --eac-text: #e0e0e0;
  --eac-text-light: #888;
  --eac-border: #3a3a4d;
  --eac-bot-bg: #2a2a3d;
  --eac-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .eac-input {
  color: #e0e0e0;
}

[data-theme="dark"] .eac-lead-form input {
  background: #2a2a3d;
  color: #e0e0e0;
  border-color: #3a3a4d;
}
