/* CineBase — black/gray minimal, white accents, rating red→gold */
:root {
  --bg: #0a0a0b;
  --surface: #151517;
  --surface-2: #1d1d20;
  --border: #28282c;
  --text: #f4f4f5;
  --text-muted: #98989f;
  --white: #ffffff;
  --danger: #e05656;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Segoe UI", system-ui, -apple-system, sans-serif;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--white); }
main a:not(.btn):not(.card):hover { text-decoration: underline; text-underline-offset: 3px; }
h1 { font-size: 1.65rem; font-weight: 650; letter-spacing: -.015em; }
h2 { font-size: .82rem; font-weight: 600; margin: 2.6rem 0 1.1rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .12em; }
h3 { font-size: 1rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
.muted { color: var(--text-muted); }

.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* ---------- header ---------- */
.site-header {
  background: rgba(10,10,11,.9);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 58px; }
.logo { font-size: 1.2rem; font-weight: 750; letter-spacing: -.02em; color: var(--white); }
.logo span { color: var(--text-muted); font-weight: 500; }

.menu-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer;
  padding: 7px 12px; border-radius: 8px;
}
.menu-btn:hover { background: var(--surface-2); color: var(--white); }

.search-wrap { flex: 1; max-width: 440px; position: relative; }
.search-form { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 14px; color: var(--text-muted); pointer-events: none; }
.search-form input {
  width: 100%; padding: 9px 16px 9px 38px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); outline: none;
  font: inherit; transition: border-color .15s, background .15s;
}
.search-form input:focus { border-color: #4a4a52; background: var(--surface-2); }
.search-form input::placeholder { color: var(--text-muted); }

/* live suggest */
.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
  max-height: 70vh; overflow-y: auto;
}
.suggest-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px;
}
.suggest-item:hover, .suggest-item.active { background: #26262b; }
.suggest-thumb {
  width: 38px; height: 54px; flex-shrink: 0; border-radius: 6px; overflow: hidden;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
}
.suggest-thumb.round { width: 42px; height: 42px; border-radius: 50%; }
.suggest-thumb img { width: 100%; height: 100%; object-fit: cover; }
.suggest-ph { font-size: 1rem; opacity: .5; }
.suggest-text { display: flex; flex-direction: column; min-width: 0; }
.suggest-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-sub { color: var(--text-muted); font-size: .82rem; }
.suggest-rating { margin-left: auto; font-weight: 650; font-size: .88rem; flex-shrink: 0; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lang-switch a { color: var(--text-muted); font-size: .78rem; padding: 2px 5px; font-weight: 600; }
.lang-switch a.active { color: var(--white); }
.user-name { color: var(--text-muted); font-size: .9rem; }
.inline-form { display: inline; }

/* ---------- menu overlay ---------- */
.menu-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8,8,9,.98);
  overflow-y: auto;
}
.menu-inner { padding-top: 14px; padding-bottom: 60px; }
.menu-head { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.menu-close {
  background: var(--white); color: #111; border: none;
  width: 38px; height: 38px; border-radius: 50%;
  font-size: 1rem; cursor: pointer;
}
.menu-close:hover { transform: scale(1.06); }
.menu-cols {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px;
  margin-top: 40px;
}
.menu-col h4 {
  margin: 0 0 14px; font-size: .8rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .12em;
}
.menu-col a { display: block; padding: 7px 0; font-size: 1.05rem; font-weight: 500; color: var(--text); }
.menu-col a:hover { color: var(--white); padding-left: 6px; transition: padding .12s; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 7px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: transparent; color: var(--text);
  font-size: .9rem; font-family: inherit; font-weight: 550; cursor: pointer;
}
.btn:hover { border-color: #4a4a52; color: var(--white); }
.btn-primary { background: var(--white); border-color: var(--white); color: #111; }
.btn-primary:hover { background: #e4e4e7; border-color: #e4e4e7; color: #111; }
.btn-ghost { border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--white); border-color: transparent; background: var(--surface-2); }
.btn-danger { border-color: transparent; color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 3px 10px; font-size: .8rem; }
.btn-wide { width: 100%; padding: 10px; }
.btn-google {
  width: 100%; padding: 12px; font-size: 1rem;
  background: var(--white); border-color: var(--white); color: #111;
  border-radius: var(--radius);
}
.btn-google:hover { background: #e4e4e7; color: #111; }

/* ---------- flash ---------- */
.flash {
  margin: 14px 0; padding: 10px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--white); border-radius: var(--radius);
}
.flash-error { border-left-color: var(--danger); }

/* ---------- grids & cards ---------- */
.grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  margin: 1rem 0 2.4rem;
}
.grid-cast { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.card { display: block; }
.card-poster {
  aspect-ratio: 2/3; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); position: relative;
  border: 1px solid var(--border);
  transition: transform .16s ease, border-color .16s ease;
}
.card:hover .card-poster { transform: translateY(-4px); border-color: #4a4a52; }
.card-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-photo { aspect-ratio: 3/4; }
.poster-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; color: #3a3a40; background: var(--surface-2); font-weight: 700;
}
.poster-placeholder.big { font-size: 5rem; }
.card-rating {
  position: absolute; top: 8px; left: 8px;
  background: rgba(8,8,9,.88);
  padding: 2px 8px; border-radius: 7px; font-size: .8rem; font-weight: 700;
}
.card-title { margin-top: 9px; font-size: .92rem; font-weight: 550; line-height: 1.35; }
.card-sub { color: var(--text-muted); font-size: .8rem; }

/* ---------- movie / person page ---------- */
.movie-page { margin: 2.2rem 0; }
.movie-layout { display: grid; grid-template-columns: 300px 1fr; gap: 40px; }
.movie-poster img, .movie-poster .poster-placeholder {
  width: 100%; aspect-ratio: 2/3; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--border);
}
.movie-info h1 { margin: 0 0 4px; }
.tagline { color: var(--text-muted); font-style: italic; }
.rating-block { display: flex; align-items: baseline; gap: 12px; margin: 16px 0 8px; }
.rating-big { font-size: 1.7rem; font-weight: 750; }
.rate-form { margin: 10px 0 22px; }
.stars { display: inline-flex; gap: 4px; margin-left: 8px; }
.star {
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); cursor: pointer; font-size: .8rem; font-weight: 600;
}
.star:hover, .star.active { background: var(--white); color: #111; border-color: var(--white); }
.facts { display: grid; grid-template-columns: 140px 1fr; gap: 6px 18px; margin: 20px 0; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; }
.description { max-width: 640px; }

/* ---------- top list ---------- */
.top-list { list-style: none; padding: 0; margin: 1.4rem 0; max-width: 720px; }
.top-list li {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.top-rank { min-width: 34px; text-align: right; color: var(--text-muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.top-poster { width: 44px; height: 64px; border-radius: 7px; overflow: hidden; flex-shrink: 0; background: var(--surface); }
.top-poster img { width: 100%; height: 100%; object-fit: cover; }
.top-poster .poster-placeholder { font-size: 1.1rem; }
.top-text { display: flex; flex-direction: column; min-width: 0; }
.top-text a { font-weight: 600; }
.top-rating { margin-left: auto; font-weight: 750; font-size: 1.05rem; flex-shrink: 0; }
.top-count { font-size: .8rem; flex-shrink: 0; min-width: 80px; text-align: right; }

/* ---------- filmography ---------- */
.role-heading { color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; margin: 1.8rem 0 .6rem; }
.filmography { list-style: none; padding: 0; margin: 0; max-width: 720px; }
.filmography li { padding: 9px 0; border-bottom: 1px solid var(--border); display: flex; gap: 14px; align-items: baseline; }
.film-year { color: var(--text-muted); min-width: 46px; font-variant-numeric: tabular-nums; }
.film-rating { margin-left: auto; font-size: .88rem; font-weight: 650; }

/* ---------- auth ---------- */
.auth-box { max-width: 380px; margin: 70px auto; }
.auth-box h1 { text-align: center; margin-bottom: 28px; }
.auth-box label { display: block; margin-bottom: 14px; color: var(--text-muted); font-size: .9rem; }
.auth-box input {
  width: 100%; margin-top: 5px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); outline: none; font: inherit;
}
.auth-box input:focus { border-color: #4a4a52; }
.admin-login { margin-top: 30px; }
.admin-login summary { cursor: pointer; font-size: .85rem; text-align: center; list-style: none; }
.admin-login summary:hover { color: var(--text); }
.admin-login form { margin-top: 16px; }

/* ---------- pager & footer ---------- */
.pager { display: flex; gap: 16px; justify-content: center; margin: 2rem 0; color: var(--text-muted); }
.site-footer { border-top: 1px solid var(--border); margin-top: 70px; padding: 26px 0; color: var(--text-muted); font-size: .85rem; }

/* ---------- admin ---------- */
.admin-body { display: flex; min-height: 100vh; margin: 0; }
.admin-sidebar {
  width: 210px; flex-shrink: 0; padding: 24px 18px;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 26px;
}
.admin-sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.admin-sidebar nav a { padding: 8px 12px; border-radius: 8px; color: var(--text-muted); }
.admin-sidebar nav a:hover { background: var(--surface-2); color: var(--white); }
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--text-muted); }
.admin-main { flex: 1; padding: 28px 36px; max-width: 1100px; }

.page-head { display: flex; align-items: center; justify-content: space-between; }
.admin-search { margin: 10px 0 18px; }
.admin-search input {
  width: 300px; padding: 8px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); outline: none; font: inherit;
}

.stat-row { display: flex; gap: 16px; margin: 20px 0; flex-wrap: wrap; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 26px; display: flex; flex-direction: column; min-width: 120px;
}
.stat b { font-size: 1.6rem; }
.stat span { color: var(--text-muted); font-size: .85rem; }
a.stat:hover { border-color: #4a4a52; }

.table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-muted); font-weight: 500; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }

