﻿/* ==========================================================================
  LOGIN, TARJETA DE ACCESO Y CONTROLES DE SESION
   ========================================================================== */
/* ==========================================================================
  CONTENEDOR DE TARJETA (GLASSMORPHISM)
   ========================================================================== */
.glass-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 40px;
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  box-shadow:
    0 4px 30px rgba(0, 0, 0, 0.4),
    0 1px 3px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 40px var(--card-glow);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
  margin: 20px;
}

.glass-card:hover {
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.6),
    0 1px 5px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 0 50px rgba(99, 102, 241, 0.08);
}

/* ==========================================================================
  CABECERA Y TÍTULOS
   ========================================================================== */
.card-section {
  width: 100%;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.card-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo-container {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
  margin-bottom: 20px;
  color: #fff;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* Logo imagen (reemplaza el SVG) */
.logo-img-container {
  background: none;
  box-shadow: none;
  width: auto;
  height: auto;
  border-radius: 0;
}

.logo-img {
  width: 180px;
  height: auto;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

.logo {
  width: 32px;
  height: 32px;
}

h1,
h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #d1d5db 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
  FORMULARIOS Y CAMPOS DE ENTRADA
   ========================================================================== */
form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.input-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px 14px 44px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 15px;
  outline: none;
  transition: var(--transition-smooth);
}

.input-wrapper input:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.input-wrapper input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: var(--transition-fast);
}

.input-wrapper input:focus~.input-icon {
  color: var(--primary);
}

/* Mostrar/Ocultar contraseña */
.btn-toggle-password {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: var(--transition-fast);
}

.btn-toggle-password:hover {
  color: #fff;
}

.icon-eye {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
  BOTONES
  ========================================================================== */
.btn-primary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 14px 20px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  margin-top: 10px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 20px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  transition: var(--transition-smooth);
  margin-top: 24px;
}

.btn-secondary:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 14px 20px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-icon {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
  ESTADO DE CARGA (SPINNER)
   ========================================================================== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  position: absolute;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-primary.loading .btn-text {
  visibility: hidden;
  opacity: 0;
}

.btn-primary.loading .spinner {
  display: block !important;
}

/* ==========================================================================
  ESTILOS DE HISTORIAL DE CONEXIONES
   ========================================================================== */
.login-history-container {
  margin-top: 24px;
  text-align: left;
}

.login-history-container h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.history-list {
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

/* Scrollbar Personalizado */
.history-list::-webkit-scrollbar {
  width: 4px;
}

.history-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.history-item {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: var(--transition-fast);
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.06);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: #fff;
}

.history-item-device {
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-item-ip {
  color: #a78bfa;
  font-family: monospace;
}

.history-item-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 11px;
}

.history-item-placeholder,
.history-item-empty {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 0;
  background: rgba(0, 0, 0, 0.1);
  border: 1px dashed rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

/* Ajustes Responsive */
@media (max-width: 480px) {
  .glass-card {
    padding: 30px 20px;
    margin: 16px;
    border-radius: 20px;
  }

  .avatar {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }
}

body.light-theme h1,
body.light-theme h2 {
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: #0f172a !important;
  color: #0f172a;
}

body.light-theme .subtitle {
  color: #64748b;
}

body.light-theme .input-group label {
  color: #64748b;
}

body.light-theme .btn-toggle-password {
  color: #64748b;
}

body.light-theme .input-wrapper input {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(0, 0, 0, 0.2);
  color: #0f172a;
}

body.light-theme .input-wrapper input:focus {
  background: rgba(0, 0, 0, 0.05);
}

body.light-theme .input-wrapper input::placeholder {
  color: rgba(0, 0, 0, 0.4);
}

body.light-theme .btn-toggle-password:hover {
  color: #0f172a;
}

body.light-theme .btn-primary {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(0, 0, 0, 0.2);
  color: #0f172a;
}

body.light-theme .btn-primary:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.3);
}

body.light-theme .user-details {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(0, 0, 0, 0.05);
}

body.light-theme .detail-value {
  color: #0f172a;
}

body.light-theme .history-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
}

body.light-theme .history-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

body.light-theme .history-item {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.05);
}

body.light-theme .history-item:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .history-item-header {
  color: #0f172a;
}

body.light-theme .history-item-placeholder,
body.light-theme .history-item-empty {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
  THEME SWITCH (TOP RIGHT)
   ========================================================================== */
.theme-switch-container {
  position: absolute;
  top: 60px;
  right: 24px;
  z-index: 1000;
  transition: var(--transition-smooth);
}

.theme-switch {
  display: inline-block;
  width: 66px;
  height: 32px;
  position: relative;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.theme-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 34px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: 0.4s;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-slider-circle {
  position: absolute;
  height: 24px;
  width: 24px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), background-color 0.4s;
  z-index: 2;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.theme-icons {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: space-between;
  position: absolute;
  top: 0;
  left: 0;
  padding: 0 9px;
  z-index: 3;
  pointer-events: none;
}

.icon-sun-switch,
.icon-moon-switch {
  width: 14px;
  height: 14px;
  transition: 0.4s;
}

/* Modo oscuro (Luna activa, círculo a la derecha) */
body:not(.light-theme) .theme-slider-circle {
  transform: translateX(34px);
  background-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

body:not(.light-theme) .icon-sun-switch {
  color: #6b7280;
}

body:not(.light-theme) .icon-moon-switch {
  color: #e2e8f0;
}

/* Modo claro (Sol activo, círculo a la izquierda) */
body.light-theme .theme-slider {
  background-color: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

body.light-theme .theme-slider-circle {
  transform: translateX(0);
  background-color: #fff;
}

body.light-theme .icon-sun-switch {
  color: #d97706;
}

body.light-theme .icon-moon-switch {
  color: #9ca3af;
}

@media (max-width: 480px) {
  .theme-switch-container {
    top: 52px;
    right: 16px;
  }
}

/* Fix para botón secundario (Cerrar Sesión) en index.html modo claro */
body.light-theme .btn-secondary {
  color: #1e293b;
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.05);
}

body.light-theme .btn-secondary:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #0f172a;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: 0.2s;
  padding: 0;
}

.btn-close-modal:hover {
  color: #fff;
}

body.light-theme .btn-close-modal:hover {
  color: #000;
}


