:root {
  --color-principal: #6C5CE7;
}

/* =====================================================
   ASISTENTE.CSS – GUÍA MIPLAN (Chatbot IA)
   ===================================================== */

/* ---------- OVERLAY PRINCIPAL ---------- */
.asistente-overlay {
  position: fixed; top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(45, 42, 62, 0.6);
  backdrop-filter: blur(8px);
  z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeInOverlay 0.3s ease;
}
@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- MODAL PRINCIPAL ---------- */
.asistente-modal {
  background: white;
  border-radius: 28px;
  width: 100%; max-width: 480px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 25px 80px rgba(0,0,0,0.25), 0 10px 30px color-mix(in srgb, var(--color-principal, #6C5CE7) 15%, transparent);
  overflow: hidden;
  animation: slideUpModal 0.4s cubic-bezier(0.4,0,0.2,1);
}
@keyframes slideUpModal {
  from { transform: translateY(60px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---------- CABECERA ---------- */
.asistente-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  background: linear-gradient(135deg, var(--color-principal, #6C5CE7), color-mix(in srgb, var(--color-principal, #6C5CE7) 60%, white));
  color: white;
  flex-shrink: 0;
}
.asistente-header-left {
  display: flex; align-items: center; gap: 14px;
}
.asistente-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--color-principal, #6C5CE7) 70%, #4A90D9), var(--color-principal, #6C5CE7));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  border: 2px solid rgba(255,255,255,0.3);
}
.asistente-header-info { display: flex; flex-direction: column; }
.asistente-titulo {
  font-size: 1.1rem; font-weight: 800;
  letter-spacing: 1px; margin: 0;
}
.asistente-status {
  font-size: 0.75rem; font-weight: 600;
  color: #7FF0C0; display: flex; align-items: center; gap: 4px;
}
.asistente-header-right {
  display: flex; align-items: center; gap: 10px;
}
.asistente-btn-header {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.2); color: white;
  font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.asistente-btn-header:hover {
  background: rgba(255,255,255,0.35); transform: scale(1.1);
}
.asistente-btn-cerrar:hover {
  background: rgba(231,76,60,0.8);
}

/* ---------- ÁREA DE MENSAJES ---------- */
.asistente-messages {
  flex: 1; overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  background: #FAFAFA;
}
.asistente-messages::-webkit-scrollbar { width: 4px; }
.asistente-messages::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--color-principal, #6C5CE7) 20%, white); border-radius: 4px; }

.asistente-msg { display: flex; animation: chatPop 0.3s cubic-bezier(0.4,0,0.2,1); }
.asistente-msg.bot { justify-content: flex-start; }
.asistente-msg.user { justify-content: flex-end; }

.asistente-bubble {
  max-width: 80%; padding: 14px 18px; border-radius: 20px;
  font-size: 0.9rem; line-height: 1.5; word-break: break-word;
}
.asistente-msg.bot .asistente-bubble {
  background: #F0F2F5; color: #2D2A3E;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.asistente-msg.user .asistente-bubble {
  background: linear-gradient(135deg, var(--color-principal, #6C5CE7), color-mix(in srgb, var(--color-principal, #6C5CE7) 60%, white));
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--color-principal, #6C5CE7) 25%, transparent);
}
@keyframes chatPop {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- PANEL DE ACCIONES RÁPIDAS ---------- */
.asistente-acciones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #F0F0F0;
  flex-shrink: 0;
}
.asistente-accion-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 14px;
  border: 1.5px solid color-mix(in srgb, var(--color-principal, #6C5CE7) 15%, white);
  background: color-mix(in srgb, var(--color-principal, #6C5CE7) 5%, white); cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  text-align: left;
}
.asistente-accion-btn:hover {
  background: color-mix(in srgb, var(--color-principal, #6C5CE7) 12%, white); border-color: var(--color-principal, #6C5CE7);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--color-principal, #6C5CE7) 15%, transparent);
}
.asistente-accion-icon { font-size: 1.4rem; flex-shrink: 0; }
.asistente-accion-label {
  font-size: 0.8rem; font-weight: 600; color: var(--color-principal, #4A3A6A);
}

/* ---------- BARRA DE ENTRADA ---------- */
.asistente-inputbox {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  background: white;
  border-top: 1px solid #F0F0F0;
  flex-shrink: 0;
}
.asistente-mic-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: #F0F2F5; color: var(--color-principal, #6C5CE7);
  font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0;
}
.asistente-mic-btn:hover { background: color-mix(in srgb, var(--color-principal, #6C5CE7) 15%, white); transform: scale(1.08); }
.asistente-mic-btn.escuchando {
  background: #e74c3c; color: white;
  animation: pulseMic 1.5s infinite;
}
@keyframes pulseMic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231,76,60,0.4); }
  50% { box-shadow: 0 0 0 10px rgba(231,76,60,0); }
}

.asistente-inputbox input {
  flex: 1; padding: 12px 18px; border-radius: 24px;
  border: 2px solid color-mix(in srgb, var(--color-principal, #6C5CE7) 20%, white); background: #FAFAFA;
  font-size: 0.9rem; outline: none; color: #2D2A3E;
  transition: all 0.2s;
}
.asistente-inputbox input:focus {
  border-color: var(--color-principal, #6C5CE7); background: white;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-principal, #6C5CE7) 10%, transparent);
}
.asistente-inputbox input::placeholder { color: #B0A0C0; }

.asistente-send-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--color-principal, #6C5CE7), color-mix(in srgb, var(--color-principal, #6C5CE7) 60%, white));
  color: white; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--color-principal, #6C5CE7) 30%, transparent);
}
.asistente-send-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--color-principal, #6C5CE7) 40%, transparent);
}

/* ---------- PIE DE PÁGINA ---------- */
.asistente-footer {
  text-align: center; font-size: 0.6rem;
  color: #B0A0C0; letter-spacing: 1.5px;
  padding: 8px; background: white;
  font-weight: 600; text-transform: uppercase;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 520px) {
  .asistente-overlay { padding: 10px; align-items: flex-end; }
  .asistente-modal {
    max-width: 100%; max-height: 92vh;
    border-radius: 24px 24px 0 0;
    animation: slideUpMobile 0.35s cubic-bezier(0.4,0,0.2,1);
  }
  @keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .asistente-header { padding: 14px 16px; }
  .asistente-avatar { width: 38px; height: 38px; font-size: 1.4rem; }
  .asistente-titulo { font-size: 1rem; }
  .asistente-messages { padding: 14px; gap: 10px; }
  .asistente-bubble { max-width: 85%; padding: 12px 14px; font-size: 0.85rem; }
  .asistente-acciones { padding: 12px 14px; gap: 8px; }
  .asistente-accion-btn { padding: 10px 12px; }
  .asistente-accion-icon { font-size: 1.2rem; }
  .asistente-accion-label { font-size: 0.75rem; }
  .asistente-inputbox { padding: 10px 14px; }
  .asistente-mic-btn, .asistente-send-btn { width: 40px; height: 40px; }
}

@media (max-width: 360px) {
  .asistente-acciones { grid-template-columns: 1fr; }
  .asistente-titulo { font-size: 0.9rem; letter-spacing: 0.5px; }
  .asistente-bubble { max-width: 90%; font-size: 0.8rem; }
}