/* Evita que el icono de desplegable del <select> se solape con el texto */
.custom-select-arrow {
  padding-right: 2.5rem !important;
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25em auto;
  /* Usa el icono nativo del sistema, pero deja espacio */
}
/* Estilos base */
.glass {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.glass:hover { 
  background: rgba(99, 102, 241, 0.1); 
}

.selected { 
  background: rgba(99, 102, 241, 0.2); 
}

.invisible { 
  visibility: hidden; 
}

/* Layout principal */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

header { 
  height: 200px; 
  flex-shrink: 0;
  overflow: visible;
  position: relative;
  z-index: 100;
}

main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 16px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

#subcabecera-controles {
  position: relative;
  z-index: 200;
  overflow: visible;
}

.results-container {
  display: flex;
  flex: 1 1 auto;
  gap: 1.5rem;
  overflow: hidden;
}

.overflow-column { 
  overflow-y: auto; 
  overflow-x: hidden;
  padding-bottom: 1rem; 
}

.flex-no-shrink { 
  flex-shrink: 0; 
}

/* Video y sinopsis */
.video-synopsis-container {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.video-wrapper {
  flex: 0 0 auto;
  position: relative;
  min-width: 200px;
  max-width: 100%;
}

.video-container {
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease;
  position: relative;
}

.video-container video {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.synopsis-wrapper {
  flex: 1 1 300px;
  min-width: 250px;
}

/* Controles de redimensionamiento */
.resize-controls {
  position: relative;
  bottom: auto;
  right: auto;
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.7);
  padding: 4px 8px;
  border-radius: 8px;
  z-index: 10;
  margin-top: 8px;
  justify-content: flex-end;
}

.resize-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s;
}

.resize-btn:hover {
  background: rgba(255,255,255,0.3);
}

/* Slider de tamaño de video */
.video-size-slider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px;
  background: rgba(99,102,241,0.1);
  border-radius: 8px;
}

.video-size-slider input[type="range"] {
  flex: 1;
}

.size-label {
  font-size: 12px;
  color: #4f46e5;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}

/* Picture in Picture */
.pip-indicator {
  display: none;
  padding: 0.5rem;
  background-color: rgba(59, 130, 246, 0.1);
  border: 1px dashed rgb(59, 130, 246);
  border-radius: 0.75rem;
  text-align: center;
  color: rgb(59, 130, 246);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.pip-active + .pip-indicator { 
  display: block; 
}

/* Menú de categorías */
.categoria-menu {
  position: relative;
  display: inline-block;
}

.categoria-btn {
  padding: 0.5rem 1rem;
  background: white;
  border: 2px solid #6366f1;
  color: #6366f1;
  font-weight: 600;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
}

.categoria-btn:hover {
  background: #6366f1;
  color: white;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  background: white;
  border: 2px solid #6366f1;
  border-radius: 0.75rem;
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
  min-width: 200px;
  width: max-content;
  max-width: min(90vw, 420px);
  z-index: 99999;
  padding: 0.25rem 0;
  pointer-events: auto;
}

.dropdown-menu.show {
  display: block;
}

/* Evita que el último submenú se salga por la derecha */
.categoria-menu:last-child .dropdown-menu {
  left: auto;
  right: 0;
}

.categoria-menu::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 4px;
  background: transparent;
  z-index: 99998;
}

.categoria-menu:hover .dropdown-menu,
.dropdown-menu:hover {
  display: block;
}

.dropdown-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.875rem;
  color: #374151;
  white-space: normal;
}

.dropdown-item:first-child {
  border-radius: 0.5rem 0.5rem 0 0;
}

.dropdown-item:last-child {
  border-radius: 0 0 0.5rem 0.5rem;
}

.dropdown-item:hover {
  background: rgba(99,102,241,0.2);
  color: #6366f1;
  font-weight: 600;
}

.categoria-menu-container {
  position: relative;
  z-index: 10000;
  overflow: visible;
}

/* Estilos para la edición de resumen */
.resumen-editable {
  border: 2px dashed #6366f1;
  background-color: #f8fafc;
  padding: 8px;
  border-radius: 6px;
  cursor: text;
}

.resumen-textarea {
  width: 100%;
  min-height: 100px;
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  line-height: 1.25rem;
  resize: vertical;
  font-family: inherit;
}

.resumen-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn-guardar-resumen {
  background-color: #10b981;
  color: white;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  transition: background-color 0.2s;
}

.btn-guardar-resumen:hover {
  background-color: #059669;
}

.btn-guardar-resumen:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.resumen-guardando {
  opacity: 0.6;
  pointer-events: none;
}

