/* ==========================================================================
   Diseño unificado – Cronology of Movies & Series
   Archivo: /public_html/cronologymoviesandseries/css/estilo.css
   ========================================================================== */

/* ===== Reset básico y tipografía ===== */
* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell,
        "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji",
        "Segoe UI Symbol";
  color: var(--txt);
  background: var(--bg);
  text-rendering: optimizeLegibility;
}

/* ===== Paleta y temas ===== */
:root {
  --brand: #2aa3ff;
  --brand-600: #1f85d1;
  --brand-700: #176aa7;

  --bg: #f6f8fb;
  --card: #ffffff;
  --card-b: #e6ebf2;
  --muted: #6b7280;
  --txt: #111827;

  --header-bg: #0b2a4a;
  --header-b: #0f355c;

  --ring: 0 0 0 3px rgba(42, 163, 255, 0.25);
  --radius: 14px;

  --serie-color: var(--brand);

  --shadow-1: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* Modo oscuro automático */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1622;
    --card: #111a27;
    --card-b: #1c2a3b;
    --txt: #e6edf3;
    --muted: #9aa7b6;
    --header-bg: #0c1a2c;
    --header-b: #102238;
    --shadow-1: 0 6px 20px rgba(0, 0, 0, 0.45);
    --shadow-2: 0 16px 40px rgba(0, 0, 0, 0.55);
  }
}

/* ===== Accesibilidad: focus visible ===== */
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 10px;
}

/* ===== Header / Branding / Nav principal ===== */
.site-header {
  background: linear-gradient(180deg, var(--header-bg), var(--header-b));
  color: #fff;
  padding: clamp(12px, 2vw, 18px) clamp(16px, 3vw, 28px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.brand__logo img {
  height: clamp(42px, 6vw, 56px);
  width: auto;
  display: block;
}

.brand__title {
  margin: 0;
  font-size: clamp(1.05rem, 2.4vw, 1.7rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__subtitle {
  font-weight: 500;
  opacity: 0.9;
}

/* Nav principal del header */
.site-nav {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.site-nav__link,
.site-nav a {
  color: #fff;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
  will-change: transform;
}

.site-nav__link:hover,
.site-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

/* ===== Contenedor principal ===== */
.main {
  width: min(1200px, 92vw);
  margin: clamp(16px, 3vw, 28px) auto;
}

.main h2 {
  margin: 0 0 12px 0;
  font-size: clamp(1.15rem, 2.3vw, 1.6rem);
}

/* ===== Controles / Formularios ===== */
label {
  display: block;
  font-weight: 600;
  margin: 12px 0 6px;
  color: var(--muted);
}

select,
input[type="text"],
textarea {
  width: 100%;
  background: var(--card);
  color: var(--txt);
  border: 1px solid var(--card-b);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.04s ease;
}

select:focus,
input[type="text"]:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: var(--ring);
}

button,
.btn {
  appearance: none;
  border: 0;
  background: var(--brand);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-1);
}

button:hover,
.btn:hover {
  filter: brightness(1.05);
}

button:active,
.btn:active {
  transform: translateY(1px);
}

/* ===== Grilla de resultados ===== */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: clamp(12px, 2vw, 18px);
  margin-top: 18px;
}

/* ===== Card genérica ===== */
.card {
  display: grid;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--card-b);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-1);
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
  color: inherit;
  align-content: start;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: color-mix(in oklab, var(--brand) 40%, var(--card-b));
}

.card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  margin: 0 auto 0.5rem;
}

.card h3 {
  margin: 2px 2px 6px;
  color: var(--brand);
  font-size: clamp(0.95rem, 1.8vw, 1.05rem);
  line-height: 1.25;
}

/* ===== Cards de detalle de saga ===== */
.card--saga {
  grid-template-rows: auto 1fr;
}

.card__header {
  margin-bottom: 4px;
}

.card__body {
  display: block;
  text-decoration: none;
  color: inherit;
}

.card__body img {
  margin-bottom: 6px;
}

.card .aka {
  margin: 0 2px 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.card__plot {
  margin: 4px 2px 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ===== Badge opcional ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--brand) 18%, var(--card-b));
  color: color-mix(in oklab, var(--brand) 60%, #fff);
  font-size: 0.85rem;
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.95rem;
  color: var(--muted);
  margin: 10px 0 14px;
}

