/* ==========================================================================
   SISTEMA DE DISEÑO Y VARIABLES (AESTHETIC PREMIUM)
   ========================================================================== */
:root {
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Paleta de Colores Moderna (Dark Mode) */
  --bg-app: radial-gradient(circle at top center, #1b1b22 0%, #0d0d10 100%);
  --bg-card: rgba(30, 30, 38, 0.6);
  --bg-card-hover: rgba(40, 40, 50, 0.8);
  --border-glass: 1px solid rgba(255, 255, 255, 0.08);
  --shadow-premium: 0 12px 40px rgba(0, 0, 0, 0.5);
  
  --text-main: #f0f0f5;
  --text-muted: #9a9aab;
  
  /* Colores de Estados de Carga (Neon Glow) */
  --color-available: #2ecc71;
  --bg-available: rgba(46, 204, 113, 0.12);
  --glow-available: 0 0 12px rgba(46, 204, 113, 0.3);
  
  --color-charging: #3498db;
  --bg-charging: rgba(52, 152, 219, 0.12);
  --glow-charging: 0 0 12px rgba(52, 152, 219, 0.3);
  
  --color-preparing: #f1c40f;
  --bg-preparing: rgba(241, 196, 15, 0.12);
  --glow-preparing: 0 0 12px rgba(241, 196, 15, 0.3);
  
  --color-error: #e74c3c;
  --bg-error: rgba(231, 76, 60, 0.12);
  --glow-error: 0 0 12px rgba(231, 76, 60, 0.3);
  
  --color-offline: #7f8c8d;
  --bg-offline: rgba(127, 140, 141, 0.12);
  
  /* Botones y Acentos */
  --color-accent: #8e44ad;
  --color-accent-hover: #9b59b6;
  --glow-accent: 0 0 15px rgba(142, 68, 173, 0.4);
}

/* ==========================================================================
   RESET Y ESTILOS GENERALES
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* Evitar que se arrastre la pantalla en PWA iOS */
html, body {
  overscroll-behavior-y: contain;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   EFECTO CRISTAL (GLASSMORPHISM)
   ========================================================================== */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: var(--border-glass);
  border-radius: 20px;
  box-shadow: var(--shadow-premium);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ==========================================================================
   PANTALLA DE ACCESO (PIN)
   ========================================================================== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 13, 16, 0.65);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 40px 30px;
  text-align: center;
}

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

.app-logo {
  width: 90px;
  height: 90px;
  border-radius: 22px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-card h2 {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.login-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 30px;
  line-height: 1.5;
}

.login-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.login-input-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.login-select, .login-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 16px;
  padding: 14px;
  border-radius: 12px;
  transition: all 0.3s;
  font-family: inherit;
  box-sizing: border-box;
}

.login-select option {
  background: #1a1a2e;
  color: #fff;
  padding: 10px;
}

.login-select:focus, .login-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}

.error-msg {
  color: #ff3b30;
  font-size: 13px;
  margin-top: 15px;
  min-height: 18px;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
#app-container {
  width: 100%;
  max-width: 600px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0 auto;
}

