/* Classic Fruteria - AI Shopping Assistant Styles */
:root {
  --ai-gold: #d4af37;
  --ai-gold-glow: rgba(212, 175, 55, 0.35);
  --ai-emerald: #1e3f2d;
  --ai-emerald-deep: #102116;
}

/* Floating Action Button (FAB) */
.ai-fab-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #2a5238, var(--ai-emerald-deep));
  border: 2px solid var(--ai-gold);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6), 0 0 18px var(--ai-gold-glow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.22s ease;
  user-select: none;
}

.ai-fab-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.7), 0 0 24px rgba(212, 175, 55, 0.55);
}

.ai-fab-btn:active {
  transform: scale(0.96);
}

.ai-fab-logo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.ai-fab-pulse {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  background: #52c41a;
  border: 2px solid #14120f;
  border-radius: 50%;
  box-shadow: 0 0 8px #52c41a;
}

.ai-fab-tooltip {
  position: absolute;
  right: 68px;
  background: #1e1a14;
  color: #f7f2e9;
  border: 1px solid var(--ai-gold);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-fab-btn:hover .ai-fab-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* Chat Window Drawer */
.ai-chat-drawer {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 100;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: rgba(22, 19, 15, 0.96);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 35px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-chat-drawer.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(35, 30, 23, 0.95), rgba(22, 19, 15, 0.95));
  border-bottom: 1px solid var(--line);
}

.ai-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--ai-gold);
  object-fit: cover;
  background: #000;
}

.ai-header-info h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-header-status {
  font-size: 11px;
  color: #78c950;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-header-status::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #78c950;
  border-radius: 50%;
}

.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-btn-icon {
  background: transparent;
  border: 0;
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background 0.15s ease, color 0.15s ease;
}

.ai-btn-icon:hover {
  background: var(--panel2);
  color: var(--ink);
}

/* Messages container */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
}

.ai-messages::-webkit-scrollbar {
  width: 5px;
}
.ai-messages::-webkit-scrollbar-thumb {
  background: #393126;
  border-radius: 4px;
}

/* Welcome Card */
.ai-welcome-box {
  background: linear-gradient(145deg, #24201a, #1a1712);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.ai-welcome-logo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: 0 auto 10px;
  border: 2px solid var(--ai-gold);
  box-shadow: 0 0 14px var(--ai-gold-glow);
}

.ai-welcome-box h4 {
  margin: 0 0 6px;
  font-family: "Playfair Display", serif;
  font-size: 16px;
  color: var(--cream);
}

.ai-welcome-box p {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

/* Suggestion Chips */
.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.ai-chip {
  background: #2b251e;
  border: 1px solid #453c30;
  color: var(--ink);
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.ai-chip:hover {
  background: #393025;
  border-color: var(--ai-gold);
  color: #fff;
  transform: translateY(-1px);
}

/* Message Rows */
.ai-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  font-size: 13px;
  line-height: 1.45;
  animation: aiFade 0.22s ease;
}

@keyframes aiFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-msg-assistant {
  align-self: flex-start;
}

.ai-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--ai-gold);
}

.ai-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  position: relative;
  word-break: break-word;
}

.ai-msg-user .ai-bubble {
  background: linear-gradient(135deg, #486127, #324719);
  color: #ffffff;
  border-bottom-right-radius: 3px;
  border: 1px solid #6b8c3d;
}

.ai-msg-assistant .ai-bubble {
  background: var(--panel2);
  color: var(--ink);
  border: 1px solid #3c3429;
  border-bottom-left-radius: 3px;
}

.ai-bubble p {
  margin: 0 0 6px;
}
.ai-bubble p:last-child {
  margin-bottom: 0;
}

.ai-bubble ul, .ai-bubble ol {
  margin: 4px 0;
  padding-left: 18px;
}

.ai-bubble strong {
  color: var(--cream);
}

.ai-typewriter-active::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 3px;
  vertical-align: -0.12em;
  background: var(--lime);
  animation: aiCursorBlink 0.65s steps(1) infinite;
}

@keyframes aiCursorBlink {
  50% { opacity: 0; }
}

/* Action Cards & Badges */
.ai-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(185, 217, 109, 0.15);
  border: 1px solid var(--lime);
  color: var(--lime);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  margin-top: 8px;
}

.ai-product-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1f1a14;
  border: 1px solid #42382c;
  border-radius: 10px;
  padding: 8px 10px;
  margin-top: 8px;
  transition: border-color 0.15s ease;
}

.ai-product-card:hover {
  border-color: var(--lime);
}

.ai-product-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: #eee7d7;
  border-radius: 6px;
  flex-shrink: 0;
}

.ai-product-meta {
  flex: 1;
  min-width: 0;
}

.ai-product-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.ai-product-price {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.ai-product-price b {
  color: var(--lime);
}

.ai-product-btns {
  display: flex;
  gap: 4px;
}

.ai-btn-add {
  background: var(--lime);
  color: #16200f;
  border: 0;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.ai-btn-add:hover {
  background: #cbf07c;
}

.ai-btn-view {
  background: transparent;
  color: var(--muted);
  border: 1px solid #4a4034;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11px;
  cursor: pointer;
}

.ai-btn-view:hover {
  color: var(--ink);
  border-color: var(--cream);
}

/* Typing Indicator */
.ai-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
}

.ai-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--muted);
  border-radius: 50%;
  animation: aiBounce 1.2s infinite ease-in-out;
}

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

@keyframes aiBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; background: var(--lime); }
}

/* Input Area */
.ai-input-area {
  padding: 12px 14px;
  background: #181511;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-input {
  flex: 1;
  background: #252019;
  border: 1px solid #463b2e;
  border-radius: 12px;
  color: var(--ink);
  padding: 10px 14px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-input:focus {
  border-color: var(--ai-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.ai-send-btn {
  background: linear-gradient(135deg, var(--lime), #9dc44a);
  color: #16200f;
  border: 0;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  flex-shrink: 0;
}

.ai-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
}

.ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-footer-note {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
}

/* Mobile Responsiveness */
@media (max-width: 760px) {
  .ai-fab-btn {
    bottom: 82px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
  .ai-chat-drawer {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 145px;
    height: calc(100vh - 180px);
    max-height: 540px;
    background: #16130f;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
