/* ==========================================================================
   Proyecto UTP - Estilos UI/UX Inspirados en Dashboard Soft-UI Moderno
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Paleta de Colores - Obsidian Dark Theme */
  --bg-main: #06090f;
  --bg-card: #0a0e17;
  --bg-input: #030712;
  --border-card: #1e293b;
  --border-input: #334155;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  
  --text-dark: #f8fafc;
  --text-body: #94a3b8;
  --text-muted: #64748b;
  --text-light: #64748b;
  
  --shadow-card: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 8px 24px -4px rgba(0, 0, 0, 0.5);
  --shadow-btn: 0 10px 22px rgba(37, 99, 235, 0.28);
  --shadow-btn-hover: 0 14px 28px rgba(37, 99, 235, 0.38);
  
  --radius-card: 32px;
  --radius-input: 16px;
  --radius-btn: 16px;
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family);
}

body {
  min-height: 100vh;
  background-color: var(--bg-main);
  color: var(--text-body);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
}

/* Orbes ambientales */
.ambient-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.orb-1 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, rgba(6, 9, 15, 0) 70%);
  top: -10%;
  left: -10%;
  filter: blur(60px);
}

.orb-2 {
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, rgba(6, 9, 15, 0) 70%);
  bottom: -15%;
  right: -10%;
  filter: blur(70px);
}

/* Contenedor Principal (Tarjeta Dividida con Formulario y GIF) */
.login-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 980px;
  background: rgba(10, 14, 23, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  overflow: hidden;
  animation: cardEntrance 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Columna Izquierda: Formulario */
.form-section {
  padding: 48px 42px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Header de la marca con el nuevo Logo */
.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  background: #0f172a;
  border: 1px solid #1e293b;
  padding: 2px;
}

.badge-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 4px 11px;
  border-radius: 999px;
}

.form-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}

.form-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 30px;
}

/* Campos del formulario */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin-bottom: 8px;
}

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

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-input);
  padding: 14px 18px;
  padding-right: 46px;
  font-size: 0.95rem;
  color: var(--text-dark);
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input::placeholder {
  color: var(--text-light);
}

