/* system-font configuration */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Plus+Jakarta+Sans:wght@300;400;600;700&display=swap');

:root {
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  
  --bg-gradient: radial-gradient(circle at top left, #0d0f1a, #07080d);
  --glass-bg: rgba(20, 25, 45, 0.45);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.5);
  
  /* Status Colors */
  --color-success: #10b981;
  --color-error: #ef4444;
  --color-warning: #f59e0b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  transition: background-color 0.15s ease-out; /* Sincronización rápida de cambios de color */
}

/* Glassmorphism Card Container */
.glass-container {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  width: 90%;
  max-width: 450px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

h1 {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* Call-To-Action Button */
.btn-action {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.1rem;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  border: none;
  border-radius: 16px;
  padding: 1rem 2rem;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 8px 24px var(--accent-glow);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.7);
}

.btn-action:active {
  transform: translateY(1px);
}

/* Connection Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 1.5rem;
}

.status-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning);
}

.status-badge.connected .dot {
  background-color: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.status-badge.disconnected .dot {
  background-color: var(--color-error);
  box-shadow: 0 0 8px var(--color-error);
}

/* Notification banner for manual user actions */
.banner-instruction {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 16px;
  padding: 1rem;
  margin-top: 1.5rem;
  color: #fbbf24;
  font-size: 0.85rem;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: left;
}

/* Admin Dashboard Grid Layout */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
  width: 100%;
}

@media(min-width: 768px) {
  .admin-container {
    max-width: 800px;
    width: 95%;
  }
  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.admin-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  padding: 1.5rem;
  text-align: left;
}

.admin-card h2 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.5rem;
  color: #fff;
}

/* Predefined Color Presets Grid */
.color-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.color-btn {
  height: 48px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.color-btn:hover {
  transform: scale(1.08);
  border-color: #fff;
}

.color-btn.active {
  border-color: #fff;
  box-shadow: 0 0 15px currentColor;
}

/* Custom Color Picker Styling */
.custom-color-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.custom-color-picker {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 50px;
  height: 50px;
  background-color: transparent;
  border: none;
  cursor: pointer;
}

.custom-color-picker::-webkit-color-swatch {
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Control Group for Toggles/Sliders */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Input Fields & Selects */
.input-select, .input-range {
  width: 100%;
  background: #14192d; /* Fondo sólido oscuro para evitar fallbacks transparentes del navegador */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.75rem;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-select option {
  background-color: #14192d; /* Asegura un fondo oscuro para las opciones */
  color: #fff; /* Texto blanco para legibilidad */
}

.input-select:focus {
  border-color: var(--accent);
}

/* Stats and logs panel */
.stats-panel {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.75rem 1rem;
  border-radius: 12px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
}

.stats-val {
  font-family: monospace;
  color: #e5e7eb;
}

/* Switch Styles */
.switch-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.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: .3s;
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
  background-color: var(--accent);
}

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

/* User Screen State (Interactive overlay) */
.user-show-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10;
  background-color: #000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 2rem;
  transition: background-color 0.05s ease-out; /* Cambio de color ultra rápido */
}

.user-show-overlay.active {
  display: flex;
}

.overlay-status {
  background: rgba(0, 0, 0, 0.6);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.75rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.btn-exit {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.85rem;
  backdrop-filter: blur(10px);
  transition: background 0.2s;
}

.btn-exit:hover {
  background: rgba(255, 255, 255, 0.25);
}

.pulse-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
  }
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}