/* Gestión (manage) */
.manage-page {
  font-family: Arial, sans-serif;
}

.manage-page table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 1rem;
}

.manage-page th,
.manage-page td {
  border: 1px solid #e5e7eb;
  padding: 0.35rem 0.4rem;
  font-size: 0.85rem;
  text-align: center;
}

.manage-page th {
  background-color: rgba(255, 255, 255, 0.9);
  color: #374151;
}

.manage-page .cell-red { background-color: #fef2f2; }
.manage-page .cell-yellow { background-color: #fffbeb; }
.manage-page .cell-green { background-color: #ecfdf3; }

.manage-page .flash-container { margin-top: 0.5rem; }
.manage-page .flash {
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.3rem;
  border-radius: 3px;
  font-size: 0.85rem;
}
.manage-page .flash-success { background-color: #d4edda; border: 1px solid #c3e6cb; }
.manage-page .flash-warning { background-color: #fff3cd; border: 1px solid #ffeeba; }

.manage-page textarea { width: 100%; min-height: 60px; font-size: 0.8rem; }
.manage-page button { font-size: 0.8rem; padding: 0.2rem 0.4rem; }

.manage-page .video-row {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(237, 242, 255, 0.92));
}

.manage-page .video-row:hover {
  background: linear-gradient(135deg, rgba(224, 231, 255, 0.95), rgba(239, 246, 255, 0.95));
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.12);
}

.manage-page .video-row td,
.manage-page .video-row th {
  border-color: #e5e7eb;
}

.manage-page .manage-table-wrapper {
  border-radius: 16px;
  overflow: visible;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.8);
}

.manage-page .manage-th-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  position: relative;
}

.manage-page .manage-sort-link {
  text-decoration: none;
  color: #6366f1;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1;
}

.manage-page .manage-sort-link.active {
  color: #1d4ed8;
}

.manage-page .manage-filter-placeholder {
  visibility: hidden;
}

.manage-page .manage-filter-popover {
  display: inline-block;
  position: relative;
}

.manage-page .manage-filter-summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.88rem;
  color: #4b5563;
  line-height: 1;
  border-radius: 999px;
  padding: 0.1rem 0.28rem;
}

.manage-page .manage-filter-summary::-webkit-details-marker {
  display: none;
}

.manage-page .manage-filter-summary.active {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.manage-page .manage-filter-popover.has-active-filter {
  filter: saturate(1.2);
}

.manage-page .manage-filter-popover[open] {
  z-index: 1200;
}

.manage-page .manage-filter-popover[open] .manage-column-filter-form {
  display: flex;
}

.manage-page .manage-column-filter-form {
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 210px;
  padding: 0.45rem;
  border-radius: 10px;
  border: 1px solid #c7d2fe;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.18);
}

.manage-page .manage-column-filter-form input[type="text"] {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.32rem 0.45rem;
  font-size: 0.8rem;
}

.manage-page .manage-filter-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
}

.manage-page .manage-filter-actions button,
.manage-page .manage-filter-actions a {
  padding: 0.22rem 0.45rem;
  border-radius: 6px;
  font-size: 0.75rem;
  text-decoration: none;
}

.manage-page .manage-filter-actions button {
  background: #4f46e5;
  color: #fff;
  border: none;
}

.manage-page .manage-filter-actions a {
  border: 1px solid #d1d5db;
  color: #374151;
  background: #fff;
}

.manage-page .manage-active-filters-bar {
  margin: 0.5rem 0 0.35rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  background: rgba(224, 231, 255, 0.45);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.manage-page .manage-active-filters-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #3730a3;
}

.manage-page .manage-active-filter-chip {
  font-size: 0.76rem;
  border: 1px solid #a5b4fc;
  background: #ffffff;
  color: #1f2937;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.manage-page .manage-active-filters-clear {
  margin-left: auto;
  font-size: 0.76rem;
  color: #1d4ed8;
  text-decoration: none;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  padding: 0.15rem 0.45rem;
  background: #ffffff;
}

.manage-page .col-narrow { width: 60px; white-space: nowrap; }
.manage-page .col-estado { width: 70px; white-space: nowrap; }
.manage-page .col-acciones { width: 90px; white-space: nowrap; }
.manage-page th.col-title,
.manage-page td.col-title {
  text-align: left;
}

.manage-page .manage-title-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.manage-page .manage-play-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #c7d2fe;
  color: #1d4ed8;
  background: #ffffff;
  text-decoration: none;
  font-size: 0.7rem;
  line-height: 1;
}

.manage-page .manage-play-link:hover {
  background: #e0e7ff;
}

