/* =========================================================
   MARKIA STUDIO — Estilos del bot cotizador (widget de chat)
   Usa las mismas variables de color del sitio (styles.css).
   ========================================================= */

/* ---------- Botón flotante para abrir el chat ----------
   Vive DENTRO del stack .float-buttons (junto a WhatsApp/Facebook),
   así el flex maneja el espaciado y NUNCA se encima. Hereda el
   tamaño redondo de 58px de .float-btn (styles.css). */
.cot-launcher {
  position: relative;        /* ancla para el tooltip */
  border: none;
  cursor: pointer;
  color: #0a0a0b;            /* ícono oscuro sobre el degradado */
  background: var(--grad);
  box-shadow: 0 12px 30px -6px rgba(34, 211, 238, .5);
  transition: transform .25s var(--ease);
}
.cot-launcher:hover { transform: scale(1.08); }
.cot-launcher svg { width: 26px; height: 26px; }

/* Etiqueta "Cotiza con IA" que aparece a la izquierda al pasar el cursor */
.cot-launcher-tip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  white-space: nowrap;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border-2);
  padding: 7px 12px;
  border-radius: 999px;
  font-family: "Sora", sans-serif;
  font-weight: 600;
  font-size: .82rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.cot-launcher:hover .cot-launcher-tip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Respaldo: si no existiera el stack .float-buttons, el botón flota solo. */
.cot-launcher.cot-launcher-floating {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 95;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Transición suave del stack y, al abrir el chat, lo ocultamos para que
   los botones de WhatsApp/Facebook no se encimen con el panel. */
.float-buttons { transition: opacity .2s var(--ease), transform .2s var(--ease); }
body.cot-open .float-buttons {
  opacity: 0;
  pointer-events: none;
  transform: scale(.9);
}

/* ---------- Panel del chat ---------- */
.cot-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;            /* por encima del stack de botones flotantes (z-index 90) */
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.98);
  pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.cot-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }

/* Encabezado */
.cot-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}
.cot-head-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--grad);
  display: grid; place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.cot-head-info { flex: 1; min-width: 0; }
.cot-head-info strong { display: block; font-family: "Sora", sans-serif; font-size: 1rem; }
.cot-head-info span { font-size: .8rem; color: var(--muted); }
.cot-head-info span::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
  vertical-align: middle;
}
.cot-close {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: 22px; line-height: 1; padding: 4px 8px;
  border-radius: 8px; transition: background .2s, color .2s;
}
.cot-close:hover { background: var(--border); color: var(--text); }

/* Zona de mensajes */
.cot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.cot-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: .92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.cot-msg.bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.cot-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  color: #0a0a0b;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

/* Indicador "escribiendo..." */
.cot-typing { align-self: flex-start; display: flex; gap: 5px; padding: 12px 14px; }
.cot-typing span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
  animation: cot-bounce 1.2s infinite ease-in-out;
}
.cot-typing span:nth-child(2) { animation-delay: .2s; }
.cot-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes cot-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-6px); opacity: 1; } }

/* Tarjeta de cotización + botón a WhatsApp */
.cot-quote {
  align-self: stretch;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.cot-quote h5 {
  font-family: "Sora", sans-serif;
  font-size: .8rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 8px;
}
.cot-quote pre {
  font-family: "Inter", sans-serif;
  font-size: .9rem;
  white-space: pre-wrap;
  margin-bottom: 12px;
  color: var(--text);
}
.cot-wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px;
  border-radius: 999px;
  background: #25d366;
  color: #06270f;
  font-weight: 700;
  font-size: .92rem;
  transition: transform .2s var(--ease), filter .2s;
}
.cot-wa-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.cot-wa-btn svg { width: 18px; height: 18px; }

/* Entrada de texto */
.cot-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-3);
}
.cot-input-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 11px 16px;
  color: var(--text);
  font-family: "Inter", sans-serif;
  font-size: .92rem;
  outline: none;
  transition: border-color .2s;
}
.cot-input-row input:focus { border-color: var(--cyan); }
.cot-input-row input::placeholder { color: var(--muted-2); }
.cot-send {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border: none; border-radius: 50%;
  background: var(--grad);
  color: #0a0a0b;
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform .2s var(--ease);
}
.cot-send:hover:not(:disabled) { transform: scale(1.08); }
.cot-send:disabled { opacity: .5; cursor: not-allowed; }
.cot-send svg { width: 20px; height: 20px; }

.cot-disclaimer {
  font-size: .72rem;
  color: var(--muted-2);
  text-align: center;
  padding: 0 12px 10px;
  background: var(--bg-3);
}

@media (max-width: 480px) {
  .cot-launcher-tip { display: none; }     /* en móvil no hay hover; solo el ícono */
  .cot-panel { right: 16px; bottom: 16px; }
}
