/* ═══════════════════════════════════════════════════════════
   AGRIYA AI PLANNER — Chat Widget Styles
   Brand: #E05A38 Terracotta | Dark: #1C1C1C
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --aai-brand:      #E05A38;
  --aai-brand-dk:   #C04828;
  --aai-brand-lt:   #F07050;
  --aai-brand-pale: #FDF1ED;
  --aai-dark:       #1C1C1C;
  --aai-dark2:      #2E2E2E;
  --aai-text:       #3A3A3A;
  --aai-text-lt:    #8A8A8A;
  --aai-border:     #E8E4DF;
  --aai-cream:      #FAF8F5;
  --aai-white:      #FFFFFF;
  --aai-radius:     16px;
  --aai-shadow:     0 20px 60px rgba(0,0,0,0.18);
  --aai-font:       'DM Sans', sans-serif;
}

/* ── WIDGET WRAPPER ── */
.agriya-ai-widget {
  font-family: var(--aai-font);
  border-radius: var(--aai-radius);
  overflow: hidden;
  background: var(--aai-white);
  box-shadow: var(--aai-shadow);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── HEADER ── */
.aai-head {
  background: linear-gradient(135deg, var(--aai-dark) 0%, var(--aai-dark2) 60%, #3a1e14 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.aai-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--aai-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(224,90,56,0.4);
  position: relative;
}
.aai-avatar::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #4CAF50;
  border-radius: 50%;
  border: 2px solid var(--aai-dark);
}
.aai-head-text { flex: 1; min-width: 0; }
.aai-name {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aai-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}
.aai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4CAF50;
  animation: aaiPulse 2s infinite;
  flex-shrink: 0;
}
@keyframes aaiPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}
.aai-head-actions { margin-left: auto; }
.aai-clear-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.55);
  border-radius: 7px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-family: var(--aai-font);
}
.aai-clear-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ── MESSAGES AREA ── */
.aai-msgs {
  padding: 16px;
  background: var(--aai-cream);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  scroll-behavior: smooth;
}
.aai-msgs::-webkit-scrollbar { width: 4px; }
.aai-msgs::-webkit-scrollbar-track { background: transparent; }
.aai-msgs::-webkit-scrollbar-thumb { background: var(--aai-border); border-radius: 10px; }

/* ── CHAT BUBBLES ── */
.aai-bubble {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: aaiFadeUp 0.3s ease;
}
@keyframes aaiFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.aai-bubble-content {
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
}
.aai-bot {
  align-self: flex-start;
}
.aai-bot .aai-bubble-content {
  background: var(--aai-white);
  border: 1px solid var(--aai-border);
  border-radius: 4px 14px 14px 14px;
  color: var(--aai-text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.aai-user {
  align-self: flex-end;
}
.aai-user .aai-bubble-content {
  background: var(--aai-brand);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}

/* ── TYPING INDICATOR ── */
.aai-typing {
  align-self: flex-start;
  background: var(--aai-white);
  border: 1px solid var(--aai-border);
  border-radius: 4px 14px 14px 14px;
  padding: 13px 18px;
  display: flex;
  gap: 4px;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  margin: 0 16px 4px;
}
.aai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--aai-brand);
  display: inline-block;
  animation: aaiDot 1.4s infinite;
}
.aai-typing span:nth-child(2) { animation-delay: 0.2s; }
.aai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aaiDot {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* ── QUICK CHIPS ── */
.aai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid var(--aai-border);
  background: var(--aai-white);
}
.aai-chip {
  background: var(--aai-brand-pale);
  border: 1px solid rgba(224,90,56,0.2);
  border-radius: 40px;
  padding: 5px 13px;
  font-size: 12px;
  color: #C04828;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--aai-font);
  font-weight: 500;
}
.aai-chip:hover {
  background: var(--aai-brand);
  color: #fff;
  border-color: var(--aai-brand);
  transform: translateY(-1px);
}

/* ── INPUT ROW ── */
.aai-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--aai-border);
  background: var(--aai-white);
}
.aai-input {
  flex: 1;
  border: 1.5px solid var(--aai-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: var(--aai-font);
  outline: none;
  transition: border-color 0.2s;
  background: var(--aai-cream);
  color: var(--aai-text);
}
.aai-input:focus { border-color: var(--aai-brand); background: #fff; }
.aai-input::placeholder { color: var(--aai-text-lt); }
.aai-send-btn {
  width: 40px;
  height: 40px;
  background: var(--aai-brand);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all 0.2s;
  flex-shrink: 0;
}
.aai-send-btn:hover { background: var(--aai-brand-dk); transform: translateY(-1px); }
.aai-send-btn:disabled { background: #ccc; transform: none; cursor: not-allowed; }

/* ── ACTION BAR ── */
.aai-action-bar {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--aai-border);
  background: var(--aai-cream);
}
.aai-action-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s;
  font-family: var(--aai-font);
}
.aai-btn-quote {
  background: var(--aai-brand);
  color: #fff;
}
.aai-btn-quote:hover { background: var(--aai-brand-dk); color: #fff; }
.aai-btn-call {
  background: var(--aai-white);
  color: var(--aai-dark);
  border: 1.5px solid var(--aai-border);
}
.aai-btn-call:hover { border-color: var(--aai-brand); color: var(--aai-brand); }

/* ══════════════════════════════════════════════
   FLOATING BUBBLE
   ══════════════════════════════════════════════ */
.agriya-ai-bubble-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99999;
  font-family: var(--aai-font);
}
.agriya-ai-bubble-trigger {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--aai-brand), var(--aai-brand-lt));
  box-shadow: 0 8px 28px rgba(224,90,56,0.45), 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all 0.28s cubic-bezier(.175,.885,.32,1.275);
  position: relative;
  z-index: 2;
}
.agriya-ai-bubble-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 36px rgba(224,90,56,0.55);
}
.aai-bubble-icon, .aai-bubble-close {
  position: absolute;
  transition: all 0.25s;
}
.aai-bubble-icon { opacity: 1; transform: scale(1) rotate(0deg); }
.aai-bubble-close { opacity: 0; transform: scale(0.6) rotate(-90deg); font-size: 20px; font-weight: 700; }
.agriya-ai-bubble-container.open .aai-bubble-icon { opacity: 0; transform: scale(0.6) rotate(90deg); }
.agriya-ai-bubble-container.open .aai-bubble-close { opacity: 1; transform: scale(1) rotate(0deg); }

.aai-bubble-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #f44336;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  border: 2px solid #fff;
  animation: aaiBounce 1s ease 2s both;
}
@keyframes aaiBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}
.agriya-ai-bubble-container.open .aai-bubble-badge { display: none; }

.aai-bubble-tooltip {
  position: absolute;
  right: 72px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--aai-dark);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.aai-bubble-tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: var(--aai-dark);
  border-right: none;
}
.agriya-ai-bubble-trigger:hover ~ .aai-bubble-tooltip { opacity: 1; }

.agriya-ai-bubble-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 360px;
  border-radius: var(--aai-radius);
  overflow: hidden;
  box-shadow: var(--aai-shadow);
  transform-origin: bottom right;
  animation: aaiPanelOpen 0.28s cubic-bezier(.175,.885,.32,1.275);
}
@keyframes aaiPanelOpen {
  from { opacity: 0; transform: scale(0.85) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@media(max-width:480px) {
  .agriya-ai-bubble-panel {
    width: calc(100vw - 24px);
    right: -14px;
  }
  .agriya-ai-bubble-container { bottom: 16px; right: 16px; }
}
