/* =========================================================
   Design tokens (mantener consistencia visual del login)
   ========================================================= */
:root {
  --color-primary: #013765;
  --color-primary-hover: #022f56;
  --color-text-main: #202124;
  --color-text-muted: #5f6368;
  --color-border: #dadce0;
  --color-border-soft: #e5e7eb;

  --color-white: #ffffff;
  --color-link-neutral: #757575;
  --color-success: #16a34a;
  --color-surface-success: #f9fafb;
  --color-text-soft: #6b7280;
  --color-text-faint: #9ca3af;

  --color-bg-page-start: #f5f7fa;
  --color-bg-page-end: #e9eef5;
  --color-card-start: #f8fbff;
  --color-card-end: #ffffff;

  --color-surface-soft: #f1f3f4;
  --color-surface-soft-hover: #e3e7ea;
  --color-divider-soft: #eee;

  --color-device-bg: #f8f9fb;
  --color-device-border: #e0e3e7;

  --color-overlay: rgba(0, 0, 0, 0.35);
  --shadow-modal: 0 10px 30px rgba(0, 0, 0, 0.15);

  --color-alert-bg: #fdeaea;
  --color-alert-border: #f5b5b5;
  --color-alert-text: #8a1c1c;

  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.08);
  --shadow-button: 0 2px 6px rgba(1, 55, 101, 0.2);
  --shadow-button-hover: 0 4px 10px rgba(1, 55, 101, 0.25);
  --focus-ring: 0 0 0 2px rgba(1, 55, 101, 0.1);
}

/* =========================================================
   COMPONENTE: GENERALES
   Estructura base, tipografía y bloques compartidos
   ========================================================= */
* {
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  margin: 0;
  background: linear-gradient(135deg, var(--color-bg-page-start), var(--color-bg-page-end));
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: linear-gradient(180deg, var(--color-card-start) 0%, var(--color-card-end) 100%);
  border-top: 6px solid var(--color-primary);
  width: 420px;
  margin: 0 auto;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: var(--shadow-card);
  text-align: center;
  transition: transform 0.2s ease;
  min-width: 320px;
}

.header {
  margin-bottom: 20px;
}

.header-with-logo {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo {
  width: 100%;
  margin: 0 auto;
}

.logo-unc {
  display: block;
  width: 100%;
  height: 45px;
  object-fit: contain;
}

h1 {
  font-size: 26px;
  margin: 10px 0 4px;
  color: var(--color-text-main);
  font-weight: 600;
}

.subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  margin: 24px 0 24px;
}

.error-message {
  font-size: clamp(0.78rem, 2.2vw, 0.92rem);
  line-height: 1.35;
}

.links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 15px;
  font-size: 14px;
}

.links a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.links a:hover {
  text-decoration: underline;
}

.footer {
  margin-top: 24px;
  font-size: 11px;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-divider-soft);
  padding-top: 15px;
  line-height: 1.4;
}

.footer-bottom {
  margin-top: 18px;
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
}

.footer-bottom span,
.footer-bottom a {
  margin: 0 6px;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.footer-bottom span:hover,
.footer-bottom a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .card {
    width: 90%;
    padding: 28px 20px;
  }
}

/* Servicios (pantallas con contexto de servicio) */
.service-to {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  color: var(--color-text-muted);
}

.service-to b {
  color: var(--color-primary);
  font-weight: 500;
}

/* Bloque informativo del dispositivo detectado */
.device-info {
  text-align: left;
  background: var(--color-device-bg);
  border: 1px solid var(--color-device-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--color-text-main);
}

.device-info div {
  margin-bottom: 6px;
}

.device-info span {
  color: var(--color-text-muted);
}

/* Spinner de carga */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-white);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

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

.hidden {
  display: none;
}

/* =========================================================
   COMPONENTE: INPUTS
   Campos de texto, labels flotantes y OTP
   ========================================================= */
.input-container {
  position: relative;
  margin-bottom: 15px;
}

input {
  width: 100%;
  height: 52px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  padding: 4px 12px 4px;
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
  background: transparent;
}