.admin-form label { display: block; margin-bottom: 12px; color: var(--text-muted); font-size: .88rem; }
.admin-form input:not([type=checkbox]):not([type=file]), .admin-form textarea, .admin-form select,
.credit-add input, .credit-add select {
  width: 100%; margin-top: 4px; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); outline: none; font-family: inherit;
}
.admin-form input:focus, .admin-form textarea:focus { border-color: #4a4a52; }
.form-cols { display: grid; grid-template-columns: 1fr 300px; gap: 32px; margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; }
.form-poster { width: 100%; border-radius: var(--radius); margin: 10px 0; border: 1px solid var(--border); }
.genre-list { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-top: 14px; }
.genre-list legend { color: var(--text-muted); font-size: .85rem; padding: 0 6px; }
.check { display: block; margin: 3px 0; color: var(--text); font-size: .9rem; }
.credit-add { display: flex; gap: 10px; align-items: center; margin: 14px 0; flex-wrap: wrap; }
.credit-add input, .credit-add select { width: auto; min-width: 160px; margin-top: 0; }

/* admin image handling */
.thumb-cell { width: 46px; }
.thumb {
  width: 36px; height: 52px; object-fit: cover; display: block;
  border-radius: 6px; border: 1px solid var(--border);
}
.thumb-round { width: 40px; height: 40px; border-radius: 50%; }
.thumb-empty { display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-muted); font-size: .75rem; }
a:hover .thumb { border-color: var(--white); }
.img-box { margin: 4px 0 14px; }
.img-box .form-poster { max-width: 100%; cursor: zoom-in; margin: 6px 0; }
.img-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .8rem; margin-top: 2px; }
.img-actions .muted { word-break: break-all; }

@media (max-width: 800px) {
  .movie-layout { grid-template-columns: 1fr; }
  .movie-poster { max-width: 260px; }
  .form-cols { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
  .search-wrap { order: 3; max-width: none; width: 100%; }
  .menu-cols { grid-template-columns: 1fr; gap: 30px; }
  .admin-body { flex-direction: column; }
  .admin-sidebar { width: auto; flex-direction: row; align-items: center; }
  .admin-sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-bottom { margin-top: 0; margin-left: auto; }
}
