/**
 * Fijate Tools - Sorteador de Comentarios para Instagram
 * Estilos CSS adaptados a tema claro/oscuro y estándares corporativos.
 */

:root {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colores tema oscuro (por defecto) */
  --bg-body: #080c14;
  --bg-card: #0f172a;
  --bg-card-alt: #1e293b;
  --bg-card-hover: #172339;
  --border-color: #334155;
  --border-focus: #ff8507;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --primary-accent: #ff8507;
  --primary-hover: #ea580c;
  --primary-glow: rgba(255, 133, 7, 0.25);

  --secondary-accent: #00e5ff;
  --secondary-glow: rgba(0, 229, 255, 0.2);

  --gold-accent: #fbbf24;
  --gold-glow: rgba(251, 191, 36, 0.3);

  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

[data-theme="light"] {
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-alt: #f8fafc;
  --bg-card-hover: #f1f5f9;
  --border-color: #cbd5e1;
  --border-focus: #ff8507;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --primary-accent: #ea580c;
  --primary-hover: #c2410c;
  --primary-glow: rgba(234, 88, 12, 0.2);

  --secondary-accent: #0284c7;
  --secondary-glow: rgba(2, 132, 199, 0.2);

  --gold-accent: #d97706;
  --gold-glow: rgba(217, 119, 6, 0.2);

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.08);

  color-scheme: light;
}

/* Reset y estructura */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: clip;
}

.font-mono {
  font-family: var(--font-mono);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
}

/* Layout con Sidebar */
.app-main {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 40px;
}

.tool-with-sidebar {
  width: 100%;
  max-width: 1320px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  margin: 0 auto;
  align-items: start;
}

.tool-main-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.tool-ad-sidebar {
  height: auto;
  align-self: stretch;
}

.ad-sticky-container {
  position: sticky;
  top: 85px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hero */
.tool-intro-card {
  background: linear-gradient(135deg, rgba(255, 133, 7, 0.08) 0%, rgba(0, 229, 255, 0.04) 100%), var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-card);
}

.intro-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 133, 7, 0.15);
  color: var(--primary-accent);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 133, 7, 0.3);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--primary-accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--primary-accent);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.tool-heading {
  font-size: 1.65rem;
  line-height: 1.3;
  margin-bottom: 10px;
}

.tool-desc {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.tool-desc strong {
  color: var(--text-main);
}

/* Grid del Sorteo: Formulario (Izquierda) + Pantalla Animada (Derecha) */
.giveaway-main-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 24px;
  align-items: start;
}

.giveaway-setup-card, .giveaway-display-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.giveaway-setup-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.setup-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  color: var(--primary-accent);
}