input:focus {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

label {
  position: absolute;
  left: 12px;
  top: 16px;
  font-size: 15px;
  color: var(--color-text-muted);
  transition: all 0.2s ease;
  background: white;
  padding: 0 4px;
  pointer-events: none;
}

input:focus+label,
input:not(:placeholder-shown)+label {
  top: -8px;
  font-size: 11px;
  color: var(--color-primary);
}

/* Botón embebido para mostrar/ocultar contraseña */
.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  z-index: 2;
  color: var(--color-link-neutral);
  transition: color 0.2s ease-in-out;
  border: none;
  background: transparent;
  padding: 0;
  line-height: 0;
}

#password:focus~.toggle-password {
  color: var(--color-primary);
}

/* OTP */
.otp-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.otp-input {
  width: 40px;
  height: 48px;
  text-align: center;
  font-size: 18px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  outline: none;
  transition: all 0.2s ease;
}

.otp-input:focus {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

/* =========================================================
   COMPONENTE: BOTONES
   Botón base + variantes + acciones agrupadas
   ========================================================= */
.btn {
  width: 100%;
  height: 50px;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-button);
  text-transform: none;
  margin: 8px 0 8px;
}

.btn:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-button-hover);
  color: var(--color-white);
}

.btn:disabled,
.btn.is-loading,
.btn[aria-busy='true'] {
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: none;
  filter: saturate(72%);
  transform: none;
  pointer-events: none;
}

.btn:disabled:hover,
.btn.is-loading:hover,
.btn[aria-busy='true']:hover {
  box-shadow: none;
}

.btn-secondary:disabled,
.btn-secondary.is-loading,
.btn-secondary[aria-busy='true'] {
  color: var(--color-text-muted);
  border-color: var(--color-border);
  background: transparent;
}

.action-link-disabled,
.action-link-disabled:hover {
  color: var(--color-text-muted) !important;
  opacity: 0.55;
  text-decoration: none !important;
  cursor: not-allowed;
  pointer-events: none;
}

.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;

  background: var(--color-surface-soft);
  color: var(--color-text-muted);

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  transition: all 0.2s ease;
  position: absolute;
  left: 0;
  top: 0;
}

.back-btn:hover {
  background: var(--color-surface-soft-hover);
  color: var(--color-primary);
  transform: scale(1.05);
}

@media (max-width: 450px) {
  .back-btn,
  .back-btn:hover {
    background: transparent;
  }

  .logo-unc {
    height: 35px;
  }
}

.buttons {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.btn-primary {
  flex: 1;
  background: var(--color-primary) !important;
  color: var(--color-white);
  border: none;
  box-shadow: none;
  font-size: 14px;
  margin-left: 0;
  margin-right: 0;
}

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

.btn-secondary {
  flex: 1;
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-border);
  box-shadow: none;
  font-size: 14px;
  margin-left: 0;
  margin-right: 0;
}

.btn-secondary:hover {
  background: var(--color-surface-soft);
  color: var(--color-primary);
}

/* =========================================================
   COMPONENTE: MODALES
   ========================================================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-overlay);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay:target {
  display: flex;
}

.modal {
  background: var(--color-white);
  width: 360px;
  border-radius: 14px;
  padding: 26px;
  text-align: center;
  box-shadow: var(--shadow-modal);
}

.modal h2 {
  font-size: 20px;
  margin-bottom: 14px;
  color: var(--color-text-main);
}

.modal p {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.modal-link a {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: none;
}

.modal-link a:hover {
  text-decoration: underline;
}

.modal-link-btn {
  margin-top: 12px;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
}

.modal-link-btn:hover {
  text-decoration: underline;
}

.modal-close-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}


/* =========================================================
   COMPONENTE: ALERTA / MENSAJE DE ERROR
   ========================================================= */

.box {
  background: var(--color-alert-bg);
  border: 1px solid var(--color-alert-border);
  color: var(--color-alert-text);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 15px;
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}

.alert {
  background: var(--color-alert-bg);
  border: 1px solid var(--color-alert-border);
  color: var(--color-alert-text);
  animation: slideDown 0.6s ease;
}

.warning {
  background: #fff4e5;
  border: 1px solid #f6c26b;
  color: #8a5a00;
  margin-bottom: 24px;
  font-size: 13px;
  text-align: left;
  line-height: 1.4;
}



/* =========================================================
   ANIMACIONES
   ========================================================= */
.no-animation {
  animation: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-25px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.94);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}