/* --- General --- */
body {
  font-family: 'Arial', sans-serif;
  background-image: url('../imagen/Fondo_cortitela2.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  margin: 0;
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* --- Login Container --- */
.login-container {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  background-color: rgba(255, 253, 253, 0.75); /* Opacidad base del formulario */
  border-radius: 0.5rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  text-align: center;
  transition: background-color 0.3s ease, border 0.3s ease, box-shadow 0.3s ease;
  /* --- ORDEN CORREGIDO AQUÍ --- */
  -webkit-backdrop-filter: blur(8px) saturate(150%); /* Prefixed version first */
  backdrop-filter: blur(8px) saturate(150%); /* Standard version after */
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Estado exitoso */
.login-container.success {
  border: 2px solid #38a169; /* Verde */
  background-color: rgba(255, 253, 253, 0.6); /* Ajusta este valor (0.6) si necesitas más o menos opacidad */
  /* --- ORDEN CORREGIDO AQUÍ --- */
  -webkit-backdrop-filter: blur(8px) saturate(150%);
  backdrop-filter: blur(8px) saturate(150%);
}

/* Estado de error */
.login-container.error {
  border: 2px solid #e53e3e; /* Rojo */
  background-color: rgba(255, 253, 253, 0.6); /* Ajusta este valor (0.6) si necesitas más o menos opacidad */
  /* --- ORDEN CORREGIDO AQUÍ --- */
  -webkit-backdrop-filter: blur(8px) saturate(150%);
  backdrop-filter: blur(8px) saturate(150%);
}

/* --- Headers --- */
h1 {
  color: #2d3748;
  margin-bottom: 0.5rem;
  font-size: 1.8rem;
  font-weight: bold;
}

p {
  color: #4a5568;
  margin-bottom: 1.8rem;
  font-size: 1.05rem;
}

/* --- Formulario --- */
form {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- Grupos de campos --- */
.form-group {
  width: 100%;
  margin-bottom: 1.2rem;
}

/* --- Input con ícono --- */
.input-with-icon {
  display: flex;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid #cbd5e0;
  border-radius: 0.4rem;
  transition: border-color 0.3s, box-shadow 0.3s;
  background-color: white;
  justify-content: flex-start;
}

.input-with-icon input {
  flex-grow: 1;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent;
  font-size: 1.05rem;
  padding: 0;
  width: 100%;
  text-align: left;
  padding-left: 0.25rem;
}

/* --- Íconos de inputs --- */
.input-with-icon i {
  color: #a0aec0;
  font-size: 1.2rem;
  margin-right: 0.8rem;
  pointer-events: none;
}

/* --- Evita franja azul al hacer focus --- */
.input-with-icon:focus-within {
  border-color: #4299e1;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.4);
}

/* --- Mostrar/Ocultar contraseña --- */
.toggle-password {
  margin-left: auto;
  color: #a0aec0;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.3s ease;
}

.toggle-password:hover {
  color: #4299e1;
}

input:focus {
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.3);
}

/* --- Botón Ingresar --- */
.login-btn {
  background-color: #4299e1;
  color: white;
  border: none;
  border-radius: 0.4rem;
  padding: 0.85rem 1.7rem;
  width: 100%;
  max-width: 320px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  font-weight: bold;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
  box-shadow: 0 4px 10px rgba(66, 153, 225, 0.3);
}

.login-btn:hover {
  background-color: #3182ce;
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(66, 153, 225, 0.4);
}

.login-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(66, 153, 225, 0.2);
}

.login-btn i {
  font-size: 1.1rem;
}

/* --- Spinner --- */
.loading {
  display: none;
  margin-right: 8px;
  width: 20px;
  height: 20px;
  border: 3px solid white;
  border-top: 3px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Mensajes de estado (Texto plano) --- */
.status-message {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 1rem;
  text-align: center;
  font-weight: bold;
}

.status-message.alert-danger {
  color: #c53030;
}

.status-message.alert-success {
  color: #2f855a;
}

.d-none {
  display: none !important;
}

/* --- Enlaces --- */
a {
  color: #4299e1;
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  text-decoration: underline;
  color: #3182ce;
}

/* --- Imagen y texto de esquina --- */
.corner-image {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 140px;
  z-index: 1000;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.image-text {
  position: fixed;
  bottom: -15px;
  right: 25px;
  width: 140px;
  text-align: center;
  color: #fff;
  font-size: 0.9rem;
  font-family: 'Dancing Script', cursive;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

/* --- Visually Hidden --- */
.visually-hidden {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .login-container {
    padding: 1.5rem;
    -webkit-backdrop-filter: blur(6px) saturate(120%); /* Prefixed first */
    backdrop-filter: blur(6px) saturate(120%); /* Standard after */
  }

  h1 {
    font-size: 1.6rem;
  }

  p {
    font-size: 0.95rem;
  }

  .login-btn {
    font-size: 1rem;
    max-width: 280px;
  }

  .corner-image {
    width: 110px;
    bottom: 20px;
    right: 20px;
  }

  .image-text {
    bottom: -10px;
    font-size: 0.8rem;
    width: 110px;
    right: 20px;
  }
}

@media (max-width: 480px) {
  .login-container {
    padding: 1rem;
    -webkit-backdrop-filter: blur(4px) saturate(100%); /* Prefixed first */
    backdrop-filter: blur(4px) saturate(100%); /* Standard after */
  }

  h1 {
    font-size: 1.4rem;
  }

  p {
    font-size: 0.9rem;
  }

  .input-with-icon {
    padding: 0.65rem;
  }

  .login-btn {
    padding: 0.65rem 1.2rem;
    font-size: 0.95rem;
    max-width: 250px;
  }

  .corner-image {
    width: 90px;
    bottom: 15px;
    right: 15px;
  }

  .image-text {
    bottom: -12px;
    font-size: 0.7rem;
    width: 90px;
    right: 15px;
  }
}

/* --- Estilo para inputs llenos (azulito) --- */
.input-with-icon.input-filled {
  background-color: #E8F0FE;
  border-color: #00000000;
}

.input-with-icon.input-filled i {
  color: #3182ce;
}

/* --- Animación de error --- */
@keyframes shake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
  100% { transform: translateX(0); }
}

.login-container.shake {
  animation: shake 0.4s ease;
}

.error-message {
  display: none;
}

.login-header .fa-key {
  font-size: 2.5rem;
  color: #667eea;
  margin-bottom: 1rem;
}

.info-box {
  margin: 1.5rem 0;
  padding: 1rem;
  background: rgba(103, 126, 234, 0.1);
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.info-box p {
  margin: 0;
  font-size: 0.9rem;
  color: #555;
}

.info-box .fa-info-circle {
  color: #667eea;
  margin-right: 0.5rem;
}

.forgot-btn-custom {
  padding: 10px 20px;
  font-size: 14px;
}

.lock-open-icon-custom {
  font-size: 2.5rem;
  color: #667eea;
  margin-bottom: 1rem;
}

.table-responsive-custom {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.precios-table-custom {
  min-width: 600px;
}

/* Renovación visual de las pantallas de acceso */
body {
  position: relative;
  padding: 24px;
  color: #243b53;
  background-color: #102f4b;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(135deg, rgba(10, 35, 57, 0.78), rgba(22, 73, 112, 0.52));
}

.login-container {
  position: relative;
  max-width: 430px;
  padding: 34px 36px 30px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(3, 20, 34, 0.38);
  -webkit-backdrop-filter: blur(14px) saturate(135%);
  backdrop-filter: blur(14px) saturate(135%);
}

.login-container::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 5px;
  content: "";
  background: linear-gradient(90deg, #0d6efd, #36b9d8);
}

.login-header {
  margin-bottom: 24px;
}

.login-header h1 {
  margin: 0 0 8px;
  color: #20364d;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}

.login-header p {
  max-width: 350px;
  margin: 0 auto;
  color: #66788a;
  font-size: 0.93rem;
  line-height: 1.55;
}

.auth-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  color: #0d6efd;
  background: #eaf3ff;
  border: 1px solid #cfe2fa;
  border-radius: 15px;
  font-size: 1.3rem;
  place-items: center;
}

.input-with-icon {
  min-height: 52px;
  padding: 0 15px;
  background: #f8fafc;
  border: 1px solid #cbd8e5;
  border-radius: 10px;
}

.input-with-icon input {
  min-height: 50px;
  color: #243b53;
  font-size: 0.98rem;
}

.input-with-icon:focus-within {
  background: #fff;
  border-color: #0d6efd;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.13);
}

.input-with-icon i {
  color: #71869a;
}

.toggle-password {
  display: grid;
  width: 34px;
  height: 34px;
  margin-left: 8px;
  border-radius: 8px;
  place-items: center;
}

.toggle-password:hover {
  color: #0d6efd;
  background: #eaf3ff;
}

.toggle-password i {
  margin: 0;
}

.login-btn {
  min-height: 50px;
  max-width: none;
  margin-top: 2px;
  background: linear-gradient(135deg, #0d6efd, #246eb0);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(13, 110, 253, 0.24);
  font-size: 1rem;
}

.login-btn:hover {
  background: linear-gradient(135deg, #0b5ed7, #1d5e98);
  box-shadow: 0 10px 24px rgba(13, 110, 253, 0.3);
  transform: translateY(-1px);
}

.status-message {
  padding: 10px 12px;
  margin: 0 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 0.88rem;
}

.status-message.alert-danger {
  color: #9f2d2d;
  background: #fff1f1;
  border-color: #f1c5c5;
}

.status-message.alert-success {
  color: #17653a;
  background: #edf9f2;
  border-color: #bfe5ce;
}

.links {
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid #e2e8f0;
}

.links p {
  margin: 0;
  font-size: 0.9rem;
}

.links a {
  color: #1b67aa;
  font-weight: 600;
}

.corner-image {
  width: 112px;
  opacity: 0.92;
}

.image-text {
  color: rgba(255, 255, 255, 0.9);
}

@media (max-width: 480px) {
  body {
    padding: 16px;
    align-items: flex-start;
  }

  .login-container {
    padding: 28px 20px 24px;
    margin-top: 7vh;
    border-radius: 15px;
  }

  .login-header h1 {
    font-size: 1.45rem;
  }

  .login-btn {
    max-width: none;
    padding: 0.75rem 1rem;
  }

  .corner-image,
  .image-text {
    display: none;
  }
}
