:root {
  --bg-main: #0b0d14;
  --bg-surface: #131722;
  --bg-surface-elevated: #1a1f2e;
  --bg-surface-hover: #22293d;
  --bg-input: #0f121b;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-focus: #e5a919;
  
  --text-main: #f0f3f8;
  --text-muted: #8e99ac;
  --text-dim: #5c667a;
  
  --primary: #e5a919;
  --primary-hover: #f5b82e;
  --primary-dark: #b8820a;
  --accent-cyan: #00d2ff;
  --accent-red: #ff3b5c;
  --accent-green: #10b981;
  --accent-purple: #8b5cf6;
  
  --badge-4k-bg: linear-gradient(135deg, #d97706, #b45309);
  --badge-bdremux-bg: linear-gradient(135deg, #4f46e5, #4338ca);
  --badge-bdrip-bg: linear-gradient(135deg, #0284c7, #0369a1);
  --badge-webdl-bg: linear-gradient(135deg, #059669, #047857);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 20px 35px -5px rgba(0, 0, 0, 0.7), 0 0 20px rgba(229, 169, 25, 0.2);
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* RESET & BASE */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* SCROLLBAR */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-elevated);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* HEADER */
.app-header {
  background: rgba(19, 23, 34, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1.5rem;
}

.header-container {
  max-width: 1700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 2rem;
  filter: drop-shadow(0 2px 8px rgba(229, 169, 25, 0.3));
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

/* BUSCADOR LIVE LOCAL */
.header-search-wrapper {
  flex: 1;
  max-width: 600px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  font-size: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.header-search-wrapper input {
  width: 100%;
  padding: 0.7rem 2.5rem 0.7rem 2.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
}

.header-search-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 169, 25, 0.15);
  background: var(--bg-surface);
}

.clear-search-btn {
  position: absolute;
  right: 0.85rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.clear-search-btn:hover {
  color: var(--text-main);
}

/* HEADER ACTIONS */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* BOTONES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #0b0d14;
  box-shadow: 0 4px 12px rgba(229, 169, 25, 0.25);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(229, 169, 25, 0.35);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(255, 59, 92, 0.15);
  color: var(--accent-red);
  border-color: rgba(255, 59, 92, 0.3);
}
.btn-danger:hover {
  background: var(--accent-red);
  color: #fff;
}

.btn-icon {
  padding: 0.6rem;
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-color);
  border-radius: var(--radius-md);
}
.btn-icon:hover {
  background: var(--bg-surface-hover);
}

.btn-large {
  padding: 0.85rem 1.75rem;
  font-size: 1.05rem;
}
.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

/* FILTERS BAR */
.filters-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
}

.filters-container {
  max-width: 1700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.filters-left, .filters-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.select-control {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}
.select-control:focus {
  outline: none;
  border-color: var(--primary);
}

/* TOGGLE VISTAS */
.view-toggle {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.view-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}
.view-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--primary);
}

/* MAIN CONTENT */
.main-content {
  max-width: 1700px;
  margin: 0 auto;
  padding: 1.5rem;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.results-count {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.storage-summary {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  background: rgba(0, 210, 255, 0.08);
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(0, 210, 255, 0.2);
}

/* GRID DE PELÍCULAS */
.movies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.5rem;
}

/* MOVIE CARD */
.movie-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
  cursor: pointer;
}

.movie-card:hover {
  transform: translateY(-6px);
  border-color: rgba(229, 169, 25, 0.4);
  box-shadow: var(--shadow-hover);
}

.card-poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #171b26;
}

.card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.movie-card:hover .card-poster {
  transform: scale(1.05);
}

/* BADGES SOBRE PÓSTER */
.badge-top-left {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 2;
}

.badge-top-right {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.badge-format {
  background: var(--bg-surface-elevated);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.badge-4k { background: var(--badge-4k-bg); color: #fff; }
.badge-bdremux { background: var(--badge-bdremux-bg); color: #fff; }
.badge-bdrip { background: var(--badge-bdrip-bg); color: #fff; }
.badge-webdl { background: var(--badge-webdl-bg); color: #fff; }

.badge-size {
  background: rgba(11, 13, 20, 0.85);
  backdrop-filter: blur(4px);
  color: var(--accent-cyan);
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid rgba(0, 210, 255, 0.3);
}

.badge-physical {
  background: rgba(11, 13, 20, 0.85);
  backdrop-filter: blur(4px);
  color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.3);
}

.badge-rating {
  background: rgba(11, 13, 20, 0.85);
  backdrop-filter: blur(4px);
  color: var(--primary);
  font-weight: 800;
  border: 1px solid rgba(229, 169, 25, 0.3);
}

/* CARD INFO */
.card-info {
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.card-genres {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: auto;
}

.card-location {
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* VISTA TABLA / LISTA */
.movies-table-wrapper {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow-x: auto;
}

.movies-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.movies-table th {
  background: var(--bg-surface-elevated);
  padding: 0.85rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.movies-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.movies-table tr:hover td {
  background: var(--bg-surface-hover);
}

.table-poster-thumb {
  width: 44px;
  height: 64px;
  border-radius: 4px;
  object-fit: cover;
}

/* ESTADO VACÍO */
.empty-state {
  text-align: center;
  padding: 5rem 1.5rem;
  max-width: 500px;
  margin: 0 auto;
}
.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}
.empty-state h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.empty-state p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* MODALES */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

.modal-large { max-width: 950px; }
.modal-medium { max-width: 650px; }
.modal-small { max-width: 420px; }
.modal-detail { max-width: 900px; }

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.modal-close-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface-hover);
}

.float-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  background: rgba(11, 13, 20, 0.6);
  border-radius: 50%;
  width: 36px;
  height: 36px;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: rgba(11, 13, 20, 0.4);
}

/* SECCIÓN BUSCADOR IMDB DENTRO DEL MODAL */
.imdb-search-section {
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(229, 169, 25, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
}

.section-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  display: block;
  margin-bottom: 0.5rem;
}

.imdb-search-input-box {
  position: relative;
  display: flex;
  align-items: center;
}

.imdb-badge-icon {
  position: absolute;
  left: 0.75rem;
  background: var(--primary);
  color: #000;
  font-weight: 900;
  font-size: 0.7rem;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  pointer-events: none;
}

.imdb-search-input-box input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 3.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
}
.imdb-search-input-box input:focus {
  outline: none;
  border-color: var(--primary);
}

.spinner-small {
  position: absolute;
  right: 1rem;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.imdb-search-tip {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* DESPLEGABLE RESULTADOS IMDB LIVE */
.imdb-results-dropdown {
  position: absolute;
  top: calc(100% - 1.5rem);
  left: 1rem;
  right: 1rem;
  background: #181d2a;
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  max-height: 320px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.8);
}

.imdb-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: var(--transition);
}

.imdb-dropdown-item:hover {
  background: rgba(229, 169, 25, 0.15);
}

.imdb-thumb {
  width: 38px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  background: #111;
  flex-shrink: 0;
}

.imdb-item-info {
  flex: 1;
  min-width: 0;
}

.imdb-item-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* FORMULARIO ESTILOS */
.form-columns {
  display: flex;
  gap: 1.5rem;
}

.form-poster-column {
  width: 200px;
  flex-shrink: 0;
}

.poster-preview-card {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  margin-bottom: 0.75rem;
}

.poster-preview-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-rating-tag {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.8);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.form-fields-column {
  flex: 1;
}

.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.required {
  color: var(--accent-red);
}

.input-control, .textarea-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition);
}

.input-control:focus, .textarea-control:focus {
  outline: none;
  border-color: var(--primary);
}

.input-addon-group {
  display: flex;
  align-items: center;
}
.input-addon-group input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.addon-text {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-left: none;
  padding: 0.65rem 0.75rem;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.form-card-highlight {
  background: rgba(229, 169, 25, 0.05);
  border: 1px solid rgba(229, 169, 25, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.highlight-title {
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 0.85rem;
  font-weight: 700;
}

/* MODAL DETALLES */
.detail-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 220px;
  background-size: cover;
  background-position: center;
  opacity: 0.15;
  filter: blur(12px);
  pointer-events: none;
}

.detail-content {
  position: relative;
  display: flex;
  gap: 2rem;
  padding: 2rem;
  z-index: 2;
}

.detail-poster-wrap {
  width: 240px;
  flex-shrink: 0;
  position: relative;
}

.detail-poster-wrap img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.rating-pill {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  background: rgba(11, 13, 20, 0.9);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-weight: 800;
  color: var(--primary);
  font-size: 0.95rem;
  border: 1px solid rgba(229, 169, 25, 0.4);
}

.detail-info {
  flex: 1;
}

.detail-header-badges {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.detail-title {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.2;
}

.detail-orig-title {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}

.detail-meta-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

.dot {
  opacity: 0.5;
}

.detail-storage-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.storage-item {
  font-size: 0.85rem;
}
.s-label {
  color: var(--text-muted);
  display: block;
  font-size: 0.75rem;
}
.s-val {
  color: #fff;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.detail-synopsis-box {
  margin-bottom: 1.2rem;
}
.detail-synopsis-box h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.5px;
}
.detail-synopsis-box p {
  color: #d1d5db;
  font-size: 0.95rem;
  line-height: 1.6;
}

.detail-crew {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.75rem;
}
.detail-crew p {
  margin-bottom: 0.35rem;
}
.detail-crew strong {
  color: #fff;
}

.detail-external-links {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.ext-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.ext-imdb {
  background: #f5c518;
  color: #000;
}
.ext-fa {
  background: #2563eb;
  color: #fff;
}
.ext-yt {
  background: #dc2626;
  color: #fff;
}

.detail-actions {
  display: flex;
  gap: 0.75rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

/* RULETA ALEATORIA */
.text-center { text-align: center; }
.random-intro {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.random-filters {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.random-result-box {
  margin-top: 1.5rem;
  animation: fadeIn 0.4s ease;
}

.random-card {
  display: flex;
  gap: 1.25rem;
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(229, 169, 25, 0.3);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: left;
}

.random-card img {
  width: 100px;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.random-card-info {
  flex: 1;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.5rem 0;
}

/* ESTADÍSTICAS */
.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.stat-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
}

.stat-icon {
  font-size: 1.75rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0.25rem 0;
  font-family: 'JetBrains Mono', monospace;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stats-bars-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stat-bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.stat-bar-track {
  height: 8px;
  background: var(--bg-input);
  border-radius: 9999px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1b2030;
  color: #fff;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.toast.active {
  transform: translateY(0);
  opacity: 1;
}
.toast.success { border-color: var(--accent-green); }
.toast.error { border-color: var(--accent-red); }

/* UTILIDADES */
.mt-4 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.75rem; }
.mb-3 { margin-bottom: 1rem; }
.text-large { font-size: 1.5rem; }

/* RESPONSIVE */
@media (max-width: 900px) {
  .header-container {
    flex-wrap: wrap;
  }
  .header-search-wrapper {
    order: 3;
    max-width: 100%;
    width: 100%;
  }
  .header-actions .btn-text {
    display: none;
  }
  .form-columns {
    flex-direction: column;
  }
  .form-poster-column {
    width: 100%;
    display: flex;
    gap: 1rem;
    align-items: center;
  }
  .poster-preview-card {
    width: 120px;
    margin-bottom: 0;
  }
  .detail-content {
    flex-direction: column;
    padding: 1.25rem;
  }
  .detail-poster-wrap {
    width: 160px;
    margin: 0 auto;
  }
  .movies-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }
  .stats-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* ======================================================== */
/* ESTILOS DE AUTENTICACIÓN Y GESTIÓN DE USUARIOS           */
/* ======================================================== */

/* PANTALLA DE LOGIN */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #171c2b 0%, #080a10 100%);
  z-index: 9999;
  padding: 1.5rem;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(229, 169, 25, 0.1);
  width: 100%;
  max-width: 420px;
  padding: 2.5rem 2rem;
  animation: fadeIn 0.4s ease;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo-icon {
  font-size: 3rem;
  display: inline-block;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 4px 12px rgba(229, 169, 25, 0.4));
}

.login-header h2 {
  font-size: 1.85rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.btn-block {
  width: 100%;
}

.feedback-msg {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.feedback-msg.error {
  background: rgba(255, 59, 92, 0.15);
  border: 1px solid rgba(255, 59, 92, 0.4);
  color: #ff6b81;
}

/* PILL DE USUARIO EN CABECERA */
.user-session-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
}

.user-name {
  font-weight: 700;
  color: #fff;
}

.user-role-badge {
  background: var(--primary);
  color: #000;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.user-role-badge.viewer {
  background: var(--bg-surface-hover);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  font-size: 0.95rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
}
.btn-logout:hover {
  color: var(--accent-red);
  transform: scale(1.1);
}

/* TABLA DE GESTIÓN DE USUARIOS */
.users-table-wrap {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-top: 0.75rem;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.users-table th {
  padding: 0.65rem 0.85rem;
  text-align: left;
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.users-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.users-table tr:hover td {
  background: var(--bg-surface-hover);
}

.tag-pending {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.tag-ok {
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

/* ======================================================== */
/* REPRODUCTOR DE TRÁILER INTEGRADO                         */
/* ======================================================== */
.detail-trailer-wrap {
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(229, 169, 25, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.trailer-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.trailer-title-row h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

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

.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ======================================================== */
/* PESTAÑAS DE CATEGORÍAS (TODO, PELÍCULAS, SERIES, CORTOS)  */
/* ======================================================== */
.category-tabs-bar {
  background: #111520;
  border-bottom: 1px solid var(--border-color);
  padding: 0.65rem 1.5rem;
  overflow-x: auto;
}

.category-tabs-container {
  max-width: 1700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.cat-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.cat-tab:hover {
  background: var(--bg-surface-elevated);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.cat-tab.active {
  background: var(--primary);
  color: #0b0d14;
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(229, 169, 25, 0.35);
}

.tab-badge {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
}
.cat-tab.active .tab-badge {
  background: #000;
  color: #fff;
}

/* CARGA PROGRESIVA / SCROLL INFINITO */
.infinite-scroll-status {
  padding: 2.5rem 1.5rem 1rem;
  text-align: center;
}

.infinite-loader {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 0.65rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.infinite-end-msg {
  color: var(--text-dim);
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.scroll-sentinel {
  height: 40px;
  width: 100%;
}

/* BANNER DE MARATÓN DE SERIES */
.detail-marathon-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(229, 169, 25, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  margin-bottom: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.detail-marathon-banner strong {
  color: #fff;
}
.detail-marathon-banner span {
  font-size: 1.2rem;
}

/* TIEMPO TOTAL DE VIDEOTECA EN ESTADÍSTICAS */
.stats-time-summary-card {
  background: linear-gradient(135deg, rgba(229, 169, 25, 0.15), rgba(99, 102, 241, 0.12));
  border: 1px solid rgba(229, 169, 25, 0.35);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  text-align: center;
  margin-bottom: 0.85rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
.time-main-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.time-main-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stats-time-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}
.stat-time-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.sti-icon {
  font-size: 1.25rem;
}
.sti-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0.25rem 0 0.15rem;
  letter-spacing: 0.5px;
}
.sti-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
}
.sti-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
