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

:root {
  --bg-color: #07080d;
  --panel-bg: rgba(18, 20, 32, 0.75);
  --panel-border: rgba(255, 255, 255, 0.06);
  --panel-border-hover: rgba(255, 255, 255, 0.12);
  
  --primary: #7c4dff;
  --primary-glow: rgba(124, 77, 255, 0.35);
  --primary-gradient: linear-gradient(135deg, #7c4dff 0%, #b388ff 100%);
  
  --secondary: #00e5ff;
  --secondary-glow: rgba(0, 229, 255, 0.35);
  --secondary-gradient: linear-gradient(135deg, #00e5ff 0%, #2979ff 100%);

  --danger: #ff1744;
  --success: #00e676;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #6b7280;

  --shadow-neon: 0 10px 30px -10px rgba(124, 77, 255, 0.2);
  --shadow-main: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(124, 77, 255, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(0, 229, 255, 0.06) 0%, transparent 45%);
  background-attachment: fixed;
}

h1, h2, h3, h4 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Glassmorphism utility */
.glass {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-main);
  border-radius: var(--radius-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass:hover {
  border-color: var(--panel-border-hover);
}

/* Header principal */
header {
  padding: 24px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(7, 8, 13, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(to right, #ffffff, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}

.logo span {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo svg {
  color: var(--primary);
  filter: drop-shadow(0 0 6px var(--primary-glow));
}

.nav-links {
  display: flex;
  gap: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 77, 255, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--panel-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* 🎥 ESTILOS DO PLAYER (Página Principal) */
.player-container {
  max-width: 1000px;
  width: 90%;
  margin: 40px auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  border: 1px solid var(--panel-border);
  background: #000;
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.no-video-alert {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  text-align: center;
  background: rgba(18, 20, 32, 0.8);
}

.no-video-alert svg {
  color: var(--text-dark);
  margin-bottom: 16px;
}

.no-video-alert h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.no-video-alert p {
  color: var(--text-muted);
  max-width: 400px;
  margin-bottom: 24px;
}

.video-details {
  padding: 24px;
}

.video-details h1 {
  font-size: 26px;
  margin-bottom: 8px;
  background: linear-gradient(to right, #ffffff, #9ca3af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.video-details p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}

/* 📊 ESTILOS DA DASHBOARD (Página Admin) */
.admin-container {
  max-width: 1400px;
  width: 95%;
  margin: 40px auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
  flex-grow: 1;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.admin-title h1 {
  font-size: 32px;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #fff 0%, #9ca3af 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.admin-title p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Grid de métricas principais */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.metric-card {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-gradient);
}

.metric-card.sec::before {
  background: var(--secondary-gradient);
}

.metric-info h3 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 36px;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: #fff;
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  border: 1px solid var(--panel-border);
}

.metric-card.sec .metric-icon {
  color: var(--secondary);
}

/* Seção de Analytics (Gráficos) */
.analytics-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

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

.chart-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 380px;
}

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

.chart-title h2 {
  font-size: 18px;
  font-weight: 600;
}

.chart-title p {
  color: var(--text-muted);
  font-size: 13px;
}

.chart-body {
  flex-grow: 1;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 250px;
  padding-top: 20px;
}

/* Gráfico de barras de retenção construído em CSS puro */
.bar-chart-container {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  position: relative;
}

.bar-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1;
  height: 100%;
  justify-content: flex-end;
  position: relative;
  cursor: pointer;
  group-hover: pointer;
}

.bar-wrapper {
  width: 60%;
  background: rgba(255, 255, 255, 0.03);
  height: 100%;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.bar {
  width: 100%;
  background: var(--primary-gradient);
  border-radius: 4px 4px 0 0;
  transition: height 1s ease-out;
  box-shadow: 0 0 15px rgba(124, 77, 255, 0.1);
  position: relative;
}

.bar-column:hover .bar {
  filter: brightness(1.2);
  box-shadow: 0 0 20px rgba(124, 77, 255, 0.4);
}

.bar-tooltip {
  position: absolute;
  bottom: 105%;
  background: rgba(7, 8, 13, 0.95);
  border: 1px solid var(--primary);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(5px);
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 10;
}

.bar-column:hover .bar-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.bar-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 500;
}

/* Gráfico de Donuts/Tabela simplificado para Dispositivos */
.device-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
  height: 100%;
}

.device-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.device-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.device-label-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.device-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.device-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.device-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease-out;
}

/* Seção de Upload e Lista de Acessos Recentes */
.admin-row-bottom {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .admin-row-bottom {
    grid-template-columns: 1fr;
  }
}

/* Card de Upload */
.upload-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.upload-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.01);
}

.upload-zone:hover {
  border-color: var(--primary);
  background: rgba(124, 77, 255, 0.02);
}

.upload-zone svg {
  color: var(--text-dark);
  transition: color 0.2s ease;
}

.upload-zone:hover svg {
  color: var(--primary);
}

.upload-zone h4 {
  font-size: 15px;
}

.upload-zone p {
  font-size: 12px;
  color: var(--text-muted);
}

.upload-progress-container {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary-gradient);
  border-radius: 3px;
  transition: width 0.1s ease;
}

/* Tabela de Acessos Recentes */
.sessions-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--panel-border);
}

td {
  padding: 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.device-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.badge-completed {
  background: rgba(0, 230, 118, 0.1);
  color: var(--success);
  border: 1px solid rgba(0, 230, 118, 0.2);
}

.badge-watching {
  background: rgba(0, 229, 255, 0.1);
  color: var(--secondary);
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.badge-abandoned {
  background: rgba(255, 23, 68, 0.08);
  color: var(--danger);
  border: 1px solid rgba(255, 23, 68, 0.15);
}

.percentage-badge {
  font-size: 12px;
  font-weight: 600;
}

/* Rodapé */
footer {
  margin-top: auto;
  padding: 24px 40px;
  text-align: center;
  border-top: 1px solid var(--panel-border);
  color: var(--text-dark);
  font-size: 13px;
  background: rgba(7, 8, 13, 0.9);
}

/* Utility alert boxes */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  color: #fff;
  z-index: 1000;
  display: none;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: translateY(100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.toast-success {
  background: linear-gradient(135deg, #00c853 0%, #00e676 100%);
  box-shadow: 0 4px 15px rgba(0, 230, 118, 0.3);
}

.toast-error {
  background: linear-gradient(135deg, #d50000 0%, #ff1744 100%);
  box-shadow: 0 4px 15px rgba(255, 23, 68, 0.3);
}
