/* TV Dashboard CSS Premium + Gamificação */
:root {
  --bg-color: #0b1220;
  --panel-bg: rgba(30, 41, 59, 0.7);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-green: #22c55e;
  --accent-purple: #8b5cf6;
  --accent-gold: #fbbf24;
  --glass-border: rgba(255, 255, 255, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-color);
  background-image: radial-gradient(circle at top, rgba(59, 130, 246, 0.15), transparent 40%),
                    radial-gradient(circle at bottom right, rgba(139, 92, 246, 0.15), transparent 40%);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tv-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 15px;
  gap: 15px;
  transition: box-shadow 0.3s ease;
}

.flash-green {
  box-shadow: inset 0 0 150px rgba(34, 197, 94, 0.4) !important;
}

.tv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  padding: 10px 20px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

.header-left img { height: 50px; }
.header-left h1 { font-size: 1.2rem; font-weight: 800; letter-spacing: 1px; margin: 0; }

.live-indicator {
  width: 14px;
  height: 14px;
  background-color: #ef4444;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
  margin-left: 10px;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* META DIÁRIA (PROGRESS BAR) */
.meta-container {
  flex: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 20px;
}

.meta-label {
  font-size: 0.8rem;
  color: var(--accent-gold);
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.progress-wrapper {
  width: 100%;
  height: 18px;
  background: rgba(0,0,0,0.5);
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  border-radius: 12px;
  transition: width 1s ease-in-out;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.6);
}

.progress-text {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  color: white;
}

.header-right { flex: 1; text-align: right; }
.tv-clock { font-size: 2.0rem; font-weight: 800; line-height: 1; }
.tv-date { font-size: 0.9rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; margin-top: 5px; }

.tv-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.kpi-card {
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  padding: 25px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
}

.card-blue::before { background: var(--accent-blue); box-shadow: 0 0 20px var(--accent-blue); }
.card-green::before { background: var(--accent-green); box-shadow: 0 0 20px var(--accent-green); }
.card-purple::before { background: var(--accent-purple); box-shadow: 0 0 20px var(--accent-purple); }

.card-green .kpi-value { color: var(--accent-green); text-shadow: 0 0 20px rgba(34, 197, 94, 0.4); }
.card-blue .kpi-value { color: var(--accent-blue); text-shadow: 0 0 20px rgba(59, 130, 246, 0.4); }

.kpi-label { font-size: 1.0rem; color: var(--text-muted); font-weight: 600; letter-spacing: 2px; margin-bottom: 10px; }
.kpi-value { font-size: 4rem; font-weight: 800; line-height: 1; }

/* Rankings */
.rankings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  flex: 1;
  min-height: 0;
}

.ranking-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  padding: 15px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  overflow: hidden;
}

.ranking-panel h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 20px; text-align: center; color: #fff; }

.tv-table-wrap { flex: 1; display: flex; flex-direction: column; }
.tv-table { width: 100%; border-collapse: collapse; }
.tv-table th { text-align: left; padding: 15px 20px; color: var(--text-muted); font-size: 0.9rem; font-weight: 600; text-transform: uppercase; border-bottom: 1px solid rgba(255,255,255,0.1); }
.tv-table td { padding: 20px; font-size: 1.2rem; font-weight: 600; border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: middle; }
.tv-table tr:last-child td { border-bottom: none; }

/* Estilos de Gamificação no Ranking */
.avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: white;
  font-weight: 800;
  font-size: 0.9rem;
  margin-right: 15px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.top-1-avatar {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  border: 2px solid white;
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.6);
  position: relative;
}

.top-1-crown {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.5rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -5px); }
}

.medal { font-size: 1.2rem; text-align: center; display: block; }
.row-val { color: var(--accent-blue); font-weight: 800; font-size: 1.6rem; text-align: center; }
.loading-text { text-align: center; color: var(--text-muted); font-style: italic; }
