/* ==============================================================================
   timer.css - Estilos para Temporizador Regresivo (Panel de Control y OBS Overlay)
   Soporte para colores personalizados, textos dinámicos y vinculación a Twitch
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800;900&family=JetBrains+Mono:wght@400;600;700;800;900&display=swap');

:root {
  --timer-color: #00f5d4;
  --timer-glow: rgba(0, 245, 212, 0.55);
  --timer-bg: rgba(18, 18, 36, 0.7);
  --timer-border: rgba(0, 245, 212, 0.25);
  --badge-color: #00f5d4;
  --badge-glow: rgba(0, 245, 212, 0.55);
  --badge-bg: rgba(0, 245, 212, 0.15);
  --badge-border: rgba(0, 245, 212, 0.4);
  --finish-color: #ef4444;
  --finish-glow: rgba(239, 68, 68, 0.65);
}

/* ==========================================
   VISTA DE OVERLAY PURO OBS (SOLO NÚMEROS)
   ========================================== */
body.timer-pure-overlay {
  background-color: transparent !important;
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}

.pure-timer-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  text-align: center;
  gap: 0.75rem;
}

/* Etiqueta de estado en OBS (opcional) */
.pure-timer-wrapper .timer-status-badge {
  margin-bottom: 0;
  font-size: clamp(0.9rem, 2.8vw, 1.8rem);
  padding: 6px 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 12px var(--badge-glow);
  background: var(--badge-bg) !important;
  color: var(--badge-color) !important;
  border: 1px solid var(--badge-border) !important;
}

.pure-timer-wrapper .timer-status-badge .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--badge-color) !important;
  box-shadow: 0 0 10px var(--badge-glow) !important;
  display: inline-block;
}

.pure-timer-display {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: clamp(3rem, 15vw, 12rem);
  letter-spacing: 0.05em;
  color: var(--timer-color);
  text-shadow: 
    0 0 12px var(--timer-glow),
    0 0 28px var(--timer-glow),
    0 2px 4px rgba(0, 0, 0, 0.95);
  line-height: 1;
  white-space: nowrap;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

/* Estado Finalizado: cuando el reloj llega a 00:00:00 se queda ahí */
.pure-timer-display.is-finished {
  color: var(--finish-color) !important;
  text-shadow: 
    0 0 15px var(--finish-glow),
    0 0 40px var(--finish-glow),
    0 4px 10px rgba(0, 0, 0, 0.95) !important;
  animation: finishPulse 1.2s infinite alternate ease-in-out;
  letter-spacing: 0.05em;
}

@keyframes finishPulse {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  100% {
    transform: scale(1.04);
    filter: brightness(1.25);
  }
}

/* Canvas de confeti para Overlay */
#timerConfettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

/* ==========================================
   PANEL DE CONTROL (timer.html)
   ========================================== */
.timer-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* Tarjeta del Canal de Twitch Vinculado */
.timer-channel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  background: rgba(145, 71, 255, 0.08);
  border: 1px solid rgba(145, 71, 255, 0.35);
  border-radius: var(--radius-md);
  padding: 1rem 1.4rem;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(12px);
}

.timer-channel-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.timer-channel-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(145, 71, 255, 0.2);
  border: 1px solid var(--twitch-purple);
  color: var(--twitch-purple-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.timer-channel-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.timer-main-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
}

.timer-main-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #00f5d4, #9146ff, #ff007f);
}

/* Pantalla de Previsualización Principal */
.timer-preview-stage {
  background: rgba(8, 8, 16, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 2.5rem 1.5rem;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.8);
  margin-bottom: 2rem;
}

.timer-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--badge-bg, rgba(255, 255, 255, 0.06));
  color: var(--badge-color, var(--text-muted));
  border: 1px solid var(--badge-border, rgba(255, 255, 255, 0.1));
  box-shadow: 0 0 10px var(--badge-glow, transparent);
  margin-bottom: 1rem;
  transition: all 0.2s ease;
}

.timer-status-badge .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--badge-color, #00f5d4);
  box-shadow: 0 0 8px var(--badge-glow, rgba(0, 245, 212, 0.55));
  display: inline-block;
}

.timer-status-badge.running {
  background: var(--badge-bg, rgba(0, 245, 212, 0.15));
  color: var(--badge-color, #00f5d4);
  border-color: var(--badge-border, rgba(0, 245, 212, 0.4));
}

.timer-status-badge.paused {
  background: var(--badge-bg, rgba(255, 190, 11, 0.15));
  color: var(--badge-color, #ffbe0b);
  border-color: var(--badge-border, rgba(255, 190, 11, 0.4));
}

.timer-status-badge.finished {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #ef4444 !important;
  border-color: #ef4444 !important;
  animation: finishBadgePulse 1s infinite alternate ease-in-out;
}

.timer-status-badge.finished .status-dot {
  background: #ef4444 !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8) !important;
}

@keyframes finishBadgePulse {
  from { opacity: 0.8; }
  to { opacity: 1; transform: scale(1.05); }
}

.timer-digits-stage {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(2.8rem, 8vw, 6rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--timer-color);
  text-shadow: 0 0 24px var(--timer-glow);
  transition: all 0.25s ease;
  user-select: none;
}

.timer-digits-stage.is-finished {
  color: var(--finish-color);
  text-shadow: 0 0 35px var(--finish-glow);
  animation: finishPulse 1.2s infinite alternate ease-in-out;
}

/* Sección de Acceso Rápido 6H Destacado */
.featured-preset-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.12), rgba(145, 70, 255, 0.12));
  border: 1px solid rgba(0, 245, 212, 0.35);
  border-radius: var(--radius-md);
  padding: 1rem 1.4rem;
  margin-bottom: 1.5rem;
}