.btn-load-sample {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  color: var(--secondary-accent);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-load-sample:hover {
  background: var(--secondary-glow);
  border-color: var(--secondary-accent);
}

.giveaway-textarea {
  width: 100%;
  height: 180px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-main);
  font-size: 0.88rem;
  line-height: 1.5;
  font-family: var(--font-mono);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.giveaway-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-stats-bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 8px 12px;
  background: var(--bg-card-alt);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.input-stats-bar strong {
  color: var(--text-main);
}

/* Bloque de Filtros */
.filters-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.filters-heading {
  font-size: 0.95rem;
  color: var(--text-main);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 42px;
  background-color: var(--bg-card-alt);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.form-select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

.input-wrapper {
  display: flex;
  align-items: center;
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  height: 42px;
  padding: 0 12px;
}

.form-input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: var(--font-mono);
  font-weight: 600;
  outline: none;
}

.input-unit {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.form-row-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.btn-start-draw {
  height: 52px;
  background: linear-gradient(135deg, #ff8507 0%, #ea580c 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 6px 20px var(--primary-glow);
  transition: all 0.25s;
  font-family: inherit;
  margin-top: 6px;
}

.btn-start-draw:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

/* Columna Derecha / Pantalla de Resultados */
.giveaway-display-card {
  min-height: 480px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Estado Idle */
.display-idle-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 40px 20px;
}

.idle-trophy-icon {
  font-size: 3.5rem;
  animation: floatTrophy 3s ease-in-out infinite;
}

@keyframes floatTrophy {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.idle-title {
  font-size: 1.3rem;
  color: var(--text-main);
}

.idle-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 320px;
}

/* Estado Countdown */
.display-countdown-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px 20px;
  text-align: center;
}

.countdown-circle-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-spinner-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 5px solid var(--border-color);
  border-top-color: var(--primary-accent);
  border-right-color: var(--secondary-accent);
  animation: spin 1s linear infinite;
  box-sizing: border-box;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.countdown-number {
  position: relative;
  z-index: 2;
  font-size: 4.2rem;
  font-weight: 900;
  color: var(--primary-accent);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  text-align: center;
  animation: pulseNum 1s infinite;
}

@keyframes pulseNum {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.countdown-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

.rolling-names {
  font-size: 1.15rem;
  color: var(--secondary-accent);
  background: rgba(0, 229, 255, 0.08);
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(0, 229, 255, 0.3);
}

/* Estado de Ganadores y Resultados */
.display-results-state {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.results-celebration-head {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.winner-trophy-badge {
  font-size: 2.8rem;
  animation: bounceWinner 1.2s infinite alternate;
}

@keyframes bounceWinner {
  from { transform: translateY(0) scale(0.95); }
  to { transform: translateY(-6px) scale(1.05); }
}

.results-title {
  font-size: 1.4rem;
  color: var(--gold-accent);
}

.results-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Lista de Ganadores */
.winners-container-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.winner-card-item {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12) 0%, var(--bg-card-alt) 100%);
  border: 2px solid var(--gold-accent);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 4px 20px var(--gold-glow);
}

.winner-avatar-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gold-accent);
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.winner-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 0%;
  min-width: 0;
}

.winner-username {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  word-break: break-all;
}

.winner-comment-snippet {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.winner-badge-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: #000000;
  background: var(--gold-accent);
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

/* Suplentes */
.reserves-box {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reserves-title {
  font-size: 0.84rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reserves-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reserve-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  color: var(--text-main);
  padding: 4px 0;
  border-bottom: 1px dashed var(--border-color);
}

.reserve-item:last-child {
  border-bottom: none;
}

.reserve-tag {
  color: var(--text-dim);
  font-size: 0.75rem;
}

/* Acta de Transparencia */
.certificate-card {
  background: #000000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.76rem;
}

.cert-head {
  display: flex;
  justify-content: space-between;
  color: var(--success-color);
  font-weight: 600;
}

.cert-body {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 6px;
}

.cert-body code {
  color: var(--secondary-accent);
}

/* Botones Posteriores */
.results-actions-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 12px;
}

.btn-primary-action, .btn-secondary-action {
  height: 44px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary-action {
  background: var(--primary-accent);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary-action:hover {
  background: var(--primary-hover);
}

.btn-secondary-action {
  background: var(--bg-card-alt);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-dim);
}

/* Guía SEO Didáctica */
.giveaway-seo-guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-card);
}

.guide-heading {
  font-size: 1.35rem;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.guide-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-subheading {
  font-size: 1.05rem;
  color: var(--primary-accent);
  margin-top: 8px;
}

.guide-text {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.guide-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.guide-list li {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding-left: 18px;
  position: relative;
  line-height: 1.5;
}

.guide-list li::before {
  content: '•';
  color: var(--primary-accent);
  position: absolute;
  left: 4px;
  font-size: 1.1rem;
}

.guide-list strong {
  color: var(--text-main);
}

/* Toast */
.tool-toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card-alt);
  border: 1px solid var(--success-color);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  z-index: 10000;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}

.tool-toast-notification.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  color: var(--success-color);
  font-weight: bold;
}

/* Responsive */
@media (max-width: 992px) {
  .tool-with-sidebar {
    grid-template-columns: 1fr;
  }
  .tool-ad-sidebar {
    display: none;
  }
  .giveaway-main-grid {
    grid-template-columns: 1fr;
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .tool-intro-card, .giveaway-setup-card, .giveaway-display-card, .giveaway-seo-guide-card {
    padding: 18px 16px;
  }
  .filters-grid, .form-row-grid, .results-actions-row {
    grid-template-columns: 1fr;
  }
  .btn-start-draw, .btn-primary-action, .btn-secondary-action {
    width: 100%;
  }
}