.breadcrumbs a {
  color: var(--brand);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

/* ===== Toggle "visto" ===== */
.seen-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--card-b);
  background: var(--card);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.06s ease;
}

.seen-toggle:hover {
  border-color: var(--brand);
}

.seen-toggle:active {
  transform: translateY(1px);
}

.seen-toggle[data-seen="1"] {
  background: color-mix(in oklab, var(--brand) 15%, var(--card));
  border-color: var(--brand);
  color: color-mix(in oklab, var(--brand) 65%, #fff);
}

/* Cursor en todo el pill */
.seen-toggle,
.seen-toggle * {
  cursor: pointer;
}

/* Versión pill con color de serie (usada en sagas) */
.series-tag.seen-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 20px;
  border: 2px solid var(--serie-color);
  color: var(--serie-color);
  background: color-mix(in oklab, var(--serie-color) 8%, transparent);
  margin-bottom: 10px;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.06s ease;
}

.series-tag.seen-toggle:hover {
  transform: translateY(-1px);
}

.series-tag .seen-icon {
  font-size: 1.05rem;
  line-height: 1;
  width: 1.2em;
  text-align: center;
}

.series-tag {
  max-width: 100%;
  overflow: hidden;
  text-align: center;
}

.series-tag[data-seen="1"] {
  background: color-mix(in oklab, var(--serie-color) 15%, #ffffff10);
  border-color: var(--serie-color);
  color: color-mix(in oklab, var(--serie-color) 75%, #ffffff);
}

.series-tag .series-name {
  font-weight: 600;
  display: block;
  white-space: normal;
  word-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.95rem;
  line-height: 1.3;
  margin: 0.25rem 0;
}

/* ===== Enlace "ver ficha" ===== */
a.verficha {
  display: inline-block;
  background: linear-gradient(135deg, #0077cc, #00b3ff);
  color: #fff;
  font-weight: 600;
  font-family: "Segoe UI", Roboto, sans-serif;
  text-decoration: none;
  padding: 4px 10px;
  margin-left: 6px;
  border-radius: 6px;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

a.verficha:hover {
  background: linear-gradient(135deg, #005fa3, #0090dd);
  transform: translateY(-1px);
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.25);
}

a.verficha:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ===== Bloques de notificación (nf-*) ===== */
.nf-wrap {
  border: 1px solid #e7e7ee;
  border-radius: 12px;
  padding: 14px 16px;
  background: #121823;
}

.nf-emoji {
  font-size: 22px;
  line-height: 1;
}

.nf-title {
  font-weight: 700;
  margin-top: 6px;
  margin-bottom: 6px;
}

.nf-text {
  color: #eae5e5;
  margin-bottom: 10px;
}

.nf-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}

.nf-btn {
  border: 1px solid #d6d6ea;
  background: #305888;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
}

.nf-btn:hover {
  background: #0e1e32;
}

.nf-subtitle {
  font-weight: 600;
  margin: 6px 0;
}

.nf-tips {
  margin: 6px 0 10px 18px;
}

.nf-tips li {
  margin: 4px 0;
}

.nf-contact {
  margin-top: 8px;
  font-size: 0.95em;
  color: #eae5e5;
}

/* ===== Footer ===== */
footer {
  background: linear-gradient(180deg, var(--header-b), var(--header-bg));
  color: #fff;
  text-align: center;
  padding: 20px;
  margin-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

footer a {
  color: #cfe8ff;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

footer ul {
  list-style: none;
  display: flex;
  gap: 14px;
  padding: 0;
  margin: 10px auto 0;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Utilidades ===== */
.container {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

.muted {
  color: var(--muted);
}

.center {
  text-align: center;
}

.hidden {
  display: none !important;
}

/* ===== Responsivo ===== */
@media (max-width: 1024px) {
  .brand__title {
    font-size: 1.35rem;
  }
}

@media (max-width: 720px) {
  .site-header {
    padding: 12px 16px;
  }
  .brand {
    gap: 10px;
    flex: 1 1 100%;
  }
  .brand__title {
    white-space: normal;
    font-size: 1.15rem;
  }
  .site-nav {
    width: 100%;
    gap: 8px;
    justify-content: flex-start;
  }
}

@media (max-width: 440px) {
  .brand__logo img {
    height: 38px;
  }
  .brand__title {
    font-size: 1.02rem;
  }
}

/* ===== Respeta usuarios con “reduced motion” ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
