/* ==========================================================
   Cartelera NM — hoja de estilos (tema oscuro tipo streaming)
   Estructura: variables · base · barra · hero · filtros · tarjetas
               filas · modal · panel · formularios · responsive
   ========================================================== */

:root {
  --fondo: #0b0b12;
  --capa: #15151f;
  --capa-2: #1e1e2c;
  --borde: #2b2b3d;
  --texto: #f2f2f7;
  --suave: #a4a4b8;
  --acento: #e50f4b;
  --acento-2: #8b5cf6;
  --ok: #22c55e;
  --error: #ef4444;
  --radio: 12px;
  --sombra: 0 14px 40px rgba(0, 0, 0, .55);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.5;
}
html, body { overflow-x: hidden; }
body.sin-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
p { margin: 0 0 .6rem; }
.oculto { display: none !important; }
.centro { text-align: center; margin: 1.5rem 0; }
:focus-visible { outline: 2px solid var(--acento-2); outline-offset: 2px; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--acento); color: #fff; border: 0; border-radius: 8px;
  padding: .65rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: transform .15s, filter .15s;
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn-ghost { background: transparent; border: 1px solid var(--borde); color: var(--texto); }
.btn-peq { padding: .4rem .75rem; font-size: .85rem; }
.btn-peligro { background: #7f1d1d; }

/* ---------- barra superior ---------- */
.barra {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; gap: 1rem;
  padding: .8rem clamp(1rem, 4vw, 3rem);
  background: linear-gradient(to bottom, rgba(11, 11, 18, .95), rgba(11, 11, 18, 0));
  transition: background .3s;
}
.barra.solida { background: rgba(11, 11, 18, .96); box-shadow: 0 2px 20px rgba(0, 0, 0, .5); }
.logo { color: var(--acento); font-weight: 800; letter-spacing: .08em; text-decoration: none; white-space: nowrap; }
.logo span { color: var(--texto); font-weight: 300; margin-left: .3rem; }
.buscador { flex: 1; position: relative; max-width: 560px; margin-left: auto; }
.buscador i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--suave); }
.buscador input {
  width: 100%; padding: .65rem 1rem .65rem 2.6rem; border-radius: 999px;
  border: 1px solid var(--borde); background: rgba(30, 30, 44, .9); color: var(--texto); font: inherit;
}
.buscador input:focus { border-color: var(--acento-2); outline: none; }

.aviso {
  margin: 4.6rem clamp(1rem, 4vw, 3rem) 0; padding: .7rem 1rem; border-radius: 8px;
  background: #3b2f06; border: 1px solid #a16207; color: #fde68a; font-size: .9rem;
}

