/* ==========================================================================
 * SISTEMA TGC  - Estilos para la pantalla de LOGIN.
 *
 * Dev: Aarón Hernández
 * aaron.hg@outlook.com
 * ========================================================================== */

:root {
  /* Tokens de Color Primarios y Corporativos */
  --color-primary: #002147;
  --color-primary-hover: #001733;
  --color-primary-light: #004b99;
  --color-accent-cyan: #0284c7;
  
  /* Superficies y Fondos */
  --bg-app: #f4f7fc;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-input-focus: #fafcff;
  
  /* Tipografía y Neutros */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-placeholder: #94a3b8;
  --text-brand: #002147;
  
  /* Bordes y Separadores */
  --border-card: #e2e8f0;
  --border-input: #cbd5e1;
  --border-input-focus: #002147;

  /* Estados de Validación */
  --color-error: #dc2626;
  --color-error-bg: #fef2f2;
  --color-error-border: #fecaca;
  --color-success: #16a34a;
  --color-success-bg: #f0fdf4;
  --color-success-border: #bbf7d0;
  --shadow-card: 0 20px 40px -15px rgba(0, 33, 71, 0.07), 0 0 1px 1px rgba(0, 33, 71, 0.05);
  --shadow-input-focus: 0 0 0 3px rgba(0, 33, 71, 0.12);
  --shadow-btn: 0 4px 12px rgba(0, 33, 71, 0.18);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.logistics-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 680px;
  height: 680px;
  background: radial-gradient(circle, rgba(0, 75, 153, 0.065) 0%, rgba(2, 132, 199, 0.02) 45%, transparent 70%);
  filter: blur(40px);
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(0, 33, 71, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 33, 71, 0.025) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.85;
}

.road-network {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
}

.hub-dot {
  fill: #002147;
}

.hub-pulse {
  fill: none;
  stroke: #0284c7;
  stroke-width: 1.5;
  opacity: 0.4;
}

.hub-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  fill: #64748b;
  letter-spacing: 0.08em;
}

.login-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 40px 36px 36px;
  position: relative;
  overflow: hidden;
}

.card-accent-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #002147 0%, #004b99 50%, #0284c7 100%);
}

.brand-header {
  text-align: center;
  margin-bottom: 28px;
}

.brand-logo-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 18px;
}

.company-name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--color-primary);
  text-transform: uppercase;
}

.company-sub {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-main);
  text-transform: uppercase;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.15s ease;
}

.form-input {
  width: 100%;
  height: 44px;
  padding: 0 42px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.2s ease;
}

.form-input::placeholder {
  color: var(--text-placeholder);
}

.form-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-input-focus);
  box-shadow: var(--shadow-input-focus);
}

.input-container:focus-within .input-icon {
  color: var(--color-primary);
}

/* Toggle Contraseña */
.toggle-password-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s;
}

.toggle-password-btn:hover {
  color: var(--text-main);
}

.eye-icon {
  width: 18px;
  height: 18px;
}

.error-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-error);
  min-height: 14px;
  display: none;
}

.form-group.has-error .form-input {
  border-color: var(--color-error);
  background-color: var(--color-error-bg);
}

.form-group.has-error .error-text {
  display: block;
}

.form-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkbox-custom {
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--border-input);
  border-radius: 4px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.checkbox-container input:checked ~ .checkbox-custom {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.checkbox-container input:checked ~ .checkbox-custom::after {
  content: '';
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.forgot-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  transition: opacity 0.15s;
}

.forgot-link:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* Botón Principal */
.btn-primary {
  width: 100%;
  height: 46px;
  background-color: var(--color-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: all 0.2s ease;
  position: relative;
  margin-top: 6px;
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
}

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

.btn-arrow {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.btn-primary:hover .btn-arrow {
  transform: translateX(3px);
}

.btn-loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.7s linear infinite;
}

.btn-primary.loading .btn-text,
.btn-primary.loading .btn-arrow {
  display: none;
}

.btn-primary.loading .btn-loader {
  display: block;
}

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

.alert-box {
  display: none;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.alert-box.alert-error {
  display: block;
  background-color: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  color: var(--color-error);
}

.alert-box.alert-success {
  display: block;
  background-color: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success);
}

/* Pie de Página Institucional */

.login-footer {
  margin-top: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.copyright {
  font-size: 12px;
  color: var(--text-muted);
}

.footer-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.separator {
  color: #cbd5e1;
}

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

  .login-wrapper {
    padding: 12px 4px;
    max-width: 100%;
  }

  .login-card {
    padding: 28px 20px 24px;
    border-radius: var(--radius-md);
  }

  .brand-header {
    margin-bottom: 20px;
  }

  .brand-logo-text {
    margin-bottom: 12px;
  }

  .login-title {
    font-size: 20px;
  }

  .login-subtitle {
    font-size: 12px;
  }

  .footer-nav {
    flex-wrap: wrap;
    gap: 6px 12px;
  }

  .road-network {
    opacity: 0.6;
  }
}

@media (max-width: 480px) {
  body {
    padding: 8px 4px;
  }

  .login-wrapper {
    padding: 8px 0;
  }

  .login-card {
    padding: 24px 16px 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 33, 71, 0.1);
  }

  .company-name {
    font-size: 12px;
    letter-spacing: 0.08em;
  }

  .company-sub {
    font-size: 9px;
  }

  .login-title {
    font-size: 18px;
  }

  .form-actions-row {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12px;
  }

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

  .form-input {
    font-size: 14px;
    height: 42px;
  }

  .btn-primary {
    height: 44px;
    font-size: 13px;
  }

  .login-footer {
    margin-top: 16px;
    gap: 6px;
  }

  .footer-link,
  .copyright {
    font-size: 11px;
  }
}

@media (max-width: 360px) {
  .login-card {
    padding: 20px 12px 16px;
  }

  .form-actions-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}