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

:root {
  /* Variáveis de Tema dinâmicas (atualizadas via JS a partir do Firestore) */
  --cor-fundo: #0f172a;
  --cor-texto: #f8fafc;
  --cor-destaque: #38bdf8;
  --largura-barra-lateral: 340px;
  --posicao-barra-lateral: direita; /* 'esquerda' ou 'direita' via classe ou flex-direction */

  /* Estilos do Sistema de Design */
  --font-main: 'Outfit', 'Inter', sans-serif;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-hover: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.12);
  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--cor-fundo);
  color: var(--cor-texto);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.5s ease, color 0.5s ease;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: var(--cor-destaque);
  border-radius: 3px;
}

/* =========================================================
   ESTILOS GERAIS & UTILITÁRIOS
   ========================================================= */
.app-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

.text-destaque {
  color: var(--cor-destaque);
  transition: color 0.3s ease;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-live {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  animation: pulse-badge 2s infinite;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(1.03); }
}

/* Botões Modernos */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
  user-select: none;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background-color: var(--cor-destaque);
  color: #000;
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.3);
}
.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 6px 25px rgba(56, 189, 248, 0.45);
}
.btn-secondary {
  background: var(--glass-bg);
  color: var(--cor-texto);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
  background: var(--glass-bg-hover);
  border-color: var(--cor-destaque);
}
.btn-danger {
  background: #ef4444;
  color: #ffffff;
}
.btn-danger:hover {
  background: #dc2626;
}
.btn-success {
  background: #10b981;
  color: #ffffff;
}
.btn-success:hover {
  background: #059669;
}
.btn-full {
  width: 100%;
}

/* Inputs / Forms */
.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: rgba(255, 255, 255, 0.8);
}
.form-input, .form-select {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  color: var(--cor-texto);
  font-family: var(--font-main);
  font-size: 1rem;
  transition: var(--transition-smooth);
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--cor-destaque);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

/* =========================================================
   TELA CENTRAL / LANDING / LOGIN
   ========================================================= */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.15), transparent 50%),
              radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.1), transparent 50%),
              var(--cor-fundo);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(18, 24, 38, 0.75);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  box-shadow: var(--card-shadow);
  text-align: center;
}
.auth-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(56, 189, 248, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--cor-destaque);
  font-size: 1.85rem;
  margin-bottom: 1.25rem;
}
.auth-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}
.auth-subtitle {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 2rem;
}

/* =========================================================
   MODO 1: TELA DA TV (DIGITAL SIGNAGE - 16:9 FULLSCREEN)
   ========================================================= */
.tv-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}
.tv-layout.posicao-esquerda {
  flex-direction: row-reverse;
}
.tv-layout.posicao-direita {
  flex-direction: row;
}

/* Área Principal (Programação ao Vivo) */
.tv-main {
  flex: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 2.5rem 3.5rem;
  position: relative;
  overflow: hidden;
}

.tv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--glass-border);
  padding-bottom: 1.5rem;
}
.tv-event-info {
  display: flex;
  flex-direction: column;
}
.tv-event-title {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--cor-texto), var(--cor-destaque));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tv-clock-wrapper {
  text-align: right;
}
.tv-clock {
  font-size: 3rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--cor-destaque);
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
}
.tv-date {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
  margin-top: 0.25rem;
}

/* Programação em Destaque no Momento */
.tv-current-item {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--glass-border);
  border-left: 6px solid var(--cor-destaque);
  border-radius: 20px;
  padding: 2rem 2.5rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
  position: relative;
}
.tv-current-badge {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
}
.tv-current-time {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cor-destaque);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tv-current-title {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}
.tv-current-speaker {
  font-size: 1.5rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Lista da Programação Seguinte */
.tv-schedule-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
}
.tv-schedule-header {
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0.5rem;
}
.tv-schedule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 1.2rem 1.75rem;
  transition: var(--transition-smooth);
}
.tv-schedule-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.tv-schedule-item-title {
  font-size: 1.4rem;
  font-weight: 700;
}
.tv-schedule-item-speaker {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.7);
}
.tv-schedule-item-time {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--cor-destaque);
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}

/* Barra Lateral da TV (Patrocinadores + Info) */
.tv-sidebar {
  width: var(--largura-barra-lateral, 340px);
  min-width: 260px;
  max-width: 500px;
  height: 100vh;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem 2rem;
  position: relative;
  z-index: 10;
  transition: width 0.4s ease;
}
.tv-sidebar-title {
  font-size: 1.15rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--cor-destaque);
  margin-bottom: 1.5rem;
}
.tv-sponsors-carousel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2.5rem;
  overflow: hidden;
}
.tv-sponsor-card {
  width: 100%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.5s ease, opacity 0.5s ease;
  animation: fadeInSponsor 0.8s ease forwards;
}
@keyframes fadeInSponsor {
  0% { opacity: 0; transform: translateY(15px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.tv-sponsor-logo {
  max-width: 85%;
  max-height: 120px;
  object-fit: contain;
  margin-bottom: 1.25rem;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}
.tv-sponsor-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--cor-texto);
}
.tv-sponsor-slogan {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 0.5rem;
}
.tv-sidebar-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.45);
}

