:root {
  --bg-main: #07090e;
  --bg-card: rgba(13, 17, 26, 0.82);
  --bg-card-subtle: rgba(22, 28, 42, 0.55);
  --border-hairline: 1px solid rgba(255, 255, 255, 0.08);
  --border-focus: 1px solid rgba(0, 229, 153, 0.45);
  --accent-emerald: #00e599;
  --accent-emerald-glow: rgba(0, 229, 153, 0.18);
  --accent-gold: #f59e0b;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(ellipse at 50% 0%, rgba(0, 229, 153, 0.07), transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(56, 189, 248, 0.04), transparent 50%);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  border-bottom: var(--border-hairline);
  backdrop-filter: blur(16px);
  background: rgba(7, 9, 14, 0.85);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #00e599 0%, #059669 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px var(--accent-emerald-glow);
}

.logo-icon svg {
  width: 18px;
  height: 18px;
  fill: #07090e;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 229, 153, 0.12);
  border: 1px solid rgba(0, 229, 153, 0.3);
  color: var(--accent-emerald);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 11px;
}

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

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

main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 2rem;
}

@media (max-width: 1024px) {
  main {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-card);
  border: var(--border-hairline);
  border-radius: 14px;
  padding: 1.75rem;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #e5e7eb;
}

label .hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-left: 0.5rem;
  font-family: var(--font-mono);
}

input[type="text"],
select,
textarea {
  width: 100%;
  background: var(--bg-card-subtle);
  border: var(--border-hairline);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border: var(--border-focus);
  box-shadow: 0 0 12px var(--accent-emerald-glow);
  background: rgba(18, 23, 35, 0.8);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.checkbox-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.lang-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card-subtle);
  border: var(--border-hairline);
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  user-select: none;
  transition: all 0.2s ease;
}

.lang-chip:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.lang-chip input {
  accent-color: var(--accent-emerald);
}

.lang-chip.selected {
  border-color: var(--accent-emerald);
  background: rgba(0, 229, 153, 0.08);
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.slider-container input[type="range"] {
  flex: 1;
  accent-color: var(--accent-emerald);
}

.slider-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-emerald);
  min-width: 60px;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #00e599 0%, #059669 100%);
  color: #050811;
  border: none;
  border-radius: 10px;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: all 0.25s ease;
  box-shadow: 0 4px 20px var(--accent-emerald-glow);
  margin-top: 1.5rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 229, 153, 0.35);
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Painel de Resultados & Status */
.progress-container {
  margin-bottom: 1.5rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.progress-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00e599, #38bdf8);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.live-logs {
  background: #030407;
  border: var(--border-hairline);
  border-radius: 8px;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  height: 160px;
  overflow-y: auto;
  color: #10b981;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.live-logs .log-err {
  color: #ef4444;
}

.preview-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.25rem;
  background: var(--bg-card-subtle);
  border: var(--border-hairline);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.cover-preview {
  width: 140px;
  height: 140px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #111;
}

.preview-meta h4 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.preview-meta p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 229, 153, 0.15);
  border: 1px solid var(--accent-emerald);
  color: var(--accent-emerald);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.download-btn:hover {
  background: var(--accent-emerald);
  color: #050811;
}

.chapters-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.chapter-item {
  background: rgba(255, 255, 255, 0.02);
  border: var(--border-hairline);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.chapter-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.chapter-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
}

audio {
  width: 100%;
  height: 36px;
  border-radius: 6px;
  accent-color: var(--accent-emerald);
}

/* Seção de Busca de Domínio Público */
.search-card {
  background: rgba(18, 24, 38, 0.7);
  border: 1px solid rgba(0, 229, 153, 0.25);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.search-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-emerald);
  margin-bottom: 0.35rem;
}

.search-title svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.search-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.search-input-group {
  display: flex;
  gap: 0.5rem;
}

.search-input-group input {
  flex: 1;
}

.search-btn {
  background: var(--accent-emerald);
  color: #050811;
  border: none;
  border-radius: 8px;
  padding: 0 1.25rem;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.search-btn:hover {
  background: #10b981;
  transform: translateY(-1px);
}

.search-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.quick-chips-wrapper {
  margin-top: 0.85rem;
}

.quick-chips-label {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.quick-chip {
  background: rgba(255, 255, 255, 0.04);
  border: var(--border-hairline);
  color: var(--text-muted);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.quick-chip:hover {
  background: rgba(0, 229, 153, 0.12);
  border-color: rgba(0, 229, 153, 0.35);
  color: var(--accent-emerald);
}

.verified-box {
  margin-top: 0.85rem;
  background: rgba(0, 229, 153, 0.08);
  border: 1px solid rgba(0, 229, 153, 0.3);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.verified-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--accent-emerald);
}

.verified-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

/* ========================================================
   ESTILOS DO AGENDAMENTO NOTURNO (02H ÀS 06H) & FILA
   ======================================================== */
.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.scheduler-pill {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(18, 24, 38, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.4rem 0.85rem;
  border-radius: 10px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.scheduler-pill.in-window {
  border-color: rgba(0, 229, 153, 0.4);
  box-shadow: 0 0 20px rgba(0, 229, 153, 0.15);
}

.scheduler-pill.manual-override {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.15);
}

.sched-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sched-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.sched-texts {
  display: flex;
  flex-direction: column;
}

.sched-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

.sched-sub {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent-gold);
}

.scheduler-pill.in-window .sched-sub {
  color: var(--accent-emerald);
}

.scheduler-pill.manual-override .sched-sub {
  color: #38bdf8;
}

.sched-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  padding-left: 0.75rem;
}

/* Switch Toggle Sleek */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
}

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

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

.switch-slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .25s;
  border-radius: 50%;
}

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

input:checked + .switch-slider:before {
  transform: translateX(16px);
  background-color: #07090e;
}

/* Sched Buttons */
.sched-btn {
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.sched-btn.run-btn {
  background: rgba(0, 229, 153, 0.15);
  border: 1px solid rgba(0, 229, 153, 0.4);
  color: var(--accent-emerald);
}

.sched-btn.run-btn:hover {
  background: var(--accent-emerald);
  color: #07090e;
  box-shadow: 0 0 12px var(--accent-emerald-glow);
}

.sched-btn.pause-btn {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.sched-btn.pause-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* Banner de Agendamento no Formulário */
.schedule-banner-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.schedule-banner-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.schedule-banner-text {
  color: var(--text-muted);
  line-height: 1.4;
}

.schedule-banner-text strong {
  color: var(--accent-gold);
}

/* Fila de Produção */
.queue-card {
  margin-top: 1.5rem;
  background: rgba(10, 14, 22, 0.75);
  border: var(--border-hairline);
  border-radius: 10px;
  padding: 1rem;
}

.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.queue-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.queue-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.queue-item-meta {
  display: flex;
  flex-direction: column;
}

.queue-item-title {
  font-weight: 600;
  color: #fff;
}

.queue-item-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.queue-item-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
}

.badge-completed {
  background: rgba(0, 229, 153, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(0, 229, 153, 0.3);
}

.badge-paused {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-scheduled {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-processing {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}
