/* =====================================================
   Chatbot Le Riad
   ===================================================== */

.bot-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-terracotta), var(--c-gold-deep));
  color: #fff;
  border: 0;
  cursor: pointer;
  z-index: 200;
  box-shadow: 0 12px 30px rgba(192,86,45,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s ease;
}
.bot-launcher:hover { transform: translateY(-3px) rotate(8deg); }
.bot-launcher-icon {
  font-size: 2rem;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.3);
  position: relative;
  z-index: 2;
}
.bot-launcher-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--c-terracotta);
  opacity: .5;
  animation: botPulse 2s infinite;
}
@keyframes botPulse {
  0% { transform: scale(1); opacity: .5; }
  100% { transform: scale(1.6); opacity: 0; }
}

.bot-window {
  position: fixed;
  right: 24px;
  bottom: 100px;
  width: min(390px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 140px));
  background: #fbf6ee;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(14,46,48,.3);
  z-index: 199;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(200,155,74,.25);
  transform: translateY(20px) scale(.96);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
}
.bot-window.open {
  display: flex;
  transform: translateY(0) scale(1);
  opacity: 1;
}

.bot-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--c-teal-deep), var(--c-teal));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--c-gold);
}
.bot-header-info { display: flex; align-items: center; gap: 12px; }
.bot-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--c-gold);
  color: var(--c-teal-deep);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
}
.bot-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.bot-sub {
  font-size: .72rem;
  opacity: .85;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
}
.bot-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4caf50;
  box-shadow: 0 0 8px #4caf50;
}
.bot-close {
  background: transparent; border: 0; color: #fff;
  font-size: 1.8rem; line-height: 1; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%;
  transition: background .2s;
}
.bot-close:hover { background: rgba(255,255,255,.15); }

.bot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background:
    radial-gradient(circle at 10% 20%, rgba(200,155,74,.05), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(192,86,45,.05), transparent 40%),
    #fbf6ee;
}
.bot-messages::-webkit-scrollbar { width: 6px; }
.bot-messages::-webkit-scrollbar-thumb { background: rgba(23,64,66,.2); border-radius: 3px; }

.bot-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: .92rem;
  line-height: 1.45;
  animation: botMsgIn .3s ease;
  word-wrap: break-word;
}
@keyframes botMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bot-msg.bot {
  background: #fff;
  color: var(--c-ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(14,46,48,.06);
}
.bot-msg.user {
  background: var(--c-teal);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.bot-msg strong { color: var(--c-gold-deep); }
.bot-msg.user strong { color: var(--c-gold); }

.bot-typing {
  display: inline-flex; gap: 4px; padding: 4px 0;
}
.bot-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--c-ink-soft);
  animation: typing 1.2s infinite;
}
.bot-typing span:nth-child(2) { animation-delay: .15s; }
.bot-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Input area & choices */
.bot-input {
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid rgba(23,64,66,.1);
  min-height: 60px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  max-height: 240px;
  overflow-y: auto;
}
.bot-choice {
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--c-bg-alt);
  color: var(--c-teal);
  border: 1.5px solid rgba(23,64,66,.15);
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.bot-choice:hover {
  background: var(--c-teal);
  color: var(--c-gold);
  border-color: var(--c-teal);
}
.bot-choice.primary {
  background: var(--c-terracotta);
  color: #fff;
  border-color: var(--c-terracotta);
}
.bot-choice.primary:hover { background: var(--c-gold-deep); border-color: var(--c-gold-deep); }
.bot-choice.disabled {
  opacity: .5; cursor: not-allowed; pointer-events: none;
  text-decoration: line-through;
}
.bot-choice small {
  display: block;
  font-size: .65rem;
  opacity: .75;
  margin-top: 1px;
  text-decoration: none !important;
}

.bot-field {
  width: 100%;
  display: flex;
  gap: 8px;
}
.bot-field input,
.bot-field textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid rgba(23,64,66,.15);
  border-radius: 22px;
  font: inherit;
  font-size: .9rem;
  background: var(--c-bg);
  color: var(--c-ink);
  outline: none;
  transition: border-color .2s;
}
.bot-field input:focus, .bot-field textarea:focus {
  border-color: var(--c-gold);
}
.bot-field button {
  padding: 10px 18px;
  border: 0;
  border-radius: 22px;
  background: var(--c-terracotta);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.bot-field button:hover { background: var(--c-gold-deep); }

/* Cart items inside bot */
.bot-cart {
  width: 100%;
  background: var(--c-bg-alt);
  border-radius: 12px;
  padding: 12px;
  font-size: .85rem;
}
.bot-cart-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(23,64,66,.15);
}
.bot-cart-row:last-child { border-bottom: 0; }
.bot-cart-total {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid var(--c-gold);
  font-weight: 700;
  color: var(--c-terracotta);
}
.bot-cart .muted { color: var(--c-ink-soft); font-size: .78rem; }

@media (max-width: 480px) {
  .bot-window {
    right: 8px; left: 8px; bottom: 84px;
    width: auto;
    height: min(calc(100vh - 110px), 620px);
  }
  .bot-launcher { right: 16px; bottom: 16px; }
}