/* =========================================================
   MODAL / OVERLAY: INTERVENÇÃO DE PATROCINADOR (PULSANTE)
   ========================================================= */
.tv-intervencao-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.96), #000000);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.tv-intervencao-modal.active {
  opacity: 1;
  pointer-events: auto;
}
.tv-intervencao-badge {
  background: var(--cor-destaque);
  color: #000;
  font-size: 1.15rem;
  font-weight: 900;
  padding: 0.6rem 1.8rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 3rem;
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.6);
}
.tv-intervencao-logo-wrapper {
  position: relative;
  margin-bottom: 3rem;
}
.tv-intervencao-logo {
  max-width: 650px;
  max-height: 400px;
  object-fit: contain;
  animation: pulse-sponsor 2.5s infinite ease-in-out;
  filter: drop-shadow(0 15px 45px rgba(56, 189, 248, 0.35));
}
@keyframes pulse-sponsor {
  0% { transform: scale(1); filter: drop-shadow(0 15px 45px rgba(56, 189, 248, 0.3)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 20px 65px rgba(56, 189, 248, 0.65)); }
  100% { transform: scale(1); filter: drop-shadow(0 15px 45px rgba(56, 189, 248, 0.3)); }
}
.tv-intervencao-name {
  font-size: 4rem;
  font-weight: 900;
  color: var(--cor-texto);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}
.tv-intervencao-slogan {
  font-size: 2rem;
  font-weight: 400;
  color: var(--cor-destaque);
  max-width: 900px;
  line-height: 1.3;
}

/* =========================================================
   MODO 2: CONTROLE OPERADOR VIA CELULAR (MOBILE OPTIMIZED)
   ========================================================= */
.controle-container {
  max-width: 520px;
  margin: 0 auto;
  padding: 1.25rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.controle-header {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.controle-header-info h2 {
  font-size: 1.2rem;
  font-weight: 800;
}
.controle-header-info p {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
}

.controle-status-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}
.controle-status-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0.75rem;
}
.controle-status-modo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--cor-destaque);
  margin-bottom: 1rem;
}

/* Painel de exibição ao vivo no celular */
.controle-current-card {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(56, 189, 248, 0.05));
  border: 2px solid var(--cor-destaque);
  border-radius: 20px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  text-align: center;
  position: relative;
  box-shadow: 0 10px 25px rgba(56, 189, 248, 0.2);
}
.controle-current-card h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--cor-destaque);
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}
.controle-current-card .sponsor-live-name {
  font-size: 1.75rem;
  font-weight: 900;
  color: #fff;
}

/* Card Spoiler (Próximo na tela) */
.controle-spoiler-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--glass-border);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 2rem;
  text-align: center;
}
.controle-spoiler-card span {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  display: block;
  margin-bottom: 0.25rem;
}
.controle-spoiler-card strong {
  font-size: 1.15rem;
  color: #fbbf24; /* Amarelo destaque para o próximo */
  font-weight: 700;
}

/* Botões Grandes do Operador */
.btn-operador-action {
  padding: 1.4rem 1.5rem;
  font-size: 1.25rem;
  font-weight: 800;
  border-radius: 18px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  margin-bottom: 1rem;
  transition: all 0.25s ease;
}
.btn-operador-action:active {
  transform: scale(0.95);
}

/* Lista de Patrocinadores no Controle (Referência rápida) */
.controle-sponsors-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.controle-sponsor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  font-size: 0.95rem;
}
.controle-sponsor-row.active {
  border-color: var(--cor-destaque);
  background: rgba(56, 189, 248, 0.12);
  font-weight: 700;
}

/* =========================================================
   MODO 3: PAINEL ADMINISTRATIVO (GERENCIAMENTO COMPLETO)
   ========================================================= */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  flex-wrap: wrap;
  gap: 1rem;
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.75rem;
}
.admin-card {
  background: rgba(18, 24, 38, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
}
.admin-card-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--cor-destaque);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.75rem;
}
.admin-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  gap: 1rem;
}
.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.color-picker-input {
  width: 50px;
  height: 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

/* Responsividade geral */
@media (max-width: 768px) {
  .tv-main {
    padding: 1.5rem;
  }
  .tv-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .tv-clock-wrapper {
    text-align: left;
  }
  .tv-current-title {
    font-size: 1.85rem;
  }
  .tv-intervencao-name {
    font-size: 2.25rem;
  }
  .tv-intervencao-slogan {
    font-size: 1.25rem;
  }
}
