/* ============ Mobile-first colorful light theme (Google-like vibes) ============ */
:root{
  --bg: linear-gradient(180deg, #f6f8fc 0%, #eef2ff 100%);
  --panel:#ffffff;
  --panel-2:#f8fbff;
  --text:#1f1f1f;
  --muted:#5f6368;
  --border:#e6e9f2;
  --accent:#1a73e8;       /* azul Google-like */
  --accent-2:#34a853;     /* verde */
  --accent-3:#a142f4;     /* violeta */
  --error:#d93025;
  --radius:16px;
  --shadow:0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.08);
  --ring:0 0 0 3px rgba(26,115,232,.18);
  --ring-error:0 0 0 3px rgba(217,48,37,.18);
}

*{box-sizing:border-box}
html,body{
  min-height:100svh; margin:0;
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji";
  background:var(--bg); color:var(--text);
}
img{max-width:100%; display:block}
a{color:var(--accent); text-decoration:none}

/* Containers */
.wa-login-card,
.wa-assistant-wrap{
  width:100%;
  max-width:900px;
  margin:clamp(12px, 3vw, 24px) auto;
  padding:clamp(16px, 3vw, 24px);
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

/* ================= Header / Brand ================= */
/* (La vieja .wa-avatar puede quedar si la usas en otras vistas) */
.wa-avatar{
  width:56px; height:56px; border-radius:50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 0 0 6px rgba(26,115,232,.08), 0 8px 16px rgba(26,115,232,.12), inset 0 0 24px rgba(26,115,232,.15);
}
.wa-avatar.is-pulsing{ animation: waPulse 1.6s infinite ease-in-out; }
@keyframes waPulse{ 0%{transform:scale(1)} 50%{transform:scale(1.06)} 100%{transform:scale(1)} }
@media (prefers-reduced-motion: reduce){ .wa-avatar.is-pulsing{ animation:none } }

/* NUEVO: Logo de marca en el login */
.wa-brand{
  display:block; margin:0 auto 8px auto; text-align:center;
}
.wa-brand img{
  height:40px; width:auto; border-radius:8px; /* quita el radius si no lo necesitas */
}

/* NUEVO: Mascota (profesor) en el asistente */
.wa-mascot{
  display:block; flex:0 0 auto;
  width:56px; height:56px; border-radius:50%; overflow:hidden;
  box-shadow:0 1px 2px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.08);
}
.wa-mascot img{ width:100%; height:100%; object-fit:cover; }

/* Títulos consistentes */
.wa-title{ margin:6px 0 2px; font-weight:700; }

/* ================= Login ================= */
.wa-login-card{ max-width: 420px; }
.wa-login-card h2{
  margin: 8px 0 4px; font-size: 22px; text-align:center; font-weight: 600;
}
.wa-login-card > p{ color: var(--muted); text-align:center; margin: 0 0 12px; }

.wa-login-card form{ display:grid; gap:12px; margin-top:10px; }
.wa-login-card label{ font-size:.9rem; color:var(--muted); }

.wa-login-card input[type="tel"]{
  width:100%; height: 48px; padding: 0 14px; font-size: 16px;
  border: 1px solid var(--border); border-radius: 12px; outline: none; background: var(--panel-2);
}
.wa-login-card input[type="tel"]:focus{ border-color: var(--accent); box-shadow: var(--ring); }

.wa-login-card button{
  width:100%; height: 44px; margin-top: 4px;
  border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
  transition: transform .08s ease, box-shadow .2s ease, background .2s ease;
}
.wa-login-card button:hover{ transform:translateY(-1px); box-shadow:0 10px 20px rgba(26,115,232,.18); }
.wa-login-card button:disabled{ opacity:.7; cursor:not-allowed; }

.wa-links{ display:flex; justify-content:space-between; margin-top: 6px; }
.wa-links a{ font-size: 14px; }

.wa-hint{ margin-top: 6px; color: var(--muted); font-size: 12px; text-align:center; }
.wa-error{
  margin-top: 8px; color: var(--error);
  background:#fde8e6; border:1px solid #f3b1ab; padding:10px; border-radius:8px;
}

