/* ============================================================
   CineScope — style.css
   Cinema dark theme with gold accents
   ============================================================ */
:root {
  --bg: #0a0a12;
  --panel: #14141f;
  --panel-2: #1d1d2c;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f1f2f8;
  --muted: #9aa0b4;
  --gold: #f5c518;
  --gold-dark: #d4a70f;
  --red: #ff5e78;
  --green: #2ecc71;
  --orange: #f39c12;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font: inherit; }
a { color: var(--gold); }
.container { width: min(1180px, 94%); margin-inline: auto; }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(10, 10, 18, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.header-inner { display: flex; align-items: center; gap: 18px; }
.logo { font-size: 1.3rem; font-weight: 900; text-decoration: none; color: var(--text); white-space: nowrap; }
.logo span { color: var(--gold); }

.search-wrap { flex: 1; max-width: 420px; }
.search-wrap input {
  width: 100%; padding: 11px 18px; border-radius: 999px;
  background: var(--panel-2); border: 1.5px solid var(--border); color: var(--text);
}
.search-wrap input:focus { outline: none; border-color: var(--gold); }

.header-actions { display: flex; gap: 10px; margin-left: auto; }
.wl-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; font-weight: 800;
  background: var(--panel-2); border: 1.5px solid var(--border); transition: 0.2s;
}
.wl-btn:hover { border-color: var(--red); }
.wl-count {
  background: var(--red); color: #fff; min-width: 22px; height: 22px;
  border-radius: 999px; display: grid; place-items: center; font-size: 0.75rem;
}
.settings-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--panel-2); border: 1.5px solid var(--border); font-size: 1.05rem;
}
.settings-btn:hover { border-color: var(--gold); transform: rotate(20deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 380px; display: flex; align-items: flex-end;
  overflow: hidden; transition: opacity 0.4s;
}
.hero-banner {
  position: absolute; inset: 0; display: grid; place-items: center;
  transition: opacity 0.7s ease; opacity: 0;
}
.hero-banner.active { opacity: 1; }
.hero-banner .backdrop { position: absolute; inset: 0; }
.hero-banner .watermark {
  position: absolute; right: 4%; top: 50%; transform: translateY(-50%) rotate(-8deg);
  font-size: clamp(7rem, 22vw, 15rem); opacity: 0.22; filter: drop-shadow(0 10px 40px rgba(0,0,0,0.4));
  pointer-events: none;
}
.hero-content {
  position: relative; z-index: 2; width: 100%;
  padding: 40px 0 46px;
  background: linear-gradient(180deg, transparent, rgba(10, 10, 18, 0.92) 70%);
}
.hero-content .container > * { max-width: 620px; }
.hero-kicker {
  display: inline-block; font-size: 0.75rem; font-weight: 900; letter-spacing: 2px;
  color: var(--bg); background: var(--gold); padding: 4px 14px; border-radius: 999px;
  margin-bottom: 12px; text-transform: uppercase;
}
.hero-title { font-size: clamp(1.7rem, 4.5vw, 3rem); font-weight: 900; line-height: 1.15; }
.hero-meta { display: flex; gap: 14px; align-items: center; color: var(--muted); font-weight: 700; margin: 10px 0; flex-wrap: wrap; }
.hero-meta .rating { color: var(--gold); }
.hero-overview { color: #cfd2e0; font-size: 0.95rem; margin-bottom: 18px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  padding: 12px 24px; border-radius: 12px; font-weight: 800;
  background: var(--panel-2); border: 1.5px solid var(--border); transition: 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn.primary { background: var(--gold); color: #1a1500; border-color: transparent; }
.btn.primary:hover { background: var(--gold-dark); }
.btn.ghost:hover { border-color: var(--gold); }
.btn.saved { background: var(--red); border-color: transparent; color: #fff; }

.hero-dots { position: absolute; bottom: 16px; left: 0; right: 0; display: flex; gap: 8px; justify-content: center; z-index: 3; }
.hero-dots button {
  width: 26px; height: 5px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.25); transition: 0.3s;
}
.hero-dots button.active { background: var(--gold); width: 40px; }

/* ---------- Tabs / filters ---------- */
.main { padding: 30px 0 70px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; }
.tab {
  flex-shrink: 0; padding: 10px 22px; border-radius: 999px; font-weight: 800;
  background: var(--panel); border: 1.5px solid var(--border); color: var(--muted); transition: 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--gold); color: #1a1500; border-color: transparent; }

.filter-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.genre-bar { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; scrollbar-width: thin; }
.genre-chip {
  flex-shrink: 0; padding: 7px 16px; border-radius: 999px; font-size: 0.82rem; font-weight: 700;
  background: transparent; border: 1.5px solid var(--border); color: var(--muted); transition: 0.2s;
}
.genre-chip:hover { color: var(--text); }
.genre-chip.active { border-color: var(--gold); color: var(--gold); }
.sort-wrap { font-size: 0.85rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.sort-wrap select {
  margin-left: 8px; padding: 8px 12px; border-radius: 10px;
  background: var(--panel-2); border: 1.5px solid var(--border); color: var(--text); font-weight: 600;
}

.result-count { color: var(--muted); font-size: 0.85rem; font-weight: 600; margin: 10px 0 18px; }

/* ---------- Movie grid & cards ---------- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}
.card {
  border-radius: var(--radius); overflow: hidden; background: var(--panel);
  border: 1px solid var(--border); cursor: pointer;
  transition: transform 0.28s, border-color 0.28s, box-shadow 0.28s;
  animation: rise 0.4s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.card:hover { transform: translateY(-7px) scale(1.02); border-color: var(--gold); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }

.poster {
  position: relative; aspect-ratio: 2 / 3; display: grid; place-items: center; overflow: hidden;
}
.poster .p-emoji {
  font-size: 4.2rem; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45));
  transition: transform 0.3s;
}
.card:hover .p-emoji { transform: scale(1.15) rotate(-5deg); }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster .p-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.75));
}

.rating-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 900; color: #06220f;
}
.rating-badge.hi  { background: var(--green); color: #fff; }
.rating-badge.mid { background: var(--orange); color: #fff; }
.rating-badge.lo  { background: var(--red); color: #fff; }

.heart-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; font-size: 1rem;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(4px);
  transition: transform 0.2s;
}
.heart-btn:hover { transform: scale(1.18); }
.heart-btn.saved { background: var(--red); }

.card-body { padding: 12px 14px 14px; }
.card-title { font-size: 0.95rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { color: var(--muted); font-size: 0.78rem; font-weight: 600; margin-top: 2px; }
.card-genres { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.card-genres span {
  font-size: 0.68rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--panel-2); color: var(--muted);
}

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 70px 0; color: var(--muted); }
.empty-icon { font-size: 4rem; display: block; margin-bottom: 10px; }
.empty h2 { color: var(--text); margin-bottom: 6px; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(5, 5, 10, 0.7); padding: 18px;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-card {
  width: min(680px, 100%); max-height: 90vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  transform: scale(0.94); transition: transform 0.3s;
}
.modal.show .modal-card { transform: none; }

.m-banner { position: relative; height: 210px; display: grid; place-items: center; overflow: hidden; }
.m-banner .watermark { font-size: 7rem; opacity: 0.35; filter: drop-shadow(0 10px 24px rgba(0,0,0,0.5)); }
.m-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }
.m-close {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 1rem;
}
.m-close:hover { background: var(--red); }

.m-body { padding: 22px 26px 28px; }
.m-title { font-size: 1.5rem; font-weight: 900; }
.m-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-weight: 700; margin: 8px 0 14px; }
.m-meta .rating { color: var(--gold); }
.m-genres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.m-genres span {
  font-size: 0.78rem; font-weight: 800; padding: 5px 14px; border-radius: 999px;
  background: var(--panel-2); color: var(--gold); border: 1px solid var(--border);
}
.m-overview { color: #c9ccd9; margin-bottom: 20px; }
.m-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Settings modal ---------- */
.modal-card.small { width: min(480px, 100%); padding: 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h2 { font-size: 1.15rem; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--border);
}
.icon-btn:hover { border-color: var(--red); color: var(--red); }
.settings-text { color: var(--muted); font-size: 0.9rem; margin-bottom: 16px; }
.ctl { display: flex; flex-direction: column; gap: 6px; font-size: 0.83rem; font-weight: 700; color: var(--muted); margin-bottom: 16px; }
.ctl input {
  padding: 12px 14px; border-radius: 10px;
  background: var(--panel-2); border: 1.5px solid var(--border); color: var(--text);
}
.ctl input:focus { outline: none; border-color: var(--gold); }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.settings-note { margin-top: 14px; font-size: 0.85rem; font-weight: 700; min-height: 1.2em; }
.settings-note.ok { color: var(--green); }
.settings-note.err { color: var(--red); }

/* ---------- Footer & toast ---------- */
.footer { text-align: center; padding: 26px; color: var(--muted); font-size: 0.82rem; border-top: 1px solid var(--border); }

#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 80px);
  background: var(--panel-2); border: 1px solid var(--border);
  padding: 13px 26px; border-radius: 999px; font-weight: 700;
  opacity: 0; transition: 0.3s; z-index: 200; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .search-wrap { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
  .hero { min-height: 330px; }
  .hero-banner .watermark { font-size: 8rem; }
}
