/*
 * Zenaxis — estilos base.
 * Tailwind cubre casi todo; acá van reglas globales, resets, animaciones y
 * componentes con lógica de estado (skeleton, activo del sidebar, etc.).
 */

@layer base {
  html, body { margin: 0; padding: 0; }
  body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.15); border-radius: 3px; }
  ::-webkit-scrollbar-track { background: transparent; }
  button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
    border-radius: 6px;
  }
}

/* --- Botones ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.5rem 0.875rem; border-radius: 0.375rem;
  font-family: Inter, system-ui, sans-serif; font-size: 13px; font-weight: 500;
  line-height: 1; transition: background 150ms, box-shadow 150ms, transform 100ms;
  cursor: pointer; border: 1px solid transparent; user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary   { background: #2563EB; color: #fff; }
.btn-primary:hover:not(:disabled)   { background: #1D4ED8; }
.btn-secondary { background: #fff; color: #0F172A; border-color: #E2E8F0; }
.btn-secondary:hover:not(:disabled) { background: #F8FAFC; border-color: #CBD5E1; }
.btn-whatsapp  { background: #ECFDF5; color: #047857; border-color: #A7F3D0; }
.btn-whatsapp:hover:not(:disabled) { background: #D1FAE5; }
.btn-destructive { background: #FEF2F2; color: #DC2626; border-color: #FEE2E2; }
.btn-destructive:hover:not(:disabled) { background: #FEE2E2; }
.btn-ai { background: #F5F3FF; color: #7C3AED; border-color: #DDD6FE; }
.btn-ai:hover:not(:disabled) { background: #EDE9FE; }
.btn-lg { padding: 0.75rem 1.25rem; font-size: 14px; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* --- Inputs ------------------------------------------------------------- */
.input {
  width: 100%; height: 40px; padding: 0 0.75rem;
  background: #fff; border: 1px solid #CBD5E1; border-radius: 0.375rem;
  font-family: Inter, system-ui, sans-serif; font-size: 14px; color: #0F172A;
  transition: border-color 150ms, box-shadow 150ms;
}
.input::placeholder { color: #94A3B8; }
.input:focus { outline: none; border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.input-icon { padding-left: 2.5rem; }
/* Estado de error de un input — usado por el formulario de registro para
   marcar visualmente los campos que el backend devolvió como 422/409. */
.input-error { border-color: #EF4444; background: #FEF2F2; }
.input-error:focus { border-color: #EF4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }
textarea.input { padding: 0.5rem 0.75rem; height: auto; min-height: 80px; font-family: inherit; }

/* --- Chat "pensando…" — animación sutil de puntos ---------------------- */
.chat-dots {
  display: inline-block;
  animation: chat-dots 1.2s infinite;
  min-width: 1.2em;
}
@keyframes chat-dots {
  0%,20% { opacity: 0.2; }
  50%    { opacity: 1; }
  80%,100% { opacity: 0.2; }
}

/* --- Cards -------------------------------------------------------------- */
.card { background: #fff; border: 1px solid #E2E8F0; border-radius: 0.5rem; box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04); }
.card-hover { transition: box-shadow 200ms, border-color 200ms; }
.card-hover:hover { box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.08); border-color: #CBD5E1; }

/* --- Badges ------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.125rem 0.5rem; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.03em; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge-critical  { background: #FEF2F2; color: #B91C1C; }
.badge-pending   { background: #FFFBEB; color: #B45309; }
.badge-confirmed { background: #ECFDF5; color: #047857; }
.badge-ai        { background: #F5F3FF; color: #6D28D9; }
.badge-info      { background: #EFF6FF; color: #1D4ED8; }
.badge-neutral   { background: #F1F5F9; color: #475569; }

/* --- Skeleton loader ---------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: 0.375rem;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Sidebar active link ------------------------------------------------ */
.nav-link { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.75rem; border-radius: 0.5rem; color: #475569; font-size: 14px; transition: background 120ms, color 120ms; }
.nav-link:hover { background: #F1F5F9; color: #0F172A; }
.nav-link.active { background: #DBEAFE; color: #1D4ED8; font-weight: 500; }
.nav-link .material-symbols-outlined { font-size: 20px; }

/* --- Toasts ------------------------------------------------------------- */
.toast {
  pointer-events: auto;
  min-width: 280px; max-width: 380px;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem; border: 1px solid;
  box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.15);
  display: flex; align-items: flex-start; gap: 0.5rem;
  font-size: 14px;
  animation: toast-slide-in 200ms ease-out;
}
.toast-success { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.toast-error   { background: #FEF2F2; border-color: #FEE2E2; color: #991B1B; }
.toast-info    { background: #EFF6FF; border-color: #BFDBFE; color: #1E3A8A; }
.toast.leaving { animation: toast-slide-out 200ms ease-in forwards; }
@keyframes toast-slide-in  { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-slide-out { from { transform: none; opacity: 1; } to { transform: translateX(24px); opacity: 0; } }

/* --- Page transitions -------------------------------------------------- */
.page-enter { animation: fade-in 200ms ease-out; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.fade-out { animation: fade-out 300ms ease-in forwards; }
@keyframes fade-out { to { opacity: 0; transform: translateY(-4px); } }

/* --- Bottom nav (mobile) ----------------------------------------------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid #E2E8F0;
  padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0));
  display: flex; justify-content: space-around; align-items: center;
  z-index: 40;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 0.375rem 0.5rem; color: #94A3B8; font-size: 10px; font-weight: 500;
}
.bottom-nav a.active { color: #2563EB; }

/* --- Layout responsive helpers ---------------------------------------- */
@media (max-width: 767px) {
  .desktop-only { display: none !important; }
  .mobile-pad-bottom { padding-bottom: 5rem; }
}
@media (min-width: 768px) {
  .mobile-only { display: none !important; }
}

/* --- Utilidad: chat bubble WhatsApp ----------------------------------- */
.chat-bubble {
  background: #E7F8EE;
  border-radius: 0.5rem 0.5rem 0.5rem 0;
  padding: 0.875rem 1rem;
  color: #0F172A;
  font-size: 14px; line-height: 1.55;
  box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  position: relative;
}
.chat-bubble.editable {
  outline: 2px dashed #A7F3D0;
  outline-offset: 3px;
}

/* Resaltado temporal de una sección al llegar por un atajo
   (ej. "Resolver ahora" en Mi Día → atrasados). */
.resaltar-seccion {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.55);
  background: rgba(254, 226, 226, 0.35);
}

/* Tarjetas de plan en el registro (radio oculto dentro del label). */
.plan-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; min-height: 132px;
  border: 1.5px solid #CBD5E1; border-radius: 14px; background: #fff;
  cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s;
}
.plan-card:hover { border-color: #93C5FD; }
.plan-card:focus-within { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25); }
.plan-card.plan-card-sel {
  border-color: #2563EB; background: #EFF6FF;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
#onb-planes:has(.input-error) .plan-card { border-color: #EF4444; }
