
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Paleta SIG UTC - azul institucional */
  --utc-blue-darkest: #0E2C66;   /* Azul más oscuro */
  --utc-blue-dark:    #14387F;   /* Azul institucional */
  --utc-blue:         #1E56B5;   /* Azul medio */
  --utc-blue-light:   #B8D2EF;   /* Azul cielo claro */
  --utc-blue-action:  #3D7DE3;   /* Azul brillante (botón) */
  --utc-blue-hover:   #2A66C7;
  --utc-red:          #D50000;   /* Rojo UTC */
  --utc-yellow:       #F4B400;   /* Dorado UTC */
  --utc-green:        #00A651;   /* Verde UTC */
  --utc-cyan:         #00AEEF;   /* Celeste UTC */

  --primary-blue:     #14387F;
  --dark-blue:        #0E2C66;
  --light-blue:       #3D7DE3;
  --teal:             #00AEEF;
  --green:            #00A651;
  --light-green:      #00C261;
  --danger:           #D50000;

  --text-dark: #2c3e50;
  --text-muted: #7f8c8d;
  --border-color: #d1d9e0;
  --bg-input: #f8fafc;
  --white: #ffffff;
  --shadow-sm: 0 2px 8px rgba(14,44,102,0.08);
  --shadow-md: 0 8px 32px rgba(14,44,102,0.15);
  --shadow-lg: 0 20px 60px rgba(14,44,102,0.22);
  --radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  min-height: 100vh;
  background:
    linear-gradient(180deg,
      var(--utc-blue-darkest) 0%,
      var(--utc-blue-dark)   30%,
      var(--utc-blue)        60%,
      var(--utc-blue-light)  100%);
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--text-dark);
}

/* Fondo animado */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 70%, rgba(61, 125, 227, 0.18) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 30%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 50%, rgba(0, 174, 239, 0.08) 0%, transparent 60%);
  animation: bgShift 15s ease-in-out infinite alternate;
  z-index: -1;
}

@keyframes bgShift {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(20px, -20px) rotate(2deg); }
}

/* ---- Contenedor del login ---- */
.login-wrapper {
  width: 100%;
  max-width: 1100px;
  min-height: 620px;
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  overflow: hidden;
  animation: fadeIn 0.6s ease-out;
}

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

/* ---- Panel Izquierdo (Formulario) ---- */
.login-left {
  flex: 1;
  padding: 50px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 36px;
}

.logo-container img {
  width: 325px;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(14,44,102,0.25));
  transition: var(--transition);
}

.logo-container img:hover {
  filter: drop-shadow(0 6px 20px rgba(14,44,102,0.4));
  transform: translateY(-2px);
}

.form-container {
  width: 100%;
}

.form-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: 0.3px;
}

/* ---- Inputs ---- */
.input-group {
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.input-wrapper {
  position: relative;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 42px 12px 14px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text-dark);
  background: var(--bg-input);
  transition: var(--transition);
  outline: none;
}

.input-wrapper input:focus {
  border-color: var(--utc-blue-action);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(61, 125, 227, 0.15);
}

.input-wrapper input::placeholder {
  color: #aab3be;
  font-size: 0.9rem;
}

.input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.toggle-password {
  cursor: pointer;
  pointer-events: auto;
  transition: var(--transition);
}

.toggle-password:hover {
  color: var(--utc-blue-action);
}

/* ---- Botón ---- */
.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--utc-blue-action) 0%, var(--utc-blue) 100%);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  margin-top: 8px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(61, 125, 227, 0.35);
}

.btn-login::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transition: left 0.5s;
}

.btn-login:hover::before {
  left: 100%;
}

.btn-login:hover {
  background: linear-gradient(135deg, var(--utc-blue-hover) 0%, var(--utc-blue-dark) 100%);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(61, 125, 227, 0.45);
}

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

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-login .spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: rotar 0.8s linear infinite;
  display: none;
}

.btn-login.loading .btn-text { display: none; }
.btn-login.loading .spinner { display: inline-block; }

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

