:root {
  --bg: #050505;
  --bg-elevated: #0c0c0c;
  --surface: #131313;
  --surface-hover: #1b1b1b;
  --border: #202020;
  --border-strong: #323232;

  --text: #f3f3f3;
  --text-muted: #919191;
  --text-dim: #616161;

  /* Verde reservado únicamente para los botones */
  --green: #22c55e;
  --green-bright: #4ade80;
  --green-glow: rgba(34, 197, 94, 0.25);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  --transition: 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Fondo minimalista monocromático */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 0%, black 20%, transparent 75%);
}

.bg-glow {
  position: fixed;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 680px;
  height: 320px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.045) 0%, transparent 70%);
  filter: blur(28px);
  pointer-events: none;
  z-index: 0;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(5, 5, 5, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.brand-name {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

.brand-name span {
  color: var(--green);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
}

.search-box {
  position: relative;
  width: 100%;
  max-width: 290px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.search-box input::placeholder {
  color: var(--text-dim);
}

.search-box input:focus {
  border-color: var(--border-strong);
  background: var(--surface);
}

/* Botones (únicos elementos con color verde) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--green);
  color: #041108;
  border-color: var(--green);
}

.btn-primary:hover {
  background: var(--green-bright);
  border-color: var(--green-bright);
  box-shadow: 0 0 20px var(--green-glow);
}

.btn-outline-green {
  background: transparent;
  color: var(--green);
  border-color: var(--green);
}

.btn-outline-green:hover {
  background: var(--green);
  color: #041108;
  box-shadow: 0 0 20px var(--green-glow);
}

.btn-ghost {
  background: var(--surface);
  color: var(--green);
  border-color: rgba(34, 197, 94, 0.35);
}

.btn-ghost:hover {
  background: var(--green);
  color: #041108;
  border-color: var(--green);
}

.btn-icon-only {
  width: 38px;
  padding: 0;
}

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

/* Main */
.main-content {
  flex: 1;
  padding-top: 40px;
  padding-bottom: 64px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--text-muted);
}

.hero h1 {
  margin: 0;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.05;
  color: var(--text);
}

.hero h1 span {
  color: var(--green);
}

.hero p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.96rem;
  max-width: 540px;
  line-height: 1.5;
}

.hero-stats {
  display: flex;
  gap: 12px;
}

.stat-card {
  min-width: 96px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  text-align: right;
}

.stat-value {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Barra principal con solo 2 botones */
.toolbar {
  margin-top: 24px;
  margin-bottom: 24px;
}

.main-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.main-actions .btn {
  height: 42px;
  padding: 0 20px;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}

/* Demo banner */
.demo-banner {
  margin-bottom: 24px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
}

.demo-banner-text {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.demo-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-hover);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.demo-banner p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.demo-banner code {
  color: var(--text);
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.82rem;
}

/* Grid de videos */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
  gap: 20px;
}

.video-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.video-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: radial-gradient(circle at 30% 25%, #191919 0%, #090909 75%);
  overflow: hidden;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 350ms ease, opacity 250ms ease;
}

.video-card:hover .thumb-img {
  transform: scale(1.04);
}

.thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-dim);
  padding: 16px;
  text-align: center;
}

.thumb-fallback span {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 5, 5, 0.25);
  transition: background var(--transition);
}

.video-card:hover .play-overlay {
  background: rgba(5, 5, 5, 0.45);
}

.play-circle {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(12, 12, 12, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: var(--text);
  backdrop-filter: blur(8px);
  transition: transform var(--transition), background var(--transition), color var(--transition);
}

.play-circle svg {
  margin-left: 2px;
}

.video-card:hover .play-circle {
  transform: scale(1.08);
  background: var(--text);
  color: var(--bg);
}

.thumb-badges {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  pointer-events: none;
}

.duration-badge {
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(5, 5, 5, 0.85);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.card-body {
  padding: 15px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-remove-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  border-radius: 6px;
  transition: color var(--transition);
}

.card-remove-btn:hover {
  color: #f87171;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.77rem;
  color: var(--text-muted);
}

.card-meta span + span::before {
  content: "•";
  margin-right: 10px;
  color: var(--text-dim);
}

.card-actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card-actions .btn {
  height: 36px;
  font-size: 0.8rem;
  padding: 0 10px;
}

/* Empty & Skeleton */
.empty-state {
  text-align: center;
  padding: 68px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
}

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.empty-state h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.empty-state p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.skeleton-card {
  height: 290px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--surface) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* Modales */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: modalIn 180ms ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-player {
  max-width: 920px;
}

.modal-form {
  max-width: 480px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}

.btn-close:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.player-frame-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

.player-iframe {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.player-loader {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--text);
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.demo-player-placeholder {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  background: radial-gradient(circle at center, #161616 0%, #050505 75%);
}

.demo-player-placeholder[hidden] {
  display: none;
}

.demo-play-ring {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  margin-bottom: 14px;
}

.demo-player-title {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 1rem;
}

.demo-player-sub {
  margin: 0;
  max-width: 420px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.demo-player-sub code {
  color: var(--text);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

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

.modal-actions {
  display: flex;
  gap: 8px;
}

/* Formulario modal */
.form-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.field input {
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
}

.field input:focus {
  border-color: var(--text-muted);
}

.field small {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

/* Dropzone & barra de progreso */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  padding: 26px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--text-muted);
  background: var(--surface);
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.dropzone-title {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.dropzone-sub {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
}

.progress-wrap[hidden] {
  display: none;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-hover);
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--text);
  transition: width 150ms linear;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 80;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 720px) {
  .container {
    padding: 0 16px;
  }

  .topbar-inner {
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    flex-wrap: wrap;
  }

  .topbar-actions {
    width: 100%;
  }

  .search-box {
    max-width: none;
  }

  .search-box input,
  .field input {
    font-size: 16px;
  }

  .main-content {
    padding-top: 24px;
    padding-bottom: 48px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 20px;
  }

  .stat-card {
    text-align: left;
  }

  .main-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
  }

  .main-actions .btn {
    width: 100%;
    padding: 0 12px;
    font-size: 0.78rem;
  }

  #btnSubir {
    grid-column: 1 / -1;
  }

  .modal {
    padding: 12px;
  }

  .modal-panel {
    max-height: 92dvh;
    overflow-y: auto;
  }

  .modal-header,
  .modal-footer,
  .form-body {
    padding: 14px 16px;
  }

  .modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-actions {
    width: 100%;
  }

  .modal-actions .btn {
    flex: 1;
  }

  .form-footer .btn {
    flex: 1;
  }

  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    text-align: center;
  }
}