.app-header {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-title {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-logo {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.logo-title h1 {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 30%, #a8a8c4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-version {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Badge de estado del monitor */
.status-indicator-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 14px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.green {
  background-color: var(--color-available);
  box-shadow: var(--glow-available);
}

.dot.red {
  background-color: var(--color-error);
  box-shadow: var(--glow-error);
}

.dot.gray {
  background-color: var(--color-offline);
}

/* ==========================================================================
   SECCIÓN DE BOTONES DE CONTROL
   ========================================================================== */
.controls-card {
  padding: 22px;
}

.sync-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 18px;
  color: var(--text-muted);
}

.sync-time {
  font-weight: 600;
  color: var(--text-main);
}

.control-buttons {
  display: flex;
  gap: 10px;
}

/* Botones Base */
.btn {
  flex: 1;
  border: none;
  padding: 9px 8px;
  border-radius: 11px;
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn:disabled {
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn-icon {
  font-size: 14px;
}

.btn-primary {
  background: var(--color-accent);
  box-shadow: var(--glow-accent);
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.btn-success {
  background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
  box-shadow: 0 4px 15px rgba(39, 174, 96, 0.2);
}

.btn-success:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #c0392b 0%, #962d22 100%);
  box-shadow: 0 4px 15px rgba(192, 57, 43, 0.2);
}

.btn-danger:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(192, 57, 43, 0.4);
}

.btn-info {
  background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
  box-shadow: 0 4px 15px rgba(41, 128, 185, 0.2);
}

.btn-info:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(41, 128, 185, 0.4);
}

.btn-accent {
  background: linear-gradient(135deg, var(--color-accent) 0%, #7d3c98 100%);
  box-shadow: var(--glow-accent);
  max-width: 160px;
}

/* Animación del spinner */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinning {
  animation: spin 1s linear infinite;
  display: inline-block;
}

/* ==========================================================================
   SECCIÓN DE ALERTAS PWA OPT-IN
   ========================================================================== */
.optin-card {
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(142, 68, 173, 0.15) 0%, rgba(30, 30, 38, 0.6) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border: 1px solid rgba(142, 68, 173, 0.2);
}

.optin-content {
  display: flex;
  align-items: center;
  gap: 15px;
}

.optin-icon {
  font-size: 28px;
}

.optin-text h3 {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.optin-text p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   CARGAS POR UBICACIÓN Y TARJETAS DE CARGADORES
   ========================================================================== */
.locations-grid {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin-top: 15px; /* Separación elegante respecto a controles */
}

.location-section h2 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chargers-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Tarjeta de Conector Individual */
.connector-card {
  padding: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.connector-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

/* Estado neutro o apagado (atenuado) */
.connector-card.unmonitored {
  opacity: 0.6;
  border-color: rgba(255, 255, 255, 0.04);
}

.connector-card.unmonitored:hover {
  opacity: 0.8;
  background: rgba(30, 30, 38, 0.4);
}

.connector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.connector-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connector-icon {
  font-size: 20px;
  color: var(--text-muted);
}

.connector-title {
  display: flex;
  flex-direction: column;
}

.connector-name {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
}

.connector-power {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Badge de Estado */
.status-badge {
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Aplicación de Estilos por Estado */
.status-Available {
  color: var(--color-available);
  background: var(--bg-available);
  box-shadow: var(--glow-available);
  border: 1px solid rgba(46, 204, 113, 0.2);
}

.status-Charging {
  color: var(--color-charging);
  background: var(--bg-charging);
  box-shadow: var(--glow-charging);
  border: 1px solid rgba(52, 152, 219, 0.2);
}

.status-SuspendedEV {
  color: #7986cb;
  background: rgba(121, 134, 203, 0.12);
  box-shadow: 0 0 12px rgba(121, 134, 203, 0.3);
  border: 1px solid rgba(121, 134, 203, 0.2);
}

.status-Finishing {
  color: #1abc9c;
  background: rgba(26, 188, 156, 0.12);
  box-shadow: 0 0 12px rgba(26, 188, 156, 0.3);
  border: 1px solid rgba(26, 188, 156, 0.2);
}

.status-Preparing {
  color: var(--color-preparing);
  background: var(--bg-preparing);
  box-shadow: var(--glow-preparing);
  border: 1px solid rgba(241, 196, 15, 0.2);
}

.status-OutOfOrder {
  color: var(--color-error);
  background: var(--bg-error);
  box-shadow: var(--glow-error);
  border: 1px solid rgba(231, 76, 60, 0.2);
}

.status-PossibleFault {
  color: #e67e22;
  background: rgba(230, 126, 34, 0.12);
  box-shadow: 0 0 12px rgba(230, 126, 34, 0.3);
  border: 1px solid rgba(230, 126, 34, 0.2);
}

.status-Disconnected {
  color: var(--color-offline);
  background: var(--bg-offline);
  border: 1px solid rgba(127, 140, 141, 0.2);
}

/* Estado de Espera / Sin monitorizar (Gris Muted Neutro) */
.status-Waiting {
  color: #9a9aab;
  background: rgba(154, 154, 171, 0.1);
  border: 1px solid rgba(154, 154, 171, 0.15);
}

/* ==========================================================================
   PANEL DE DETALLES TÉCNICOS (DESPLEGABLE)
   ========================================================================== */
.connector-details {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideDown 0.3s ease-out;
}

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

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.detail-value {
  font-size: 12px;
  font-weight: 500;
}

/* ==========================================================================
   SKELETON LOADER
   ========================================================================== */
.skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.skeleton-card {
  height: 70px;
  background: linear-gradient(90deg, rgba(30, 30, 38, 0.3) 25%, rgba(50, 50, 60, 0.4) 50%, rgba(30, 30, 38, 0.3) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 20px;
  border: var(--border-glass);
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================================================
   APP FOOTER
   ========================================================================== */
.app-footer {
  text-align: center;
  padding: 30px 0 10px;
  color: var(--text-muted);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-accent-hover);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-decoration: underline;
}

/* Ajustes responsivos para pantallas muy pequeñas (iPhone SE) */
@media (max-width: 360px) {
  .control-buttons {
    flex-direction: column;
    gap: 8px;
  }
  
  .app-header h1 {
    font-size: 19px;
  }
}

/* ==========================================================================
   ESTILOS DE TIEMPO ACTIVO (UPTIME MONITOR)
   ========================================================================== */
.uptime-container {
  margin-top: 25px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideDown 0.3s ease-out;
}

.uptime-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  width: 100%;
}

.uptime-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.uptime-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.uptime-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.uptime-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.uptime-value.monospace {
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
  letter-spacing: 0.5px;
  color: #58d68d;
  text-shadow: 0 0 8px rgba(88, 214, 141, 0.2);
}

/* Animación de pulso para estados en transición */
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.pulse {
  animation: pulse 1.5s infinite ease-in-out;
  display: inline-block;
}

.dot.yellow {
  background-color: var(--color-preparing);
  box-shadow: var(--glow-preparing);
}

/* ==========================================================================
   ESTILOS DE BOTÓN DE CAMBIO DE TEMA Y MODO CLARO (AESTHETIC PREMIUM)
   ========================================================================== */
.btn-theme-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: var(--border-glass);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 20px;
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
}

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

/* Variables del Modo Claro */
.light-theme {
  --bg-app: radial-gradient(circle at top center, #f5f6fa 0%, #e9ecf3 100%);
  --bg-card: rgba(255, 255, 255, 0.65);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --border-glass: 1px solid rgba(0, 0, 0, 0.07);
  --shadow-premium: 0 10px 30px rgba(160, 168, 195, 0.15);
  
  --text-main: #232329;
  --text-muted: #6a6a7c;
  
  /* Opacidades más altas para mejor contraste del texto en modo claro */
  --bg-available: rgba(46, 204, 113, 0.16);
  --bg-charging: rgba(52, 152, 219, 0.16);
  --bg-preparing: rgba(241, 196, 15, 0.18);
  --bg-error: rgba(231, 76, 60, 0.16);
  --bg-offline: rgba(127, 140, 141, 0.16);
  
  /* Brillo más sutil */
  --glow-available: 0 2px 8px rgba(46, 204, 113, 0.15);
  --glow-charging: 0 2px 8px rgba(52, 152, 219, 0.15);
  --glow-preparing: 0 2px 8px rgba(241, 196, 15, 0.15);
  --glow-error: 0 2px 8px rgba(231, 76, 60, 0.15);
}

/* Ajustes de legibilidad adicionales para el Modo Claro */
.light-theme .logo-title h1 {
  background: linear-gradient(135deg, #1e1e24 30%, #4a4a58 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.light-theme .btn-theme-toggle {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-main);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 10px rgba(160, 168, 195, 0.08);
}

.light-theme .btn-theme-toggle:hover {
  background: rgba(0, 0, 0, 0.08);
  box-shadow: 0 6px 15px rgba(160, 168, 195, 0.15);
}

.light-theme .status-indicator-badge {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.light-theme .status-Waiting {
  color: #5f5f6e;
  background: rgba(95, 95, 110, 0.08);
  border: 1px solid rgba(95, 95, 110, 0.12);
}

.light-theme #pin-input {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #232329;
}

.light-theme .connector-card.unmonitored {
  opacity: 0.7;
}

.light-theme .connector-card.unmonitored:hover {
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.95);
}

/* ==========================================================================
   BOTONES DE ACCIONES DE CARGA (START / STOP)
   ========================================================================== */
.connector-actions {
  display: flex;
  margin-top: 15px;
  gap: 10px;
}

.btn-action {
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  color: #ffffff;
}

/* Estilo Iniciar Carga (Verde Esmeralda/Teal Premium) */
.btn-action.start-btn {
  background: linear-gradient(135deg, #1abc9c 0%, #2ecc71 100%);
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.25);
}

.btn-action.start-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #16a085 0%, #27ae60 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(46, 204, 113, 0.4);
}

/* Estilo Detener Carga (Crimson/Coral Premium) */
.btn-action.stop-btn {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.25);
}

.btn-action.stop-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #c0392b 0%, #962d22 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(231, 76, 60, 0.4);
}

.btn-action:active:not(:disabled) {
  transform: translateY(0);
}

.btn-action:disabled {
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.5;
}

/* Estilos de estados de animación */
.action-btn-icon.spinning {
  display: inline-block;
  animation: spin 1s infinite linear;
}

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

/* Adaptación del Modo Claro para los botones de acción */
.light-theme .btn-action {
  box-shadow: 0 4px 10px rgba(160, 168, 195, 0.2);
}

.light-theme .btn-action.start-btn {
  background: linear-gradient(135deg, #1abc9c 0%, #2ecc71 100%);
}

.light-theme .btn-action.stop-btn {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

/* ==========================================================================
   SWITCH TOGGLE (NOTIFICACIONES DE UBICACIÓN)
   ========================================================================== */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--color-available);
  border-color: rgba(46, 204, 113, 0.4);
}

input:checked + .slider:before {
  transform: translateX(18px);
}

.slider.round {
  border-radius: 20px;
}

.slider.round:before {
  border-radius: 50%;
}

.notif-toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: normal;
}

.notif-toggle-label {
  font-size: 14px;
  opacity: 0.7;
}

/* ==========================================================================
   HISTORIAL DE CAMBIOS DE ESTADO
   ========================================================================== */
.details-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 5px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 4px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 2px;
}

.history-empty {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin: 5px 0;
  text-align: center;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.history-time {
  font-family: monospace;
  color: var(--text-muted);
}

.history-change {
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-status {
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}

.history-arrow {
  color: var(--text-muted);
  font-size: 10px;
}

/* Botón para expandir/colapsar datos técnicos */
.btn-tech-toggle {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.btn-tech-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

/* Enlaces estilo botón */
.btn-link-action {
  background: none;
  border: none;
  color: var(--color-accent-hover);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-decoration: underline;
  text-align: center;
  margin: 5px auto 0;
  display: block;
}

.btn-link-action:hover {
  color: #fff;
}

/* ==========================================================================
   MODAL DE HISTORIAL COMPLETO
   ========================================================================== */
.modal-card {
  width: 100%;
  max-width: 480px;
  padding: 24px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 15px;
  border: var(--border-glass);
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-premium);
  color: var(--text-main);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
}

.light-theme .modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.modal-header h3 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

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

.modal-body {
  overflow-y: auto;
  max-height: calc(80vh - 100px);
  padding-right: 5px;
}

.history-list-full {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-list-full .history-item {
  padding: 8px 12px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.light-theme .history-list-full .history-item {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.light-theme .overlay {
  background: rgba(233, 236, 243, 0.65);
}

/* Scrollbar tuning */
.history-list::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
  width: 4px;
}

.history-list::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.light-theme .history-list::-webkit-scrollbar-thumb,
.light-theme .modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}