/* ================= Assistant Layout ================= */
.wa-assistant-wrap{
  display:grid; grid-template-rows:auto 1fr auto; gap:12px;
  min-height: calc(100svh - 24px);
}
.wa-header{
  display:flex; align-items:center; gap:12px;
  padding-bottom:8px; border-bottom:1px solid var(--border);
  flex-wrap:wrap; /* para que el botón baje en pantallas muy angostas */
}
.wa-header > div{ min-width: 0; } /* evita overflow de títulos */
.wa-sub{ margin:4px 0 0; color:var(--muted); font-size:.95rem; }

/* NUEVO: Botón limpiar historial (colocado en el header) */
.wa-clear{
  margin-left:auto; /* empuja el botón a la derecha */
  height:32px; padding:0 10px;
  border:1px solid var(--border); border-radius:10px;
  background:#fff; color:#1f1f1f; font-weight:600; cursor:pointer;
  transition:transform .08s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  line-height:32px;
}
.wa-clear:hover{ transform:translateY(-1px); box-shadow:0 6px 14px rgba(0,0,0,.06); }
.wa-clear:active{ transform:translateY(0); }
.wa-clear:focus-visible{ outline:none; box-shadow: var(--ring); border-color: var(--accent); }

/* Chat area */
.wa-chat{
  background:linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border:1px solid var(--border); border-radius:14px;
  padding:12px; overflow:auto; min-height:52svh; scroll-behavior:smooth;
}

/* Bubbles */
.wa-msg{ display:flex; gap:10px; margin:10px 0; }
.wa-msg.user{ justify-content:flex-end; }

.wa-bubble{
  max-width:86%; padding:12px 14px;
  border-radius:16px; border:1px solid var(--border);
  line-height:1.4; white-space:pre-wrap; word-wrap:break-word; background:#fff;
}
.wa-msg.user .wa-bubble{
  background: #e8f0fe; border-color: #d2e3fc; color:#0b3a63;
}
.wa-msg.bot .wa-bubble{
  background: #f4f8ff; border-color: rgba(26,115,232,.25);
}

.wa-typing{ font-size:.9rem; color:#1a73e8; opacity:.95; padding:2px 4px; }

/* Input row – sticky mobile */
.wa-input{
  position:sticky; bottom: max(0px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,.85) 40%, rgba(255,255,255,1) 80%);
  backdrop-filter: blur(8px);
  display:flex; gap:8px; align-items:center; padding-top:6px;
}
#wa-chat-input{
  flex:1; min-height: 44px; max-height: 140px; padding: 12px 14px; font-size:16px;
  border-radius:14px; border:1px solid var(--border); background:#fff; color:#text; outline:none;
}
#wa-chat-input::placeholder{ color:#90a4b8; }
#wa-chat-input:focus{ border-color: var(--accent); box-shadow: var(--ring); }

#wa-chat-form button{
  padding:12px 16px; border-radius:14px; border:0;
  background: var(--accent); color:#fff; font-weight:700; cursor:pointer;
  transition: transform .08s ease, box-shadow .2s ease;
  white-space:nowrap;
}
#wa-chat-form button:hover{ transform:translateY(-1px); box-shadow:0 10px 20px rgba(26,115,232,.18); }
#wa-chat-form button:active{ transform:translateY(0); }

/* Scrollbar sutil */
.wa-chat::-webkit-scrollbar{ width:8px; height:8px }
.wa-chat::-webkit-scrollbar-thumb{ background:#dbe2ee; border-radius:8px }
.wa-chat::-webkit-scrollbar-track{ background:transparent }

/* Responsive */
@media (min-width:480px){
  .wa-login-card, .wa-assistant-wrap{ padding:20px; }
  .wa-bubble{ max-width:80%; }
  .wa-brand img{ height:44px; }     /* ↑ logo en pantallas ≥480px */
}
@media (min-width:900px){
  .wa-assistant-wrap{ max-width:860px; margin: 3vh auto; }
  .wa-chat{ padding: 16px; }
  .wa-brand img{ height:48px; }     /* ↑ logo en desktop */
  .wa-mascot{ width:64px; height:64px; } /* ↑ avatar mascota en desktop */
}
