/* Variables CSS responsive */
:root {
  /* Variables dinámicas que se adaptan al viewport */
  --dynamic-padding: clamp(8px, 3vw, 24px);
  --dynamic-logo-size: clamp(100px, 15vw, 120px);
  --dynamic-title-size: clamp(18px, 5vw, 28px);
  --dynamic-subtitle-size: clamp(12px, 3.5vw, 16px);
  --dynamic-input-height: clamp(44px, 8vh, 56px);
  --dynamic-button-height: clamp(44px, 8vh, 56px);
  --dynamic-border-radius: clamp(8px, 2vw, 12px);
  --dynamic-card-radius: clamp(16px, 4vw, 24px);
}

body.login, html {
  background: linear-gradient(135deg, #0067AB 0%, #0067AB 100%);
  min-height: 100vh;
  margin: 0;
  font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Loader superior */
.top-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.top-loader.active {
  opacity: 1;
  visibility: visible;
}

.top-loader::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  animation: loadingBar 1.5s infinite;
}

.login-status {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 25px;
  padding: 10px 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #0067AB;
  font-weight: 600;
  font-size: 14px;
}

.login-status.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.login-status .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 103, 171, 0.2);
  border-top: 2px solid #0067AB;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes loadingBar {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.login-content {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 910px;
  padding: 0;
}

.login-container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: var(--dynamic-padding);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--dynamic-card-radius);
  padding: clamp(20px, 5vw, 40px) clamp(16px, 4vw, 32px);
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  transform: translateY(-30px);
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 24px 24px 0 0;
}

.logo-container {
  text-align: center;
  margin-bottom: 32px;
}

.logo-wrapper {
  display: inline-block;
  margin-bottom: 10px;
}