/* ---------- hero ---------- */
main { padding-top: 0; }
.hero { margin-top: 4.2rem; }
.heroSwiper { height: clamp(380px, 62vh, 560px); }
.hero-slide {
  display: flex !important; align-items: center; justify-content: space-between; gap: 2rem;
  padding: 2rem clamp(1rem, 6vw, 5rem) 3rem;
}
.hero-texto { max-width: 620px; text-shadow: 0 2px 10px rgba(0, 0, 0, .6); }
.hero-texto h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
.hero-poster { width: clamp(150px, 20vw, 250px); flex-shrink: 0; }
.hero-poster .poster { box-shadow: var(--sombra); aspect-ratio: 2 / 3; height: auto; }
.swiper-pagination-bullet { background: #fff; opacity: .5; }
.swiper-pagination-bullet-active { background: var(--acento); opacity: 1; }

/* ---------- filtros ---------- */
.filtros {
  position: sticky; top: 3.6rem; z-index: 40;
  display: flex; flex-wrap: wrap; gap: .8rem 1.5rem; align-items: center; justify-content: space-between;
  padding: .8rem clamp(1rem, 4vw, 3rem);
  background: rgba(11, 11, 18, .95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--borde);
}
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--capa-2); color: var(--texto); border: 1px solid var(--borde);
  padding: .4rem .9rem; border-radius: 999px; font: inherit; cursor: pointer; transition: all .2s;
}
.chip em { font-style: normal; font-size: .75rem; color: var(--suave); }
.chip:hover { border-color: var(--acento-2); }
.chip.activo { background: var(--acento); border-color: var(--acento); }
.chip.activo em { color: #fff; }
.controles { display: flex; flex-wrap: wrap; gap: .8rem; align-items: end; }
.controles label { display: flex; flex-direction: column; font-size: .75rem; color: var(--suave); gap: .2rem; }
select, input, textarea {
  background: var(--capa-2); color: var(--texto); border: 1px solid var(--borde);
  border-radius: 8px; padding: .5rem .7rem; font: inherit;
}
select:focus, input:focus, textarea:focus { border-color: var(--acento-2); outline: none; }

/* ---------- resultados y grid ---------- */
.resultados { padding: 1.5rem clamp(1rem, 4vw, 3rem); min-height: 60vh; }
.resultados h2 { font-size: 1.2rem; color: var(--suave); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.1rem; }
.vacio { text-align: center; padding: 3rem 1rem; color: var(--suave); font-size: 1.1rem; }

/* ---------- tarjetas ---------- */
.card {
  position: relative; border-radius: var(--radio); overflow: hidden; cursor: pointer;
  background: var(--capa); aspect-ratio: 2 / 3; transition: transform .25s, box-shadow .25s;
}
.card:hover, .card:focus-visible { transform: scale(1.04); box-shadow: var(--sombra); z-index: 5; }
.poster { position: relative; width: 100%; height: 100%; display: flex; align-items: flex-end; border-radius: var(--radio); overflow: hidden; }
.poster-titulo { padding: 1rem; font-weight: 700; font-size: 1.05rem; text-shadow: 0 2px 8px rgba(0, 0, 0, .7); }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster.con-imagen .poster-titulo { opacity: 0; }
.card-info {
  position: absolute; inset: auto 0 0 0; padding: 2.5rem .9rem .9rem;
  background: linear-gradient(to top, rgba(0, 0, 0, .96) 55%, transparent);
  opacity: 0; transform: translateY(24px);
}
.card-info h3 { font-size: 1rem; }
.card-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.card-sub { color: var(--suave); font-size: .82rem; }
.card-sinopsis { font-size: .8rem; color: #d4d4e0; }
.nota-card { color: #facc15; font-weight: 600; font-size: .85rem; }
.badge {
  display: inline-block; padding: .12rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700;
  background: var(--acento-2); color: #fff; text-transform: uppercase; letter-spacing: .05em;
}
.tipo-serie { background: #0ea5e9; }
.tipo-documental { background: #16a34a; }
.tipo-película { background: var(--acento); }

.esqueleto {
  background: linear-gradient(100deg, var(--capa) 30%, var(--capa-2) 50%, var(--capa) 70%);
  background-size: 200% 100%; animation: brillo 1.2s infinite linear; cursor: default;
}
@keyframes brillo { to { background-position: -200% 0; } }

/* ---------- filas (Swiper) ---------- */
.filas { padding: 1.5rem 0 2rem; }
.fila { margin-bottom: 2rem; padding-left: clamp(1rem, 4vw, 3rem); }
.fila h2 { font-size: 1.3rem; }
.fila h2 small { margin-left: .7rem; font-size: .7rem; font-weight: 400; color: var(--suave); border: 1px solid var(--borde); padding: .1rem .5rem; border-radius: 999px; }
.filaSwiper { padding: .6rem 0 1rem; overflow: visible; }
.filaSwiper .swiper-slide { width: 190px; }
.filaSwiper .swiper-button-prev, .filaSwiper .swiper-button-next {
  color: #fff; background: rgba(0, 0, 0, .65); width: 38px; height: 38px; border-radius: 50%; top: 45%;
}
.filaSwiper .swiper-button-prev::after, .filaSwiper .swiper-button-next::after { font-size: 1rem; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .75); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-caja {
  position: relative; width: min(860px, 100%); max-height: 92vh; overflow-y: auto;
  background: var(--capa); border: 1px solid var(--borde); border-radius: 16px; padding: 1.6rem; box-shadow: var(--sombra);
}
.modal-cerrar {
  position: absolute; top: .8rem; right: .8rem; z-index: 2; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; font-size: 1rem;
}
.modal-cerrar:hover { background: var(--acento); }
.modal-cab { display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.modal-poster .poster { aspect-ratio: 2 / 3; }
.modal-datos h2 { font-size: 1.8rem; margin-top: .4rem; }
.resenas { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .6rem; }
.resena { background: var(--capa-2); border-radius: 10px; padding: .7rem .9rem; }
.resena-cab { display: flex; justify-content: space-between; }
.nota { color: var(--suave); font-size: .9rem; }

/* ---------- panel editor ---------- */
.panel { position: fixed; inset: 0; z-index: 110; background: rgba(0, 0, 0, .6); display: flex; justify-content: flex-end; }
.panel-caja { position: relative; width: min(760px, 100%); height: 100%; overflow-y: auto; background: var(--capa); padding: 1.6rem; border-left: 1px solid var(--borde); }
.admin-barra { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; color: var(--suave); }
.form { display: grid; gap: .8rem; }
.form label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--suave); }
.form-grid { grid-template-columns: repeat(2, 1fr); margin-bottom: 1.5rem; }
.form-grid h3, .form-grid .ancho { grid-column: 1 / -1; }
.form .check { flex-direction: row; align-items: center; gap: .5rem; grid-column: 1 / -1; }
.form .check input { width: auto; }
.acciones { display: flex; gap: .6rem; }
.tabla-caja { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla th, .tabla td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--borde); }
.tabla th { color: var(--suave); font-weight: 600; }

/* ---------- toasts y pie ---------- */
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 200; display: grid; gap: .5rem; max-width: min(380px, 90vw); }
.toast { padding: .75rem 1rem; border-radius: 10px; background: var(--capa-2); border-left: 4px solid var(--acento-2); box-shadow: var(--sombra); font-size: .92rem; }
.toast-ok { border-color: var(--ok); }
.toast-error { border-color: var(--error); }
.pie { text-align: center; color: var(--suave); font-size: .82rem; padding: 2rem 1rem; border-top: 1px solid var(--borde); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .barra { flex-wrap: wrap; gap: .5rem; }
  .buscador { order: 3; flex-basis: 100%; max-width: none; }
  #btnAdmin span { display: none; }
  .hero { margin-top: 6.2rem; }
  .filtros { top: 5.6rem; }
  .hero-poster { display: none; }
  .modal-cab { grid-template-columns: 1fr; }
  .modal-poster { max-width: 180px; }
  .form-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .filaSwiper .swiper-slide { width: 150px; }
  .filaSwiper .swiper-button-prev, .filaSwiper .swiper-button-next { display: none; }
  .card-info { opacity: 1; transform: none; padding-top: 1.5rem; }
  .card-sinopsis, .card-info .btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