.featured-preset-info {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.featured-preset-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(0, 245, 212, 0.2);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.featured-btn-6h {
  background: linear-gradient(135deg, #00f5d4, #00bbf9);
  color: #050510;
  border: none;
  font-family: var(--font-main);
  font-weight: 900;
  font-size: 1rem;
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 245, 212, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.featured-btn-6h:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 24px rgba(0, 245, 212, 0.5);
}

.featured-btn-6h:active {
  transform: translateY(1px);
}

/* Grid de Presets Rápidos */
.timer-presets-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.6rem;
}

.timer-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.btn-preset {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 0.6rem 0.4rem;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.btn-preset:hover {
  background: rgba(0, 245, 212, 0.15);
  border-color: var(--accent-cyan);
  color: #fff;
  transform: translateY(-1px);
}

.btn-preset.active {
  background: var(--accent-cyan);
  color: #050510;
  border-color: var(--accent-cyan);
  font-weight: 900;
}

/* Formulario de Entrada Libre */
.timer-input-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.timer-input-box {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.timer-text-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.timer-text-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 245, 212, 0.25);
}

/* Botones de Control Principal */
.timer-actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.btn-timer-primary {
  flex: 1.5;
  min-width: 140px;
  background: linear-gradient(135deg, #10b981, #059669);
  border: 1px solid #10b981;
  color: #fff;
  padding: 0.9rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
}

.btn-timer-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.45);
}

.btn-timer-pause {
  flex: 1;
  min-width: 130px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: 1px solid #f59e0b;
  color: #fff;
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-timer-pause:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-timer-reset {
  flex: 1;
  min-width: 120px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-timer-reset:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* Botones de Ajuste Rápido (+/-) */
.timer-adjust-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1.75rem;
}

.btn-adjust {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-adjust:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Panel de Opciones & Estilos */
.timer-settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  backdrop-filter: blur(12px);
  margin-bottom: 2rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.setting-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Campos para Textos Personalizados */
.custom-text-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-text-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 14px rgba(0, 245, 212, 0.25);
}

.input-hint-text {
  font-size: 0.74rem;
  color: var(--text-dim);
  line-height: 1.3;
}

/* Selector de Color Personalizado (Paleta + Picker Nativo + Hex) */
.color-palette-options {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.color-bubble {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
  position: relative;
}

.color-bubble:hover {
  transform: scale(1.15);
}

.color-bubble.active {
  border-color: #fff;
  transform: scale(1.18);
  box-shadow: 0 0 12px currentColor;
}

.color-picker-custom-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.4rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.input-color-native {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 38px;
  height: 38px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
  padding: 0;
  overflow: hidden;
  transition: transform 0.2s;
}

.input-color-native::-webkit-color-swatch-wrapper {
  padding: 0;
}

.input-color-native::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.input-color-native:hover {
  transform: scale(1.12);
}

.input-color-hex {
  width: 110px;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.input-color-hex:focus {
  border-color: var(--accent-cyan);
  outline: none;
}

/* Barra de OBS & Enlaces */
.obs-bar {
  background: rgba(145, 70, 255, 0.1);
  border: 1px solid rgba(145, 70, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.obs-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.obs-host-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-host-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-host-pill:hover {
  background: rgba(145, 70, 255, 0.2);
  color: #fff;
}

.btn-host-pill.active {
  background: var(--twitch-purple);
  border-color: var(--twitch-purple-light);
  color: #fff;
}

.obs-url-input {
  flex: 1;
  min-width: 250px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(145, 70, 255, 0.4);
  color: #a78bfa;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  outline: none;
}

/* ==========================================
   TARJETA MODO HORA EXACTA (HORA MADRID / TIMEZONE)
   ========================================== */
.exact-time-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.07), rgba(145, 70, 255, 0.07));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  margin-bottom: 1.75rem;
}

.exact-time-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.timezone-select {
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 0.55rem 0.8rem;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

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

.live-clock-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.exact-time-inputs-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.exact-time-input {
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.2rem;
  font-weight: 800;
  padding: 0.55rem 0.85rem;
  outline: none;
}

.exact-time-input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.3);
}

.exact-time-preview-text {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fef08a;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Responsive */
@media (max-width: 640px) {
  .featured-preset-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .featured-preset-info {
    flex-direction: column;
  }
  .featured-btn-6h {
    justify-content: center;
  }
  .timer-channel-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .exact-time-header {
    flex-direction: column;
    align-items: stretch;
  }
}