.logo {
  width: 160px;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.welcome-text .title {
  font-size: 28px;
  font-weight: 700;
  color: #2d3748;
  margin: 0 0 8px 0;
  background: linear-gradient(135deg, #66b5ea, #004ec4);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-text .subtitle {
  font-size: 16px;
  color: #718096;
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-label {
  color: #718096;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.native-input {
  border: 2px solid #e2e8f0 !important;
  border-radius: 12px !important;
  padding: 16px !important;
  font-size: 16px;
  background: #ffffff;
  color: #2d3748;
  outline: none;
  transition: border-color 0.2s ease;
  min-height: 56px;
  box-sizing: border-box;
  width: 100%;
  font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.native-input::placeholder {
  color: #a0aec0;
}

.native-input:focus {
  border-color: #66b5ea;
}

.native-input:disabled {
  background: #f7fafc;
  cursor: not-allowed;
}

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

.password-wrapper .password-field {
  padding-right: 48px;
  width: 100%;
  flex: 1;
}

.password-wrapper .show-password-btn {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 46px;
  background: none;
  border: none;
  border-radius: 0 11px 11px 0;
  cursor: pointer;
  color: #a0aec0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.password-wrapper .show-password-btn:hover {
  background: rgba(102, 181, 234, 0.1);
  color: #66b5ea;
}

.password-wrapper .show-password-btn:focus {
  outline: none;
  background: rgba(102, 181, 234, 0.1);
  color: #66b5ea;
}

.password-wrapper .show-password-btn:active {
  background: rgba(102, 181, 234, 0.2);
}

.show-password-btn ion-icon {
  font-size: 20px;
  pointer-events: none;
}

#eye-icon {
  filter: brightness(0) saturate(100%) invert(62%) sepia(7%) saturate(1194%) hue-rotate(177deg) brightness(94%) contrast(84%);
  transition: filter 0.2s ease;
  pointer-events: none;
}

.password-wrapper .show-password-btn:hover #eye-icon {
  filter: brightness(0) saturate(100%) invert(56%) sepia(78%) saturate(1364%) hue-rotate(186deg) brightness(97%) contrast(91%);
}

.error-message {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-top: -8px;
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 4px solid;
  animation: slideIn 0.3s ease;
  color: #e53e3e;
  background: rgba(229, 62, 62, 0.1);
  border-left-color: #e53e3e;
}

.error-message .error-icon {
  font-size: 18px;
  flex-shrink: 0;
  color: #e53e3e;
}

.error-message span {
  line-height: 1.4;
  flex: 1;
}

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

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
}

.zeti-checkbox {
  position: relative;
  width: 20px;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid #e2e8f0;
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0 !important;
}

.zeti-checkbox:hover {
  border-color: #66b5ea;
}

.zeti-checkbox:focus {
  outline: none;
  border-color: #66b5ea;
  box-shadow: 0 0 0 3px rgba(102, 181, 234, 0.1);
}

.zeti-checkbox:checked {
  background: linear-gradient(135deg, #66b5ea 0%, #004ec4 100%);
  border-color: #66b5ea;
}

.zeti-checkbox:checked::before {
  content: '✓';
  position: absolute;
  color: white;
  font-size: 14px;
  font-weight: 700;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.zeti-checkbox:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.checkbox-label {
  color: #718096;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin: 0;
  user-select: none;
  transition: color 0.2s ease;
}

.checkbox-label:hover {
  color: #66b5ea;
}

.login-btn {
  background: linear-gradient(135deg, #0067ab 0%, #0067ab 100%);
  color: white;
  border: none;
  border-radius: 12px;
  height: 56px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.login-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

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

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

.login-btn:focus {
  outline: 2px solid rgba(102, 181, 234, 0.5);
  outline-offset: 2px;
}

.login-links {
  text-align: center;
  margin-top: 12px;
}

.forgot-password {
  background: none;
  border: none;
  color: #0067AB;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.forgot-password:hover {
  background: rgba(102, 181, 234, 0.1);
  text-decoration: underline;
}

.forgot-password:focus {
  outline: 1px solid rgba(102, 181, 234, 0.5);
  outline-offset: 1px;
}

.footer {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  line-height: 1.3;
}

.footer p {
  margin: 2px 0;
}

/* Ocultamos elementos del Django admin que no necesitamos */
.panel, .panel-primary2, .panel-heading, .panel-body, .panel-footer,
#contenedor, #heading, #contenedor_datos, #panel-abajo {
  display: none !important;
}

/* Media queries para diferentes tamaños de pantalla */

/* Pantallas medianas (tablets, teléfonos grandes) */
@media (max-width: 768px) {
  .login-container {
    padding: 16px;
    min-height: 100vh;
    justify-content: center;
  }

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

  .footer {
    position: relative;
    bottom: auto;
    margin-top: 20px;
  }
}

/* Teléfonos estándar (iPhone 8, Samsung Galaxy) */
@media (max-width: 480px) {
  .login-container {
    padding: 12px;
    justify-content: center;
  }

  .login-card {
    padding: 14px 23px;
    border-radius: 20px;
    padding-top: 7px;
    margin-top: 18px;
  }

  .logo-wrapper .logo {
    width: 150px;
  }

  .welcome-text .title {
    font-size: 24px;
  }

  .welcome-text .subtitle {
    font-size: 15px;
  }

  .native-input {
    min-height: 52px;
    font-size: 16px;
    padding: 14px;
  }

  .password-wrapper .password-field {
    padding-right: 44px;
  }

  .password-wrapper .show-password-btn {
    width: 42px;
  }

  .login-btn {
    height: 52px;
    font-size: 15px;
    margin-top: -4px;
  }

  .login-form {
    gap: 18px;
  }

  .input-label {
    font-size: 13px;
  }

  .checkbox-group {
    gap: 10px;
  }

  .zeti-checkbox {
    width: 18px;
    height: 18px;
  }

  .zeti-checkbox::before {
    font-size: 12px;
  }

  .checkbox-label {
    font-size: 13px;
  }
}

/* iPhone 7, iPhone 6s (375px) */
@media (max-width: 375px) {
  .login-container {
    padding: 10px;
    justify-content: center;
  }

  .login-card {
    padding: 24px 16px;
    border-radius: 18px;
  }

  .logo-container {
    margin-bottom: 24px;
  }

  .logo-wrapper .logo {
    width: 150px;
  }

  .welcome-text .title {
    font-size: 22px;
    margin-bottom: 6px;
  }

  .welcome-text .subtitle {
    font-size: 14px;
  }

  .native-input {
    min-height: 50px;
    font-size: 16px;
    padding: 12px;
  }

  .password-wrapper .password-field {
    padding-right: 42px;
  }

  .password-wrapper .show-password-btn {
    width: 40px;
  }

  .login-btn {
    height: 50px;
    font-size: 14px;
  }

  .login-form {
    gap: 16px;
  }

  .input-label {
    font-size: 12px;
    margin-bottom: 6px;
  }

  .footer {
    font-size: 9px;
  }

  .checkbox-group {
    gap: 8px;
  }

  .zeti-checkbox {
    width: 17px;
    height: 17px;
  }

  .zeti-checkbox::before {
    font-size: 11px;
  }

  .checkbox-label {
    font-size: 12px;
  }
}

/* Pantallas muy pequeñas como Nokia TA-1149 (320px) */
@media (max-width: 320px) {
  .login-container {
    padding: 8px;
    justify-content: center;
  }

  .login-card {
    padding: 20px 12px;
    border-radius: 16px;
  }

  .logo-container {
    margin-bottom: 20px;
  }

  .logo-wrapper .logo {
    width: 95px;
  }

  .welcome-text .title {
    font-size: 20px;
    margin-bottom: 4px;
  }

  .welcome-text .subtitle {
    font-size: 13px;
  }

  .native-input {
    min-height: 48px;
    font-size: 16px;
    padding: 10px;
  }

  .password-wrapper .password-field {
    padding-right: 38px;
  }

  .password-wrapper .show-password-btn {
    width: 36px;
  }

  .login-btn {
    height: 48px;
    font-size: 14px;
    margin-top: 12px;
  }

  .login-form {
    gap: 14px;
  }

  .input-group {
    gap: 6px;
  }

  .input-label {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .login-links {
    margin-top: 8px;
  }

  .forgot-password {
    font-size: 12px;
  }

  .footer {
    font-size: 8px;
    line-height: 1.2;
  }

  .checkbox-group {
    gap: 6px;
  }

  .zeti-checkbox {
    width: 16px;
    height: 16px;
  }

  .zeti-checkbox::before {
    font-size: 10px;
  }

  .checkbox-label {
    font-size: 11px;
  }
}

/* Ajustes para pantallas con poca altura (landscape) */
@media (max-height: 500px) {
  .login-container {
    min-height: auto;
    justify-content: flex-start;
    padding-top: 20px;
  }

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

  .footer {
    position: relative;
    margin-top: 15px;
  }
}

/* Pantallas muy pequeñas con poca altura (landscape en teléfonos pequeños) */
@media (max-width: 480px) and (max-height: 400px) {
  .login-container {
    padding: 8px;
    padding-top: 10px;
  }

  .login-card {
    padding: 16px 12px;
  }

  .logo-container {
    margin-bottom: 16px;
  }

  .logo-wrapper .logo {
    width: 70px;
  }

  .welcome-text .title {
    font-size: 18px;
  }

  .welcome-text .subtitle {
    font-size: 12px;
  }

  .login-form {
    gap: 12px;
  }

  .native-input {
    min-height: 44px;
    padding: 8px;
  }

  .login-btn {
    height: 44px;
    margin-top: 8px;
  }

  .footer {
    margin-top: 10px;
    font-size: 7px;
  }
}

/* iPhone SE y dispositivos muy pequeños (max 280px) */
@media (max-width: 280px) {
  .login-container {
    padding: 6px;
    padding-top: 15px;
  }

  .login-card {
    padding: 16px 8px;
    border-radius: 12px;
  }

  .logo-wrapper .logo {
    width: 70px;
  }

  .welcome-text .title {
    font-size: 18px;
  }

  .welcome-text .subtitle {
    font-size: 12px;
  }

  .native-input {
    min-height: 46px;
    font-size: 16px;
    padding: 8px;
  }

  .password-wrapper .password-field {
    padding-right: 34px;
  }

  .password-wrapper .show-password-btn {
    width: 32px;
  }

  .login-btn {
    height: 46px;
    font-size: 13px;
  }

  .input-label {
    font-size: 10px;
  }

  .footer {
    font-size: 7px;
  }
}
