/* ══════════════════════════════════════════════════════
   GELATO ASSISTANT — AI Chat Panel
   Integrated support & guide for users and heladeros
══════════════════════════════════════════════════════ */

/* ── Floating trigger button ── */
.ga-fab{
  position:fixed;bottom:24px;left:280px;z-index:8000;
  width:56px;height:56px;border-radius:50%;border:none;cursor:pointer;
  background:linear-gradient(135deg,var(--navy) 0%,var(--navy2) 100%);
  box-shadow:0 4px 20px rgba(11,31,56,.35),0 0 0 0 var(--color-accent-a40);
  display:flex;align-items:center;justify-content:center;
  transition:all .3s cubic-bezier(.4,0,.2,1);
  animation:gaFabPulse 3s ease-in-out infinite;
}
.ga-fab:hover{
  transform:scale(1.08);
  box-shadow:0 6px 28px rgba(11,31,56,.45),0 0 0 6px var(--color-accent-a15);
}
.ga-fab.open{animation:none;transform:rotate(0deg)}
.ga-fab svg{width:26px;height:26px;fill:none;stroke:var(--color-white);stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.ga-fab .ga-close{display:none}
.ga-fab.open .ga-open{display:none}
.ga-fab.open .ga-close{display:block}
@keyframes gaFabPulse{
  0%,100%{box-shadow:0 4px 20px rgba(11,31,56,.35),0 0 0 0 var(--color-accent-a40)}
  50%{box-shadow:0 4px 20px rgba(11,31,56,.35),0 0 0 8px transparent}
}
/* Badge de bienvenida */
.ga-badge{
  position:absolute;top:-4px;right:-4px;width:14px;height:14px;border-radius:50%;
  background:var(--teal);border:2px solid var(--color-white);
  animation:gaBadgePop .4s cubic-bezier(.34,1.56,.64,1) forwards;
}
.ga-fab.open .ga-badge{display:none}
@keyframes gaBadgePop{from{transform:scale(0)}to{transform:scale(1)}}

/* ── Chat panel ── */
.ga-panel{
  position:fixed;bottom:92px;left:280px;z-index:8001;
  width:380px;max-height:560px;
  background:var(--color-white);border-radius:20px;
  box-shadow:0 20px 60px rgba(11,31,56,.18),0 0 0 1px rgba(0,0,0,.04);
  display:flex;flex-direction:column;
  transform:scale(.9) translateY(20px);opacity:0;pointer-events:none;
  transition:all .3s cubic-bezier(.4,0,.2,1);
  overflow:hidden;
}
.ga-panel.open{
  transform:scale(1) translateY(0);opacity:1;pointer-events:auto;
}

/* ── Header ── */
.ga-header{
  background:linear-gradient(135deg,var(--navy) 0%,var(--navy2) 100%);
  padding:18px 20px;display:flex;align-items:center;gap:12px;
  flex-shrink:0;
}
.ga-avatar{
  width:40px;height:40px;border-radius:12px;
  background:rgba(255,255,255,.1);display:flex;align-items:center;justify-content:center;
  flex-shrink:0;font-size:22px;
}
.ga-header-text{flex:1}
.ga-header-title{font-size:14px;font-weight:600;color:var(--color-white);letter-spacing:.3px}
.ga-header-sub{font-size:11px;color:rgba(255,255,255,.45);margin-top:1px}
.ga-header-dot{width:7px;height:7px;border-radius:50%;background:var(--color-emerald);flex-shrink:0;
  box-shadow:0 0 6px var(--color-emerald-a50)}

/* ── Quick actions (suggestions) ── */
.ga-quick{
  padding:12px 16px 4px;display:flex;flex-wrap:wrap;gap:6px;flex-shrink:0;
  border-bottom:1px solid rgba(0,0,0,.04);
}
.ga-chip{
  font-size:11px;padding:6px 12px;border-radius:20px;border:1px solid var(--border);
  background:var(--cream);color:var(--navy);cursor:pointer;
  transition:all .2s ease;white-space:nowrap;
}
.ga-chip:hover{background:var(--teal-light);border-color:var(--teal);color:var(--teal2)}

/* ── Messages area ── */
.ga-messages{
  flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px;
  min-height:200px;max-height:340px;
  scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.1) transparent;
}
.ga-messages::-webkit-scrollbar{width:4px}
.ga-messages::-webkit-scrollbar-thumb{background:rgba(0,0,0,.1);border-radius:4px}

/* ── Message bubbles ── */
.ga-msg{display:flex;gap:8px;animation:gaMsgIn .3s ease forwards}
.ga-msg.user{flex-direction:row-reverse}
@keyframes gaMsgIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}

