/* Variables y Estilos Base */
:root {
  --bg-color: #0b0b0c;
  --card-bg: rgba(22, 22, 26, 0.65);
  --card-border: rgba(255, 255, 255, 0.08);
  --netflix-red: #e50914;
  --netflix-red-hover: #b80710;
  --netflix-red-glow: rgba(229, 9, 20, 0.45);
  --text-primary: #ffffff;
  --text-secondary: #a3a3a3;
  --text-muted: #666666;
  --success-color: #2e7d32;
  --success-glow: rgba(46, 125, 50, 0.3);
  --warning-color: #ef6c00;
  --warning-glow: rgba(239, 108, 0, 0.3);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Fondo Glow */
.background-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--netflix-red-glow) 0%, rgba(11, 11, 12, 0) 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(40px);
  animation: glowPulse 8s infinite alternate ease-in-out;
}

@keyframes glowPulse {
  0% {
    width: 500px;
    height: 500px;
    opacity: 0.8;
  }
  100% {
    width: 700px;
    height: 700px;
    opacity: 1.2;
  }
}

/* Contenedor Principal */
.container {
  width: 100%;
  max-width: 480px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 16px;
}

.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.logo-red {
  color: var(--netflix-red);
  text-shadow: 0 0 10px var(--netflix-red-glow);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Selector de Idioma */
.lang-switcher {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 2px;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background: var(--netflix-red);
  color: var(--text-primary);
  box-shadow: 0 0 8px var(--netflix-red-glow);
}

.badge-status {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.pulse-green {
  background-color: #4caf50;
  box-shadow: 0 0 8px #4caf50;
  animation: dotPulse 2s infinite alternate;
}

@keyframes dotPulse {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* Tarjeta Principal (Glassmorphism) */
.main-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 60%);
  pointer-events: none;
}

.card-content {
  position: relative;
  z-index: 2;
}

/* Vistas de Estado */
.status-view {
  display: none;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.4s ease-out;
}

.status-view.active {
  display: flex;
}

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

/* Badges */
.badge-type {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 6px 16px;
  border-radius: 50px;
  margin-bottom: 20px;
}

.code-badge {
  background-color: var(--netflix-red);
  color: var(--text-primary);
  box-shadow: 0 0 12px var(--netflix-red-glow);
}

.success-badge {
  background-color: var(--success-color);
  color: var(--text-primary);
  box-shadow: 0 0 12px var(--success-glow);
}

.warning-badge {
  background-color: var(--warning-color);
  color: var(--text-primary);
  box-shadow: 0 0 12px var(--warning-glow);
}

/* Iconos Centrales */
.icon-container {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 36px;
  margin-bottom: 24px;
}

.none-icon {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.code-icon {
  background: rgba(229, 9, 20, 0.1);
  color: var(--netflix-red);
  border: 1px solid rgba(229, 9, 20, 0.2);
}

.success-icon {
  background: rgba(46, 125, 50, 0.15);
  color: #66bb6a;
  border: 1px solid rgba(46, 125, 50, 0.3);
}

.loading-icon {
  background: rgba(239, 108, 0, 0.15);
  color: #ffb74d;
  border: 1px solid rgba(239, 108, 0, 0.3);
}

h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.description {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

/* Contenedor de Código */
.code-container {
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px 24px;
  gap: 16px;
  width: 100%;
  margin-bottom: 24px;
}

.code-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 52px;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--text-primary);
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.15);
}

.copy-button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  width: 50px;
  height: 50px;
  border-radius: 12px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
}

.copy-button:hover {
  background: var(--text-primary);
  color: #000;
  transform: scale(1.05);
}

.copy-button:active {
  transform: scale(0.95);
}

/* Barra de Progreso y Expiración */
.timer-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timer-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.timer-bar-fill {
  width: 100%;
  height: 100%;
  background: var(--netflix-red);
  box-shadow: 0 0 8px var(--netflix-red-glow);
  border-radius: 3px;
  transition: width 1s linear;
}

.timer-text {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Caja de Dispositivos del Hogar */
.devices-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(46, 125, 50, 0.06);
  border: 1px solid rgba(46, 125, 50, 0.2);
  border-radius: 14px;
  padding: 16px;
  width: 100%;
  margin-bottom: 24px;
  color: #81c784;
  font-weight: 600;
}

.devices-box i {
  font-size: 22px;
}

.time-elapsed-container {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

/* SECCIÓN: Historial de Códigos Activos */
.active-list-section {
  margin-top: 28px;
  text-align: left;
}

.divider {
  height: 1px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0));
  margin-bottom: 20px;
}

.active-list-section h3 {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
  text-align: center;
}

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

.active-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px 16px;
  transition: all 0.2s ease;
}

.active-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.active-item-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  overflow: hidden;
}

.active-item-icon {
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.active-item-icon.code {
  background: rgba(229, 9, 20, 0.15);
  color: #ff5252;
}

.active-item-icon.confirmed {
  background: rgba(46, 125, 50, 0.15);
  color: #66bb6a;
}

.active-item-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-item-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.active-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.active-item-code-box {
  font-family: 'Share Tech Mono', monospace;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 1px;
}

.active-item-copy-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s;
}

.active-item-copy-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.active-item-timer {
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 8px;
  border-radius: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.active-item-timer.expiring {
  background: rgba(229, 9, 20, 0.15);
  color: #ff8a80;
}

/* Footer / Actividad */
.activity-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-footer h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-left: 4px;
}

.log-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 16px;
}

.log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.log-dot {
  width: 6px;
  height: 6px;
  background-color: var(--netflix-red);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--netflix-red);
}

.log-message {
  flex-grow: 1;
  color: var(--text-primary);
  text-align: left;
}

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

.footer-note {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

/* Adaptación para pantallas pequeñas */
@media (max-width: 480px) {
  .header {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }
  .header-right {
    width: 100%;
    justify-content: space-between;
  }
  .main-card {
    padding: 24px 16px;
  }
  .code-text {
    font-size: 40px;
    letter-spacing: 4px;
  }
}
