/* ===== LOGIN PROFESIONAL - SISTEMA DE ADMISIÓN NOS ===== */
/* Diseño Moderno, Minimalista y Técnico */

/* ===== VARIABLES ===== */
:root {
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --primary-light: #dcfce7;
  --error: #ef4444;
  --error-light: #fef2f2;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.12);
  --transition: 0.2s ease;
}

/* ===== RESET ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== BASE ===== */
html,
body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 50%, #bbf7d0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

/* ===== LAYOUT ===== */
.align {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
}

.grid {
  width: 100%;
  max-width: 400px;
}

/* ===== CARD PRINCIPAL ===== */
.register {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: visible;
}

/* Barra superior verde */
.register::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}

/* ===== LOGO ===== */
.logo-container {
  text-align: center;
  margin-bottom: 24px;
  overflow: visible;
}

.site__logo {
  max-height: 65px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  transition: transform var(--transition);
}

.site__logo:hover {
  transform: scale(1.05);
}

/* ===== TÍTULOS ===== */
h1.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-800);
  text-align: center;
  margin-bottom: 4px;
}

/* Remover la línea debajo del título */
h1.login-title::after {
  display: none;
}

.login-subtitle {
  font-size: 14px;
  color: var(--gray-500);
  text-align: center;
  margin-bottom: 32px;
  font-weight: 400;
}

/* ===== CAMPOS DEL FORMULARIO ===== */
.form__field {
  position: relative;
  margin-bottom: 20px;
}

/* Contenedor del input con ícono */
.form__field input[type="text"],
.form__field input[type="password"] {
  width: 100%;
  height: 48px;
  padding: 0 48px 0 44px;
  font-size: 15px;
  font-weight: 500;
  color: var(--gray-800);
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition);
}

.form__field input::placeholder {
  color: var(--gray-400);
  font-weight: 400;
}

.form__field input:focus {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* Iconos dentro del input */
.form__field::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 14px;
  width: 20px;
  height: 20px;
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.4;
  pointer-events: none;
  z-index: 1;
}

/* Ícono de usuario */
.form__field:nth-child(2)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z'/%3E%3C/svg%3E");
}

/* Ícono de candado */
.form__field:nth-child(3)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z'/%3E%3C/svg%3E");
}

/* ===== BOTÓN OJO (TOGGLE PASSWORD) ===== */
.password-toggle {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}

.password-toggle:hover {
  opacity: 0.7;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  stroke: var(--gray-500);
}

/* ===== MENSAJES DE ERROR INLINE ===== */
.field-error {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding-left: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--error);
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.15s ease;
}

.field-error.visible {
  opacity: 1;
  transform: translateY(0);
}

.field-error::before {
  content: '';
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23ef4444'%3E%3Cpath fill-rule='evenodd' d='M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-size: contain;
  flex-shrink: 0;
}

/* Input con error */
.input-error {
  border-color: var(--error) !important;
  background: var(--error-light) !important;
}

.input-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* ===== BOTÓN SUBMIT ===== */
.form__field input[type="submit"] {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
}

.form__field input[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(34, 197, 94, 0.4);
}

.form__field input[type="submit"]:active {
  transform: translateY(0);
}

.form__field input[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* No aplicar ::before al submit */
.form__field:nth-child(4)::before {
  display: none;
}

/* ===== ERROR DEL SERVIDOR ===== */
.error-message {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  margin-top: 16px;
  background: var(--error-light);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--error);
}

.error-message::before {
  content: '';
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23ef4444'%3E%3Cpath fill-rule='evenodd' d='M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-size: contain;
  flex-shrink: 0;
}

/* Ocultar el contenedor de error JS vacío */
.error {
  display: none !important;
}

/* ===== FOOTER / AYUDA ===== */
.help-link {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-100);
  text-align: center;
}

.help-link p {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0;
}

.help-link a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition);
}

.help-link a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.system-info {
  font-size: 11px !important;
  color: var(--gray-400) !important;
  margin-top: 8px !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .register {
    padding: 32px 24px;
  }

  .site__logo {
    height: 70px;
  }

  h1.login-title {
    font-size: 22px;
  }

  .login-subtitle {
    margin-bottom: 24px;
  }
}

/* ===== ACCESIBILIDAD ===== */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  }

  .register {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  h1.login-title {
    color: var(--white);
  }

  .login-subtitle {
    color: var(--gray-400);
  }

  .form__field input[type="text"],
  .form__field input[type="password"] {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
  }

  .form__field input::placeholder {
    color: var(--gray-500);
  }

  .form__field input:focus {
    background: rgba(255, 255, 255, 0.08);
  }

  .help-link {
    border-top-color: rgba(255, 255, 255, 0.1);
  }

  .help-link p {
    color: var(--gray-400);
  }
}
/* ===== TOAST NOTIFICATIONS ===== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px -5px rgba(0,0,0,0.2);
  z-index: 9999;
  transform: translateX(120%);
  transition: transform 0.3s ease;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  background: var(--primary);
  color: white;
}

.toast.error {
  background: var(--error);
  color: white;
}

.toast.loading {
  background: var(--gray-700);
  color: white;
}

.toast svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.toast.loading svg {
  animation: spin 1s linear infinite;
}

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