/* ---- Enlaces de recuperación ---- */
.forgot-link {
  text-align: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
}

.forgot-link p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.forgot-link a {
  color: var(--utc-blue-action);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  transition: var(--transition);
}

.forgot-link a:hover {
  color: var(--utc-blue-dark);
  text-decoration: underline;
}

/* ---- Alertas ---- */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.4s ease-out;
}

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

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--utc-red);
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.alert-info {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: var(--utc-blue-dark);
}

/* ---- Panel Derecho (Info) ---- */
.login-right {
  flex: 1;
  background: linear-gradient(160deg,
    var(--utc-blue-darkest) 0%,
    var(--utc-blue-dark)   40%,
    var(--utc-blue)        100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 56px;
  position: relative;
  overflow: hidden;
}

/* Círculos decorativos */
.login-right::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(61, 125, 227, 0.20);
  filter: blur(40px);
}

.login-right::after {
  content: '';
  position: absolute;
  bottom: -80px;
  left: -80px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: rgba(0, 174, 239, 0.18);
  filter: blur(40px);
}

/* Línea roja decorativa lateral (acento UTC) */
.login-right .right-content::before {
  content: '';
  position: absolute;
  left: 0;
  top: 60px;
  bottom: 60px;
  width: 3px;
  background: linear-gradient(180deg, transparent 0%, var(--utc-red) 30%, var(--utc-red) 70%, transparent 100%);
  border-radius: 3px;
  opacity: 0.7;
}

.right-content {
  position: relative;
  z-index: 1;
  color: var(--white);
  padding-left: 16px;
}

.system-title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 18px;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.system-subtitle {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 28px;
  color: rgba(255,255,255,0.92);
}

.system-subtitle strong {
  color: var(--white);
  font-weight: 700;
}

/* ---- Roles ---- */
.roles-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 30px;
}

.role-badge {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  border: 1px solid rgba(255,255,255,0.35);
  color: white;
  backdrop-filter: blur(4px);
}

/* Roles con paleta UTC */
.role-badge.admin     { background: rgba(213, 0, 0, 0.45);   border-color: rgba(213,0,0,0.6); }
.role-badge.docente   { background: rgba(244, 180, 0, 0.45); border-color: rgba(244,180,0,0.6); }
.role-badge.doctor    { background: rgba(0, 166, 81, 0.45);  border-color: rgba(0,166,81,0.6); }
.role-badge.estudiante{ background: rgba(0, 174, 239, 0.50); border-color: rgba(0,174,239,0.65); }

/* ---- Features card ---- */
.features-card {
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 22px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  color: rgba(255,255,255,0.95);
  font-size: 0.92rem;
  font-weight: 500;
}

.feature-item:not(:last-child) {
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.feature-icon {
  font-size: 1.3rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  flex-shrink: 0;
}

.footer-note {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.65);
  text-align: center;
  font-style: italic;
  letter-spacing: 0.2px;
}

/* ---- Errores de validación ---- */
label.error {
  display: block;
  color: var(--utc-red);
  font-size: 0.74rem;
  font-weight: 600;
  margin-top: 5px;
  line-height: 1.3;
}

input.error {
  border-color: var(--utc-red) !important;
  background: #fef2f2 !important;
}

input.valid {
  border-color: #16a34a !important;
}

/* Responsive */
@media (max-width: 900px) {
  body {
    overflow: auto;
    align-items: flex-start;
    padding: 16px 0;
  }

  .login-wrapper {
    flex-direction: column;
    min-height: auto;
    max-width: 500px;
  }

  .login-left,
  .login-right {
    padding: 40px 32px;
  }

  .system-title {
    font-size: 1.7rem;
  }

  .logo-container img {
    width: 240px;
  }
}

@media (max-width: 480px) {
  .login-left,
  .login-right {
    padding: 32px 22px;
  }

  .logo-container img {
    width: 200px;
  }

  .system-title {
    font-size: 1.45rem;
  }

  .features-card {
    padding: 16px;
  }
}