.manage-page #bulk-actions-container button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.manage-page .status-icon { display: inline-block; width: 20px; height: 20px; vertical-align: middle; }
.manage-page .icon-completed { color: #155724; }
.manage-page .icon-pending { color: #6c757d; }
.manage-page .icon-failed { color: #721c24; }
.manage-page .icon-none { color: #999999; }
.manage-page .icon-pending-validation {
    color: #b45309;
    cursor: pointer;
    animation: pulse-amber 2s ease-in-out infinite;
}
@keyframes pulse-amber {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.manage-page .quality-badge {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 3px;
  font-weight: 600;
  vertical-align: middle;
}

.manage-page .spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  animation: spin 1s linear infinite;
}

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

.manage-page .vt-main { padding: 1rem 1.5rem; }

/* Test A/B: estilos de tabla/filtros alineados con Manage */
.test-page table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 1rem;
}

.test-page th,
.test-page td {
  border: 1px solid #e5e7eb;
  padding: 0.35rem 0.4rem;
  font-size: 0.85rem;
  text-align: center;
}

.test-page th {
  background-color: rgba(255, 255, 255, 0.9);
  color: #374151;
}

.test-page .video-row {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(237, 242, 255, 0.92));
}

.test-page .video-row:hover {
  background: linear-gradient(135deg, rgba(224, 231, 255, 0.95), rgba(239, 246, 255, 0.95));
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.12);
}

.test-page .video-row td,
.test-page .video-row th {
  border-color: #e5e7eb;
}

.test-page .manage-table-wrapper {
  border-radius: 16px;
  overflow: visible;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.8);
}

.test-page .manage-th-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  position: relative;
}

.test-page .manage-sort-link {
  text-decoration: none;
  color: #6366f1;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1;
}

.test-page .manage-sort-link.active {
  color: #1d4ed8;
}

.test-page .manage-filter-popover {
  display: inline-block;
  position: relative;
}

.test-page .manage-filter-summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.88rem;
  color: #4b5563;
  line-height: 1;
  border-radius: 999px;
  padding: 0.1rem 0.28rem;
}

.test-page .manage-filter-summary::-webkit-details-marker {
  display: none;
}

.test-page .manage-filter-summary.active {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.test-page .manage-filter-popover.has-active-filter {
  filter: saturate(1.2);
}

.test-page .manage-filter-popover[open] {
  z-index: 1200;
}

.test-page .manage-filter-popover[open] .manage-column-filter-form {
  display: flex;
}

.test-page .manage-column-filter-form {
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 210px;
  padding: 0.45rem;
  border-radius: 10px;
  border: 1px solid #c7d2fe;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.18);
}

.test-page .manage-column-filter-form input[type="text"],
.test-page .manage-column-filter-form select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.32rem 0.45rem;
  font-size: 0.8rem;
  background: #fff;
}

.test-page .manage-filter-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
}

.test-page .manage-filter-actions button,
.test-page .manage-filter-actions a {
  padding: 0.22rem 0.45rem;
  border-radius: 6px;
  font-size: 0.75rem;
  text-decoration: none;
}

.test-page .manage-filter-actions button {
  background: #4f46e5;
  color: #fff;
  border: none;
}

.test-page .manage-filter-actions a {
  border: 1px solid #d1d5db;
  color: #374151;
  background: #fff;
}

.test-page .manage-active-filters-bar {
  margin: 0.5rem 0 0.35rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  background: rgba(224, 231, 255, 0.45);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.test-page .manage-active-filters-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #3730a3;
}

.test-page .manage-active-filter-chip {
  font-size: 0.76rem;
  border: 1px solid #a5b4fc;
  background: #ffffff;
  color: #1f2937;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.test-page .manage-active-filters-clear {
  margin-left: auto;
  font-size: 0.76rem;
  color: #1d4ed8;
  text-decoration: none;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  padding: 0.15rem 0.45rem;
  background: #ffffff;
}

.test-page .col-narrow { width: 60px; white-space: nowrap; }
.test-page th.col-title,
.test-page td.col-title {
  text-align: left;
}

.test-page .manage-title-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.test-page .manage-play-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #c7d2fe;
  color: #1d4ed8;
  background: #ffffff;
  text-decoration: none;
  font-size: 0.7rem;
  line-height: 1;
}

.test-page .manage-play-link:hover {
  background: #e0e7ff;
}

.test-page .status-icon { display: inline-block; width: 20px; height: 20px; vertical-align: middle; }
.test-page .icon-completed { color: #155724; }
.test-page .icon-pending { color: #6c757d; }
.test-page .icon-failed { color: #721c24; }
.test-page .icon-none { color: #999999; }

.test-page .spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  animation: spin 1s linear infinite;
}