:root {
  --bg-dark: #07090e;
  --bg-card: #0f131c;
  --bg-surface: #171d2b;
  --bg-surface-hover: #21293c;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --accent: #8b5cf6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #1e2638;
  --border-focus: #6366f1;
  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.12);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Header & Barra Superior */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2.5rem;
  background-color: rgba(15, 19, 28, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #a78bfa 0%, #6366f1 50%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
  flex-shrink: 0;
}

.logo-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 7px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 999px;
  color: #a5b4fc;
  -webkit-text-fill-color: #a5b4fc;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.user-badge {
  display: flex;
  flex-direction: column;
  text-align: right;
  line-height: 1.25;
}

.user-badge strong {
  color: var(--text-main);
  font-weight: 600;
}

.user-badge span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Layout */
.container {
  max-width: 1240px;
  margin: 2.2rem auto;
  padding: 0 1.5rem;
}

/* Métricas del Artista */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.4rem;
  margin-bottom: 2.5rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.4);
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0.8;
}

.metric-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 0.6rem;
  font-weight: 600;
}

.metric-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

/* Subida Directa & Drag & Drop */
.upload-card {
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: 16px;
  padding: 2.6rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-bottom: 2.5rem;
  position: relative;
}

.upload-card:hover, .upload-card.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.04);
  box-shadow: 0 0 25px var(--primary-glow);
}

.upload-icon {
  font-size: 2.8rem;
  margin-bottom: 0.8rem;
  color: var(--primary);
  display: inline-block;
  transition: transform 0.2s ease;
}

.upload-card:hover .upload-icon {
  transform: scale(1.1);
}

.upload-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.upload-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Barra de progreso de subida */
.progress-container {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

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

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  border-radius: 999px;
  transition: width 0.15s ease;
}

.progress-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Tabla de Vídeos */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow-x: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.video-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  table-layout: fixed;
  min-width: 860px;
}

.video-table th {
  padding: 1rem 1.4rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  background: rgba(23, 29, 43, 0.6);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  box-sizing: border-box;
  vertical-align: middle;
}

.video-table td {
  padding: 1.1rem 1.4rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  box-sizing: border-box;
}

.video-table tr:last-child td {
  border-bottom: none;
}

.video-table tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.video-cell-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.video-mini-thumb {
  width: 74px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background-color: #000;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.video-info-wrap h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 3px;
  cursor: pointer;
}

.video-info-wrap h4:hover {
  color: #a5b4fc;
}

.video-info-wrap span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Badges de Estado */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-ready { background: var(--success-bg); color: #34d399; }
.status-ready::before { background: #34d399; }
.status-processing { background: var(--warning-bg); color: #fbbf24; }
.status-processing::before { background: #fbbf24; }
.status-uploading { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.status-uploading::before { background: #818cf8; }
.status-error { background: var(--danger-bg); color: #f87171; }
.status-error::before { background: #f87171; }

/* Subtítulos CC Badges */
.badge-cc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.2;
  white-space: nowrap;
}

.badge-cc-active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-cc-pending {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* Estado interactivo de dropzone durante la subida */
.upload-card.is-uploading {
  border-color: var(--primary) !important;
  background: rgba(99, 102, 241, 0.08) !important;
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.25);
}

/* Botones */
.btn {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.45);
}

.btn-outline {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: var(--danger-bg);
  color: #f87171;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
}

/* Modales */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.85);
  backdrop-filter: blur(8px);
  z-index: 999;
  padding: 1.5rem;
  overflow-y: auto;
  box-sizing: border-box;
}

.modal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 3rem);
  padding: 2.2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  animation: modalEnter 0.2s ease-out;
  margin: auto;
  box-sizing: border-box;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.3rem;
}

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

/* Auth Tabs */
.auth-tabs {
  display: flex;
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.auth-tab.active {
  background: var(--primary);
  color: #fff;
}

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

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
  font-weight: 500;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: #ffffff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  color-scheme: dark;
}

.form-group select option {
  background-color: #111625;
  color: #ffffff;
  padding: 8px 12px;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--border-focus);
}

/* Reproductor Seguro Minimalista */
.player-page-body {
  background: #030407;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.player-container {
  position: relative;
  width: 100%;
  max-width: 1000px;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.9);
  border: 1px solid var(--border-color);
}

.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

.video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.watermark-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* Barra inferior del reproductor con controles para Magia */
.magic-controls {
  background: var(--bg-card);
  padding: 1.1rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  gap: 1rem;
  flex-wrap: wrap;
}

.player-meta-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.player-meta-shield {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.speed-control-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-surface);
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.speed-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 6px;
  font-weight: 600;
}

.speed-btn {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.speed-btn:hover {
  color: #fff;
}

.speed-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Mosca / Logo Personalizado del Creador */
.player-custom-logo {
  position: absolute;
  top: 18px;
  right: 20px;
  max-height: 48px;
  max-width: 140px;
  object-fit: contain;
  opacity: 0.85;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  pointer-events: none;
  z-index: 15;
  transition: opacity 0.2s ease;
}
.player-custom-logo:hover {
  opacity: 1;
}