.form-input:focus {
  background: #0b1120;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

.input-icon, .toggle-pass-btn {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.toggle-pass-btn:hover {
  color: var(--text-dark);
}

/* Opciones extras */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  accent-color: var(--primary);
  cursor: pointer;
}

.secure-badge {
  color: var(--text-light);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Botón principal */
.btn-primary {
  width: 100%;
  background: var(--primary-gradient);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-btn);
  padding: 15px 24px;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  box-shadow: var(--shadow-btn-hover);
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Alertas */
.alert-box {
  display: none;
  padding: 13px 18px;
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  margin-top: 14px;
  margin-bottom: 6px;
  text-align: center;
  animation: fadeIn 0.3s ease;
  transition: all 0.25s ease;
}

/* Modo Oscuro (Default) */
.alert-success {
  background: rgba(6, 78, 59, 0.35);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.alert-success .alert-title {
  color: #6ee7b7;
  font-weight: 700;
}
.alert-success .alert-desc {
  color: #a7f3d0;
  font-size: 0.84rem;
}
.alert-success .alert-counter {
  color: #34d399;
  font-weight: 800;
}
.alert-success .alert-progress-track {
  background: rgba(16, 185, 129, 0.2);
}
.alert-success .alert-progress-bar {
  background: #10b981;
}

.alert-error {
  background: rgba(127, 29, 29, 0.35);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Footer */
.form-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-light);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #059669;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

/* =========================================================
   Columna Derecha: Sección del GIF
   ========================================================= */
.media-section {
  background: linear-gradient(145deg, #090d16 0%, #0d1527 60%, #111827 100%);
  border-left: 1px solid var(--border-card);
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.media-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(6, 9, 15, 0.7);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border: 1px solid #1e293b;
}

.media-gif {
  width: 100%;
  height: 100%;
  max-height: 520px;
  object-fit: cover;
  display: block;
  border-radius: 24px;
  transition: transform 0.3s ease;
}

.media-gif:hover {
  transform: scale(1.02);
}

/* Responsividad */
@media (max-width: 860px) {
  .login-card {
    grid-template-columns: 1fr;
    max-width: 460px;
  }
  .media-section {
    display: none; /* En pantallas pequeñas se oculta para dar prioridad al login */
  }
  .form-section {
    padding: 38px 28px;
  }
}

/* =========================================================
   Estilos 2FA y Google Authenticator (Soft-UI)
   ========================================================= */
.step-hidden {
  display: none !important;
}

.step-container {
  animation: stepFade 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.user-preview-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 20px;
}

.user-avatar-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.user-info-text h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.user-info-text p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.totp-input-wrapper {
  margin-bottom: 20px;
}

.totp-input {
  width: 100%;
  font-family: 'SF Mono', 'Courier New', monospace;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  text-align: center;
  padding: 14px 10px;
  background: var(--bg-input);
  border: 2px solid var(--border-input);
  border-radius: var(--radius-input);
  color: #60a5fa;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.totp-input::placeholder {
  color: var(--text-light);
  letter-spacing: 0.25em;
  font-size: 1.3rem;
  font-weight: 600;
}

.totp-input:focus {
  background: #0b1120;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 6px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.btn-link:hover {
  color: var(--primary-hover);
}

.btn-secondary {
  width: 100%;
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  border-radius: var(--radius-btn);
  padding: 13px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.btn-secondary:hover {
  background: #334155;
  border-color: #475569;
  color: #ffffff;
}

/* Modal de Vinculación 2FA (QR) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: #0f172a;
  border-radius: 24px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 440px;
  padding: 28px;
  position: relative;
  border: 1px solid #1e293b;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-dialog {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: #1e293b;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.qr-wrapper {
  background: #06090f;
  border: 2px dashed #334155;
  border-radius: 20px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.qr-img {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  background: #ffffff;
  padding: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.secret-box {
  margin-top: 12px;
  width: 100%;
  background: #030712;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.secret-code {
  font-family: 'SF Mono', 'Courier New', monospace;
  font-size: 0.92rem;
  font-weight: 700;
  color: #60a5fa;
  letter-spacing: 1.5px;
}

.btn-copy {
  background: #1e3a8a;
  border: 1px solid #2563eb;
  color: #ffffff;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.btn-copy:hover {
  background: #2563eb;
  color: #ffffff;
}

.setup-steps {
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.5;
  padding-left: 18px;
  margin-bottom: 20px;
}

.setup-steps li {
  margin-bottom: 6px;
}


/* =========================================================
   SOPORTE DE TEMA CLARO DINÁMICO EN LOGIN / 2FA
   ========================================================= */
html.theme-light {
  --bg-main: #f0f4fd;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --border-card: rgba(226, 232, 240, 0.85);
  --border-input: #e2e8f0;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  
  --text-dark: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --shadow-card: 0 25px 50px -12px rgba(99, 102, 241, 0.14), 0 8px 24px -4px rgba(0, 0, 0, 0.04);
}

html.theme-light .orb-1 {
  background: radial-gradient(circle, rgba(99, 102, 241, 0.22) 0%, rgba(219, 234, 254, 0) 70%);
}

html.theme-light .orb-2 {
  background: radial-gradient(circle, rgba(59, 130, 246, 0.18) 0%, rgba(224, 231, 255, 0) 70%);
}

html.theme-light .login-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
}

html.theme-light .brand-logo {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

html.theme-light .badge-tag {
  color: var(--primary);
  background: #eff6ff;
  border: 1px solid #dbeafe;
}

html.theme-light .form-input {
  background: var(--bg-input);
  border: 1.5px solid var(--border-input);
  color: var(--text-dark);
}

html.theme-light .form-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

html.theme-light .form-footer {
  border-top: 1px solid #f1f5f9;
}

html.theme-light .media-section {
  background: linear-gradient(145deg, #f8fafc 0%, #eff6ff 60%, #e0e7ff 100%);
  border-left: 1px solid var(--border-card);
}

html.theme-light .media-container {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(226, 232, 240, 0.7);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

html.theme-light .user-preview-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

html.theme-light .totp-input {
  background: var(--bg-input);
  border: 2px solid var(--border-input);
  color: var(--primary);
}

html.theme-light .totp-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

html.theme-light .btn-secondary {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

html.theme-light .btn-secondary:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

html.theme-light .modal-dialog {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.25);
}

html.theme-light .modal-title {
  color: #0f172a;
}

html.theme-light .modal-close-btn {
  background: #f1f5f9;
  color: #64748b;
}

html.theme-light .modal-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

html.theme-light .qr-wrapper {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
}

html.theme-light .secret-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

html.theme-light .secret-code {
  color: #2563eb;
}

html.theme-light .btn-copy {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

html.theme-light .btn-copy:hover {
  background: #2563eb;
  color: #ffffff;
}

html.theme-light .setup-steps {
  color: #475569;
}

/* Alertas en Modo Claro (Soft-UI Alto Contraste) */
html.theme-light .alert-success {
  background: #f0fdf4 !important;
  color: #166534 !important;
  border: 1.5px solid #86efac !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.12) !important;
}
html.theme-light .alert-success .alert-title {
  color: #14532d !important;
  font-weight: 700 !important;
}
html.theme-light .alert-success .alert-desc {
  color: #166534 !important;
  font-size: 0.84rem !important;
}
html.theme-light .alert-success .alert-counter {
  color: #15803d !important;
  font-weight: 800 !important;
}
html.theme-light .alert-success .alert-progress-track {
  background: #dcfce7 !important;
}
html.theme-light .alert-success .alert-progress-bar {
  background: #16a34a !important;
}

html.theme-light .alert-error {
  background: #fef2f2 !important;
  color: #991b1b !important;
  border: 1.5px solid #fca5a5 !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.1) !important;
}

/* =========================================================
   OPTIMIZACIONES MÓVILES RESPONSIVAS (SMARTPHONES)
   ========================================================= */
@media (max-width: 640px) {
  body {
    padding: 12px 10px !important;
  }

  #themeToggleBtn {
    top: 10px !important;
    right: 10px !important;
    padding: 6px 11px !important;
    font-size: 11px !important;
  }

  .login-card {
    border-radius: 22px !important;
    max-width: 100% !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22) !important;
  }

  .form-section {
    padding: 28px 18px 24px 18px !important;
  }

  .brand-badge {
    margin-bottom: 16px !important;
  }

  .form-title {
    font-size: 1.4rem !important;
  }

  .form-subtitle {
    font-size: 0.82rem !important;
    margin-bottom: 16px !important;
  }

  .totp-input {
    font-size: 1.5rem !important;
    letter-spacing: 0.22em !important;
    padding: 12px 8px !important;
  }

  .totp-input::placeholder {
    font-size: 1.1rem !important;
    letter-spacing: 0.18em !important;
  }

  .user-preview-card {
    padding: 8px 12px !important;
    margin-bottom: 16px !important;
  }

  .btn-primary,
  .btn-secondary {
    padding: 12px 16px !important;
    font-size: 0.88rem !important;
  }

  .modal-dialog {
    width: 95% !important;
    max-width: 380px !important;
    padding: 20px 16px !important;
    border-radius: 20px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }

  .setup-steps {
    font-size: 0.78rem !important;
    padding-left: 18px !important;
    margin-bottom: 14px !important;
  }

  .qr-wrapper {
    padding: 12px !important;
    margin-bottom: 14px !important;
  }

  .secret-box {
    padding: 6px 10px !important;
  }

  .secret-code {
    font-size: 0.78rem !important;
    letter-spacing: 0.5px !important;
  }

  .btn-copy {
    padding: 4px 8px !important;
    font-size: 11px !important;
  }

  .form-footer {
    margin-top: 24px !important;
    font-size: 0.75rem !important;
  }
}

@media (max-width: 400px) {
  body {
    padding: 8px 6px !important;
  }

  .form-section {
    padding: 22px 14px 20px 14px !important;
  }

  .form-title {
    font-size: 1.28rem !important;
  }

  .totp-input {
    font-size: 1.35rem !important;
    letter-spacing: 0.16em !important;
    padding: 10px 4px !important;
  }

  .modal-dialog {
    padding: 16px 12px !important;
  }
}

