:root {
  --bg: #faf6f0;
  --surface: #ffffff;
  --text: #2e3244;
  --muted: #707789;
  --primary: #e06d80;
  --primary-soft: #fde8ec;
  --border: #ede6dc;
  --radius: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg);
  color: var(--text);
  padding-bottom: 86px;
}

.hidden { display: none !important; }

.view {
  padding: 18px 16px;
  max-width: 680px;
  margin: 0 auto;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* PORTADA */
.hero-header { padding: 12px 4px 18px; }
.hero-badge {
  display: inline-block;
  background: #f3e8ff;
  color: #6b21a8;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 20px;
  margin-bottom: 8px;
}
.hero-header h1 { font-size: 1.9rem; font-weight: 800; color: #262938; }
.hero-subtitle { color: var(--muted); font-size: 0.95rem; margin-top: 2px; }

.stats-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(180, 155, 130, 0.08);
  margin-bottom: 22px;
}
.stats-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.stat-big { font-size: 2rem; font-weight: 800; color: var(--primary); display: block; line-height: 1; }
.stat-label { font-size: 0.82rem; color: var(--muted); }
.stats-pills { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.pill { font-size: 0.78rem; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.pill-green { background: #dcfce7; color: #166534; }
.pill-amber { background: #fef3c7; color: #92400e; }

.format-breakdown {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #5b6275;
}

/* ACCESOS DIRECTOS EXCLUSIVOS DE PORTADA */
.section-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 12px; color: #262938; }
.shortcuts-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.shortcut-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(180, 155, 130, 0.06);
}
.shortcut-card:active { transform: scale(0.98); border-color: var(--primary); }
.shortcut-icon {
  font-size: 1.55rem;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-orders .shortcut-icon { background: #ffedd5; }
.card-watching .shortcut-icon { background: #e0f2fe; }
.card-reviews .shortcut-icon { background: #fce7f3; }

.shortcut-info { flex: 1; }
.shortcut-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.shortcut-title-row h3 { font-size: 1rem; font-weight: 700; color: var(--text); }
.count-chip {
  background: #f5efe6;
  color: #57534e;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}
.shortcut-info p { font-size: 0.82rem; color: var(--muted); line-height: 1.35; }
.shortcut-arrow { font-size: 1.2rem; color: #b5aba0; font-weight: 700; }

/* ÚLTIMAS AÑADIDAS */
.section-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.section-header-row .section-title { margin-bottom: 0; }
.link-btn { background: none; border: none; color: var(--primary); font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item {
  background: var(--surface);
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.recent-item strong { font-size: 0.92rem; display: block; }
.recent-item span { font-size: 0.78rem; color: var(--muted); }
.mini-tag { font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 8px; }

/* CABECERAS Y BUSCADOR */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.page-header h1 { font-size: 1.4rem; font-weight: 800; color: #262938; }
.page-header p { font-size: 0.82rem; color: var(--muted); }

.controls-box { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  font-size: 0.94rem;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* CUADRÍCULA UNIFICADA DE BIBLIOTECA (5 FIJAS + CATEGORÍAS + BOTÓN +) */
.unified-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.square-card {
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 20px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(160, 140, 120, 0.1);
  transition: transform 0.12s ease;
  position: relative;
}
.square-card:active { transform: scale(0.95); }

/* 5 Casas Fijas en tonos pastel vivos */
.fixed-disney {
  background: linear-gradient(145deg, #bae6fd, #7dd3fc);
  color: #0369a1;
}
.fixed-pixar {
  background: linear-gradient(145deg, #bbf7d0, #6ee7b7);
  color: #047857;
}
.fixed-paramount {
  background: linear-gradient(145deg, #ddd6fe, #c4b5fd);
  color: #5b21b6;
}
.fixed-barbie {
  background: linear-gradient(145deg, #fbcfe8, #f9a8d4);
  color: #9d174d;
}
.fixed-anime {
  background: linear-gradient(145deg, #fed7aa, #fdba74);
  color: #9a3412;
}

.square-logo {
  width: 100%;
  max-width: 94px;
  height: 46px;
}

.square-count {
  font-size: 0.74rem;
  font-weight: 700;
  opacity: 0.85;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.55);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Tarjetas cuadradas de Categorías Alfabéticas */
.category-card {
  border: 1px solid rgba(255, 255, 255, 0.7);
}
.category-name {
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
  word-break: break-word;
  padding: 0 4px;
}
.cat-pastel-0 { background: linear-gradient(145deg, #fef9c3, #fef08a); color: #854d0e; }
.cat-pastel-1 { background: linear-gradient(145deg, #dcfce7, #bbf7d0); color: #166534; }
.cat-pastel-2 { background: linear-gradient(145deg, #ffe4e6, #fecdd3); color: #9f1239; }
.cat-pastel-3 { background: linear-gradient(145deg, #e0f2fe, #bae6fd); color: #075985; }
.cat-pastel-4 { background: linear-gradient(145deg, #f3e8ff, #e9d5ff); color: #6b21a8; }
.cat-pastel-5 { background: linear-gradient(145deg, #ffedd5, #fed7aa); color: #9a3412; }

/* Botón cuadrado (+) para añadir categoría */
.add-category-card {
  background: #ffffff;
  border: 2px dashed #e2a4b0;
  color: var(--primary);
  box-shadow: none;
}
.add-plus-icon {
  font-size: 2.1rem;
  font-weight: 400;
  line-height: 1;
}
.add-category-label {
  font-size: 0.74rem;
  font-weight: 700;
  margin-top: 4px;
}

/* BARRA DE FILTRO ACTIVO */
.active-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.active-filter-bar strong { font-size: 0.95rem; color: var(--primary); }

/* TARJETAS DE PELÍCULAS */
.movies-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.movie-card {
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 3px 10px rgba(180, 155, 130, 0.06);
}
.case-banner { padding: 6px 10px; font-size: 0.72rem; font-weight: 800; display: flex; justify-content: space-between; }
.format-DVD { background: #e2e8f0; color: #334155; }
.format-Blu-ray { background: #bae6fd; color: #0369a1; }
.format-4K { background: #fde68a; color: #92400e; }

.card-body { padding: 12px; flex: 1; }
.card-title { font-size: 0.98rem; font-weight: 700; margin-bottom: 4px; color: #262938; }
.card-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.rating-display { color: #d97706; font-weight: 700; font-size: 0.78rem; margin-bottom: 6px; }
.badge { display: inline-block; background: #f5efe6; color: #57534e; padding: 3px 8px; border-radius: 8px; font-size: 0.74rem; margin-bottom: 6px; font-weight: 600; }
.card-location { font-size: 0.78rem; color: var(--primary); font-weight: 700; }
.card-notes { font-size: 0.75rem; color: var(--muted); margin-top: 6px; font-style: italic; }

.card-footer { padding: 8px 10px; border-top: 1px solid var(--border); display: flex; justify-content: space-around; background: #fcfaf7; }
.icon-btn { background: none; border: none; font-size: 1.15rem; cursor: pointer; padding: 4px 8px; }

/* PANELES Y LISTAS APILADAS */
.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 3px 10px rgba(180, 155, 130, 0.05);
}
.card-panel h3 { font-size: 1rem; color: #262938; }
.card-panel label { font-size: 0.85rem; font-weight: 600; display: flex; flex-direction: column; gap: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; padding: 6px 0; }
.checkbox-label input { width: 18px; height: 18px; accent-color: var(--primary); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

.stack-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.stack-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stack-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.stack-card-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }

/* SELECTOR DOBLE Y ESTRELLAS EN RESEÑAS */
.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #f1ebe1;
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 14px;
}
.seg-btn {
  border: none;
  background: transparent;
  padding: 9px 10px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.84rem;
  color: #6b645c;
  cursor: pointer;
}
.seg-btn.active { background: var(--surface); color: var(--primary); box-shadow: 0 2px 6px rgba(160, 140, 120, 0.12); }

.star-picker { display: flex; gap: 2px; padding: 4px 0; }
.star-btn { background: none; border: none; font-size: 1.55rem; color: #e2d9ce; cursor: pointer; line-height: 1; padding: 0 2px; }
.star-btn.active { color: #f59e0b; }

/* ESCÁNER Y AJUSTES */
.scanner-box { background: #fdf2f4; border: 1px dashed #f4b8c3; border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.scanner-top { display: flex; justify-content: space-between; font-size: 0.9rem; color: #9f1239; margin-bottom: 4px; }
.scanner-top span { font-size: 0.75rem; background: #fce7f3; padding: 2px 8px; border-radius: 10px; }
.scanner-box p { font-size: 0.82rem; color: #be185d; margin-bottom: 10px; }
.scanner-buttons { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.scan-status { margin-top: 10px; padding: 8px 10px; border-radius: 10px; font-size: 0.82rem; }
.scan-loading { background: #ffffff; color: var(--primary); }
.scan-error { background: #fef2f2; color: #b91c1c; }
.scan-ok { background: #f0fdf4; color: #15803d; }

.inline-input-group { display: flex; gap: 8px; }
.mini-feedback { font-size: 0.8rem; color: #15803d; font-weight: 600; }
.backup-row { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid var(--border); }

/* ¿QUÉ VER HOY? */
.btn-pick { width: 100%; padding: 14px; font-size: 1.02rem; }
.tonight-result { margin-top: 10px; }
.spotlight-card { background: var(--surface); border: 2px solid #f4b8c3; border-radius: 20px; overflow: hidden; }
.spotlight-body { padding: 18px; }
.spotlight-body h2 { font-size: 1.45rem; margin-bottom: 4px; }
.spotlight-meta { color: var(--muted); font-size: 0.92rem; margin-bottom: 12px; }
.spotlight-actions { display: flex; gap: 10px; margin-top: 16px; }
.spotlight-actions button { flex: 1; }

/* BOTONES */
.btn { border: none; padding: 10px 14px; border-radius: 13px; font-weight: 700; font-size: 0.9rem; cursor: pointer; text-align: center; }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; }
.btn-primary { background: var(--primary); color: #ffffff; box-shadow: 0 3px 8px rgba(224, 109, 128, 0.25); }
.btn-secondary { background: #f3ece2; color: #4a453f; }
.btn-outline { border: 1px solid var(--primary); color: var(--primary); background: #fff; display: inline-block; }
.btn-ghost { background: transparent; color: #be185d; text-decoration: underline; }
.btn-danger { background: #fda4af; color: #881337; }

/* BARRA INFERIOR */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 4px 8px;
  z-index: 40;
}
.nav-item { background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); cursor: pointer; padding: 4px 0; }
.nav-icon { font-size: 1.25rem; }
.nav-label { font-size: 0.72rem; font-weight: 600; }
.nav-item.active { color: var(--primary); }
.nav-item.active .nav-label { font-weight: 800; }
/* MURO DE PORTADAS EN BIBLIOTECA */
.movies-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.poster-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(180, 155, 130, 0.08);
  transition: transform 0.12s ease;
  text-align: left;
  padding: 0;
}

.poster-card:active {
  transform: scale(0.96);
}

.poster-cover-box {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: #f5efe6;
  overflow: hidden;
}

.poster-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poster-fallback {
  width: 100%;
  height: 100%;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(155deg, #fde8ec, #f3e8ff);
  color: #6b21a8;
}

.poster-fallback-icon {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.poster-fallback-title {
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.poster-format-pill {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}

.poster-status-dot {
  position: absolute;
  bottom: 6px;
  left: 6px;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.88);
  padding: 2px 5px;
  border-radius: 6px;
}

.poster-card-footer {
  padding: 7px 8px;
  background: var(--surface);
}

.poster-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* VISTA PREVIA DE PORTADA EN GESTIÓN */
.cover-upload-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #faf6f0;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
}

.form-cover-thumb {
  width: 52px;
  height: 76px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* FICHA DE PELÍCULA (DETALLE COMPLETO) */
.detail-hero {
  display: flex;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(180, 155, 130, 0.08);
}

.detail-poster-wrap {
  width: 112px;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.detail-hero-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.detail-hero-info h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #262938;
  line-height: 1.2;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.detail-section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-grid-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-field span {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
}

.detail-field strong {
  font-size: 0.9rem;
  color: var(--text);
}

.detail-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
/* FORMATO VHS EN TONO PASTEL LILA */
.format-VHS {
  background: #e9d5ff;
  color: #6b21a8;
}

/* ESTRELLAS INTERACTIVAS EN LA FICHA DE PELÍCULA */
.detail-star-row {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
}

.detail-star-btn {
  background: none;
  border: none;
  font-size: 1.35rem;
  color: #e2d9ce;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.detail-star-btn.active {
  color: #f59e0b;
}

.detail-synopsis-text {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #3f4559;
}

/* VENTANA MODAL PROPIA (CORRIGE EL BORRADO DEL TECLADO EN ANDROID) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(38, 41, 56, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 12px 30px rgba(38, 41, 56, 0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-card h3 {
  font-size: 1.08rem;
  color: #262938;
}

.modal-card p {
  font-size: 0.84rem;
  color: var(--muted);
}