.ga-msg-bubble{
  max-width:82%;padding:10px 14px;border-radius:16px;
  font-size:13px;line-height:1.5;word-break:break-word;
}
.ga-msg.bot .ga-msg-bubble{
  background:var(--smoke);color:var(--navy);border-bottom-left-radius:4px;
}
.ga-msg.user .ga-msg-bubble{
  background:var(--navy);color:var(--color-white);border-bottom-right-radius:4px;
}
.ga-msg-bubble a{color:var(--teal);text-decoration:underline}
.ga-msg-bubble strong{font-weight:600}
.ga-msg-bubble code{background:rgba(0,0,0,.06);padding:1px 5px;border-radius:4px;font-size:12px}

/* ── Typing indicator ── */
.ga-typing{display:flex;gap:4px;align-items:center;padding:10px 14px;
  background:var(--smoke);border-radius:16px;border-bottom-left-radius:4px;width:fit-content}
.ga-typing-dot{width:6px;height:6px;border-radius:50%;background:var(--mid);
  animation:gaTyping 1.2s ease-in-out infinite}
.ga-typing-dot:nth-child(2){animation-delay:.2s}
.ga-typing-dot:nth-child(3){animation-delay:.4s}
@keyframes gaTyping{0%,100%{opacity:.3;transform:translateY(0)}50%{opacity:1;transform:translateY(-4px)}}

/* ── Input area ── */
.ga-input-wrap{
  padding:12px 16px;border-top:1px solid rgba(0,0,0,.06);
  display:flex;gap:8px;align-items:flex-end;flex-shrink:0;
  background:var(--color-white);
}
.ga-input{
  flex:1;border:1px solid var(--border);border-radius:12px;padding:10px 14px;
  font-size:13px;font-family:inherit;resize:none;outline:none;
  min-height:40px;max-height:100px;line-height:1.4;
  transition:border-color .2s ease;background:var(--cream);
}
.ga-input:focus{border-color:var(--teal)}
.ga-input::placeholder{color:var(--mid)}
.ga-send{
  width:36px;height:36px;border-radius:10px;border:none;cursor:pointer;
  background:var(--teal);color:var(--color-white);display:flex;align-items:center;justify-content:center;
  transition:all .2s ease;flex-shrink:0;
}
.ga-send:hover{background:var(--teal2);transform:scale(1.05)}
.ga-send:disabled{opacity:.4;cursor:default;transform:none}
.ga-send svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}

/* ── Mic button (voice dictation) ── */
.ga-mic{
  width:36px;height:36px;border-radius:10px;border:none;cursor:pointer;
  background:var(--smoke);color:var(--gray);display:flex;align-items:center;justify-content:center;
  transition:all .2s ease;flex-shrink:0;
}
.ga-mic:hover{background:var(--border);color:var(--navy)}
.ga-mic.active{
  background:var(--color-error);color:var(--color-white);
  animation:gaMicPulse 1.2s ease-in-out infinite;
}
@keyframes gaMicPulse{
  0%,100%{box-shadow:0 0 0 0 var(--color-error-a40)}
  50%{box-shadow:0 0 0 8px transparent}
}

/* ── TTS speaker button inside bot messages ── */
.ga-tts-btn{
  display:inline-flex;align-items:center;justify-content:center;
  width:22px;height:22px;border-radius:6px;border:none;cursor:pointer;
  background:transparent;color:var(--mid);float:right;margin:-2px -4px 0 8px;
  transition:all .2s ease;opacity:.5;
}
.ga-tts-btn:hover{opacity:1;color:var(--teal);background:var(--color-accent-a08)}
.ga-tts-btn.speaking{opacity:1;color:var(--teal);animation:gaTtsPulse 1s ease-in-out infinite}
@keyframes gaTtsPulse{0%,100%{opacity:1}50%{opacity:.4}}

/* ── Footer ── */
.ga-footer{
  padding:6px 16px 10px;text-align:center;font-size:11px;color:var(--mid);
  letter-spacing:.5px;flex-shrink:0;
}

/* ── Markdown-lite in bot messages ── */
.ga-msg.bot .ga-msg-bubble ul{margin:6px 0;padding-left:16px}
.ga-msg.bot .ga-msg-bubble li{margin:2px 0}
.ga-msg.bot .ga-msg-bubble p{margin:4px 0}
.ga-msg.bot .ga-msg-bubble p:first-child{margin-top:0}

/* ── Mobile responsive ── */
@media(max-width:480px){
  .ga-panel{width:calc(100vw - 16px);left:8px;right:auto;bottom:72px;max-height:60vh;border-radius:16px}
  .ga-fab{bottom:16px;left:16px;right:auto;width:50px;height:50px}
}
