/* ═══════════════════════════════════════════════════════
   EncuestaTE — main.css
   Tema: Azul + Modo oscuro/claro
   ═══════════════════════════════════════════════════════ */

/* ── Variables de tema ──────────────────────────────── */
:root {
  --blue-50:  #EFF6FF;
  --blue-100: #DBEAFE;
  --blue-200: #BFDBFE;
  --blue-400: #60A5FA;
  --blue-500: #3B82F6;
  --blue-600: #2563EB;
  --blue-700: #1D4ED8;
  --blue-800: #1E40AF;
  --blue-900: #1E3A8A;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --transition: .2s ease;
}

/* ── Modo oscuro (default) ──────────────────────────── */
[data-theme="dark"] {
  --bg-page:        #0A0F1E;
  --bg-card:        #111827;
  --bg-input:       #1F2937;
  --bg-input-hover: #263244;

  --border:       rgba(255,255,255,.08);
  --border-focus: #3B82F6;

  --text-primary:   #F9FAFB;
  --text-secondary: #9CA3AF;
  --text-muted:     #6B7280;

  --blob-1: rgba(37,99,235,.20);
  --blob-2: rgba(29,78,216,.15);
  --blob-3: rgba(96,165,250,.10);

  --card-shadow: 0 25px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.05);
}

/* ── Modo claro ─────────────────────────────────────── */
[data-theme="light"] {
  --bg-page:        #F5F7FA;
  --bg-card:        #FFFFFF;
  --bg-input:       #F0F4FF;
  --bg-input-hover: #E8EEFF;

  --border:       rgba(37,99,235,.15);
  --border-focus: #2563EB;

  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;

  --blob-1: rgba(37,99,235,.10);
  --blob-2: rgba(96,165,250,.08);
  --blob-3: rgba(147,197,253,.12);

  --card-shadow: 0 20px 60px rgba(37,99,235,.10), 0 0 0 1px rgba(37,99,235,.06);
}

/* ── Reset y base ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

/* ── Fondo animado con blobs ────────────────────────── */
.bg-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: float 12s ease-in-out infinite;
}

.blob-1 {
  width: 600px; height: 600px;
  top: -200px; left: -150px;
  background: var(--blob-1);
  animation-duration: 14s;
}

.blob-2 {
  width: 400px; height: 400px;
  bottom: -100px; right: -100px;
  background: var(--blob-2);
  animation-duration: 10s;
  animation-delay: -4s;
}

.blob-3 {
  width: 300px; height: 300px;
  top: 50%; left: 50%;
  background: var(--blob-3);
  animation-duration: 16s;
  animation-delay: -8s;
}

@keyframes float {
  0%,100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(30px,-20px) scale(1.05); }
  66%      { transform: translate(-20px,15px) scale(.97); }
}

/* ── Toggle de tema ─────────────────────────────────── */
.theme-toggle {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 100;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: background var(--transition), transform var(--transition);
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.theme-toggle:hover { transform: scale(1.1); }

[data-theme="dark"]  .icon-sun  { display: none; }
[data-theme="dark"]  .icon-moon { display: block; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: block; }

/* ── Contenedor del login ───────────────────────────── */
.login-container {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ── Tarjeta de login ───────────────────────────────── */
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--card-shadow);
  animation: slideUp .4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Brand / Logo ───────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.brand-icon {
  flex-shrink: 0;
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  box-shadow: 0 8px 24px rgba(37,99,235,.4);
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.4px;
  line-height: 1.2;
}

.brand-text p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Alerta ─────────────────────────────────────────── */
.alert {
  display: none;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.4;
}
.alert.error   { display: block; background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: #FCA5A5; }
.alert.success { display: block; background: rgba(34,197,94,.12);  border: 1px solid rgba(34,197,94,.3);  color: #86EFAC; }

/* ── Campos del formulario ──────────────────────────── */
.field-group {
  margin-bottom: 18px;
}

.field-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.label-link {
  font-size: 12px;
  font-weight: 400;
  color: var(--blue-400);
  text-decoration: none;
  transition: color var(--transition);
}
.label-link:hover { color: var(--blue-200); }

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  width: 18px; height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.input-wrap input {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border var(--transition), background var(--transition), box-shadow var(--transition);
}

.input-wrap input::placeholder { color: var(--text-muted); }

.input-wrap input:hover {
  background: var(--bg-input-hover);
  border-color: rgba(96,165,250,.3);
}

.input-wrap input:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
  background: var(--bg-input-hover);
}

.toggle-pass {
  position: absolute;
  right: 12px;
  width: 20px; height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
}

.eye-icon {
  width: 18px; height: 18px;
  color: var(--text-muted);
  transition: color var(--transition);
}
.toggle-pass:hover .eye-icon { color: var(--text-secondary); }

/* ── Checkbox personalizado ─────────────────────────── */
.field-check { margin-bottom: 24px; }

.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.check-label input[type="checkbox"] { display: none; }

.check-box {
  width: 18px; height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  background: var(--bg-input);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), border var(--transition);
}

.check-label input:checked + .check-box {
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.check-label input:checked + .check-box::after {
  content: '';
  width: 10px; height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* ── Botón de login ─────────────────────────────────── */
.btn-login {
  width: 100%;
  height: 46px;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  box-shadow: 0 6px 20px rgba(37,99,235,.4);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

.btn-login:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(37,99,235,.5);
}

.btn-login:active:not(:disabled) { transform: translateY(0); }

.btn-login:disabled {
  opacity: .7;
  cursor: not-allowed;
}

.spin {
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Footer de la tarjeta ───────────────────────────── */
.card-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.card-footer code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--blue-400);
}

/* ── Footer de página ───────────────────────────────── */
.page-footer {
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 480px) {
  .login-card { padding: 28px 20px; }
  .brand-text h1 { font-size: 20px; }
}
