/* ===================================================================
   MovieStub stylesheet
   Colours live in one place (the :root block) so you can restyle the
   whole site by changing a handful of values here.
   =================================================================== */

:root {
  --bg:         #101519;
  --bg-deep:    #0b0f12;
  --surface:    #1a2229;
  --surface-2:  #232d36;
  --line:       #2c3841;
  --text:       #e4eaef;
  --muted:      #8ea1b0;
  --dim:        #64757f;

  --green:      #2ad17e;
  --orange:     #ff9a1f;
  --blue:       #4bb8f0;
  --red:        #ff5c5c;

  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 6px 24px rgba(0,0,0,.45);
  --nav-h:      58px;
  --font: "Graphik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--green); }

img { display: block; max-width: 100%; }

h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 700; line-height: 1.2; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

button, input, select, textarea { font-family: inherit; font-size: inherit; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 18px; }
.stack > * + * { margin-top: 22px; }
.muted { color: var(--muted); }
.dim   { color: var(--dim); }
.small { font-size: .82rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------------- Nav ---------------- */

.nav {
  position: sticky; top: 0; z-index: 60;
  height: var(--nav-h);
  background: rgba(11,15,18,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 18px;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 18px;
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.01em; font-size: 1.05rem; }
.logo:hover { color: var(--text); }
.logo-stub { width: 31px; height: 20px; display: block; flex: 0 0 auto; }

.nav-links { display: flex; gap: 16px; align-items: center; }
.nav-links a {
  color: var(--muted); font-size: .85rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.nav-links a:hover, .nav-links a.on { color: var(--text); }

.nav-search { position: relative; margin-left: auto; }
.nav-search input {
  width: 210px; padding: 7px 12px 7px 32px;
  background: var(--surface-2); border: 1px solid transparent;
  border-radius: 20px; color: var(--text); outline: none;
  transition: width .18s, border-color .18s;
}
.nav-search input:focus { width: 280px; border-color: var(--line); }
.nav-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); opacity: .55; }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); cursor: pointer;
  font-weight: 600; font-size: .88rem;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: #2c3944; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); border-color: var(--green); color: #08130d; }
.btn-primary:hover { background: #35e08b; }
.btn-danger { color: var(--red); border-color: #4a2b2b; background: #291c1c; }
.btn-danger:hover { background: #3a2323; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-sm { padding: 5px 11px; font-size: .8rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------------- Forms ---------------- */

.field { margin-bottom: 14px; }
.field label {
  display: block; margin-bottom: 5px;
  font-size: .76rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.input, textarea.input, select.input {
  width: 100%; padding: 10px 12px;
  background: var(--bg-deep); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  outline: none;
}
.input:focus { border-color: var(--green); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.55; }

.check { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: .9rem; }
.check input { width: 16px; height: 16px; accent-color: var(--green); cursor: pointer; }

.error-box {
  background: #2b1a1a; border: 1px solid #4a2b2b; color: #ffb3b3;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: .87rem; margin-bottom: 12px;
}

/* ---------------- Posters ---------------- */

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 14px;
}
.poster-grid.big { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

.poster {
  position: relative; display: block;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: transform .13s, border-color .13s;
}
.poster:hover { transform: translateY(-3px); border-color: var(--green); }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster .fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 10px; text-align: center;
  font-size: .74rem; color: var(--muted); line-height: 1.3;
}
.poster-item { display: flex; flex-direction: column; gap: 5px; }
.poster-meta { font-size: .74rem; color: var(--muted); display: flex; align-items: center; gap: 6px; min-height: 16px; }
.poster-title { font-size: .8rem; font-weight: 600; line-height: 1.25; }

/* ---------------- Stars ---------------- */

.stars { display: inline-flex; gap: 1px; vertical-align: middle; }
.stars svg { display: block; }
.star-full  { fill: var(--green); }
.star-empty { fill: #33414c; }

.star-picker { display: inline-flex; gap: 2px; cursor: pointer; }
.star-picker .sp { position: relative; width: 30px; height: 30px; }
.star-picker .sp-half { position: absolute; top: 0; height: 100%; width: 50%; z-index: 2; }
.star-picker .sp-half.left  { left: 0; }
.star-picker .sp-half.right { right: 0; }

/* ---------------- Cards & panels ---------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 7px; margin-bottom: 14px;
}
.section-head h2 {
  margin: 0; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.section-head a { font-size: .78rem; color: var(--muted); }

/* ---------------- Activity / diary rows ---------------- */

.entry {
  display: flex; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.entry:last-child { border-bottom: none; }
.entry .poster { width: 62px; flex: 0 0 62px; }
.entry-body { flex: 1; min-width: 0; }
.entry-title { font-weight: 700; font-size: 1rem; }
.entry-title .yr { color: var(--muted); font-weight: 400; font-size: .85rem; margin-left: 5px; }
.entry-sub { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.entry-review { margin-top: 8px; font-size: .9rem; color: #c8d3db; white-space: pre-wrap; word-wrap: break-word; }
.entry-actions { margin-top: 8px; display: flex; gap: 7px; }

.spoiler-wrap { position: relative; }
.spoiler-hidden { filter: blur(5px); user-select: none; }
.spoiler-note {
  display: inline-block; margin-top: 6px; font-size: .78rem;
  color: var(--orange); cursor: pointer; font-weight: 600;
}

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .78rem; color: var(--muted);
  flex: 0 0 auto;
}
.avatar.lg { width: 62px; height: 62px; font-size: 1.4rem; }

.heart { color: var(--orange); }
.badge {
  display: inline-block; padding: 2px 7px; border-radius: 20px;
  background: var(--surface-2); font-size: .7rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}

/* ---------------- Film page ---------------- */

.backdrop {
  position: relative; height: 320px; margin-bottom: -140px;
  background-size: cover; background-position: center 20%;
}
.backdrop::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(16,21,25,.35) 0%, rgba(16,21,25,.8) 55%, var(--bg) 100%);
}
.film-head { position: relative; z-index: 2; display: flex; gap: 26px; align-items: flex-start; }
.film-head .poster { width: 200px; flex: 0 0 200px; box-shadow: var(--shadow); }
.film-head h1 { font-size: 2.1rem; margin-bottom: 4px; }
.film-head .yr { color: var(--muted); font-weight: 400; }
.film-facts { color: var(--muted); font-size: .88rem; margin: 6px 0 14px; }
.tagline { font-style: italic; color: var(--muted); text-transform: uppercase; font-size: .78rem; letter-spacing: .06em; margin-bottom: 8px; }
.overview { max-width: 620px; color: #c8d3db; }

.avg-block { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.avg-num { font-size: 1.6rem; font-weight: 800; }

/* ---------------- Film page action panel ---------------- */

.action-panel {
  position: relative; z-index: 2;
  width: 236px; flex: 0 0 236px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.ap-icons { display: flex; border-bottom: 1px solid var(--line); }
.ap-icon {
  flex: 1; background: none; border: none; cursor: pointer;
  padding: 13px 4px 11px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--muted); transition: color .15s, background .15s;
}
.ap-icon + .ap-icon { border-left: 1px solid var(--line); }
.ap-icon:hover { background: var(--surface-2); color: var(--text); }
.ap-icon.on { color: var(--green); }
.ap-icon.on.liked { color: var(--orange); }
.ap-icon[disabled] { opacity: .55; cursor: default; }
.ap-glyph { position: relative; display: block; line-height: 0; }
.ap-label { font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.ap-badge {
  position: absolute; right: -7px; bottom: -3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); font-size: .62rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

.ap-rate { padding: 12px 10px 14px; border-bottom: 1px solid var(--line); text-align: center; }
.ap-rate-label {
  font-size: .66rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}
.ap-rate-row { display: flex; align-items: center; justify-content: center; gap: 4px; }
.ap-clear {
  background: none; border: none; cursor: pointer;
  color: var(--dim); font-size: 1.2rem; line-height: 1; padding: 0 3px;
}
.ap-clear:hover { color: var(--red); }

.ap-menu { display: flex; flex-direction: column; }
.ap-menu button {
  background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 11px 14px; text-align: center; cursor: pointer;
  color: var(--text); font-size: .84rem; font-weight: 600;
}
.ap-menu button:last-child { border-bottom: none; }
.ap-menu button:hover { background: var(--surface-2); color: var(--green); }

/* ---------------- Per-film activity list ---------------- */

.activity-list .act { border-bottom: 1px solid var(--line); padding: 12px 0; }
.activity-list .act:last-child { border-bottom: none; }
.act-main { display: flex; gap: 11px; align-items: flex-start; }
.act-line { font-size: .92rem; line-height: 1.55; }
.act-line .stars { margin: 0 2px; }
.act-age { white-space: nowrap; padding-top: 2px; }
.act .entry-actions { margin-left: 41px; }

.trend {
  font-size: .76rem; font-weight: 700; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 20px; background: var(--surface-2);
}
.trend.up { color: var(--green); }
.trend.down { color: var(--orange); }
.trend.flat { color: var(--muted); }
.trend .dim { font-weight: 400; }

/* ---------------- Tags ---------------- */

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: .74rem; font-weight: 600; color: var(--muted);
  transition: color .13s, border-color .13s;
}
.tag:hover { color: var(--green); border-color: var(--green); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-top: 14px; }
.tag-cloud .tag { padding: 5px 12px; }

/* ---------------- Tabs ---------------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  padding: 9px 14px; cursor: pointer; background: none; border: none;
  color: var(--muted); font-weight: 600; font-size: .85rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--green); }

/* Uppercase variant, used for the Account settings sub-navigation. */
.tabs-caps { align-items: center; margin-bottom: 24px; }
.tabs-caps .tab {
  text-transform: uppercase; letter-spacing: .08em;
  font-size: 1rem; font-weight: 800; padding: 12px 2px;
  margin-right: 30px; color: var(--green); opacity: .75;
  border-bottom-width: 3px;
}
.tabs-caps .tab:hover { color: var(--green); opacity: 1; }
.tabs-caps .tab.on {
  color: var(--green); opacity: 1;
  border-bottom-color: var(--green);
}
.tabs-caps .tab-right {
  margin: 0 0 0 auto; padding: 8px 14px;
  color: var(--red); opacity: 1;
  border: 1px solid #4a2b2b; border-radius: var(--radius-sm);
  background: #291c1c;
  text-transform: uppercase; letter-spacing: .06em;
  font-weight: 800; font-size: .88rem;
}
.tabs-caps .tab-right:hover { background: #3a2323; color: #ff8080; }

.pronoun {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border-radius: 20px; background: var(--surface-2);
  font-size: .72rem; font-weight: 600; color: var(--muted);
  vertical-align: 1px;
}

select.input {
  appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

/* ---------------- Stats ---------------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px;
}
.stat .n { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat .l { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-top: 6px; }

.bar-chart { display: flex; align-items: flex-end; gap: 5px; height: 130px; }
.bar-chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; }
.bar-chart .bar { width: 100%; background: var(--green); border-radius: 3px 3px 0 0; min-height: 2px; transition: opacity .15s; }
.bar-chart .col:hover .bar { opacity: .75; }
.bar-chart .lbl { font-size: .65rem; color: var(--dim); white-space: nowrap; }
.bar-chart .val { font-size: .68rem; color: var(--muted); }

.hbar-row { display: grid; grid-template-columns: 150px 1fr 44px; gap: 10px; align-items: center; padding: 4px 0; font-size: .85rem; }
.hbar-track { background: var(--surface-2); border-radius: 4px; height: 9px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--blue); border-radius: 4px; }
.hbar-row .num { text-align: right; color: var(--muted); font-size: .8rem; }
.hbar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- Import / export ---------------- */

.dl-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.progress {
  height: 8px; border-radius: 5px; overflow: hidden;
  background: var(--surface-2); margin-top: 7px;
}
.progress-fill {
  height: 100%; background: var(--green); border-radius: 5px;
  transition: width .25s ease-out;
}

input[type="file"].input { padding: 8px 10px; cursor: pointer; }
input[type="file"].input::file-selector-button {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 5px 11px; margin-right: 10px; cursor: pointer; font-weight: 600;
}
input[type="file"].input::file-selector-button:hover { background: #2c3944; }

details summary::-webkit-details-marker { color: var(--muted); }
code {
  background: var(--surface-2); padding: 1px 5px;
  border-radius: 4px; font-size: .85em;
}

/* ---------------- Modal ---------------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6,9,11,.78);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; max-width: 560px; padding: 22px;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.x {
  background: none; border: none; color: var(--muted);
  font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0 4px;
}
.x:hover { color: var(--text); }

/* ---------------- Toast ---------------- */

#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 20px; box-shadow: var(--shadow);
  font-size: .88rem; font-weight: 600;
  animation: pop .2s ease-out;
}
.toast.bad { border-color: #4a2b2b; color: #ffb3b3; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- Auth screen ---------------- */

.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 30px 18px;
  background: radial-gradient(ellipse at 50% -10%, #17222b 0%, var(--bg) 60%);
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card .logo { justify-content: center; font-size: 1.5rem; margin-bottom: 6px; }
.auth-card .logo-stub { width: 44px; height: 28px; }

.spinner {
  width: 26px; height: 26px; margin: 40px auto;
  border: 3px solid var(--line); border-top-color: var(--green);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 44px 18px; color: var(--muted); }

/* ---------------- Small screens ---------------- */

@media (max-width: 720px) {
  .nav-inner { gap: 12px; }
  .nav-links { display: none; }
  .nav-search { margin-left: auto; }
  .nav-search input { width: 140px; }
  .nav-search input:focus { width: 180px; }

  .backdrop { height: 200px; margin-bottom: -90px; }
  .film-head { flex-direction: column; gap: 16px; }
  .film-head .poster { width: 130px; flex: 0 0 auto; }
  .film-head h1 { font-size: 1.5rem; }
  .action-panel { width: 100%; flex: 1 1 auto; }
  .act-main { gap: 9px; }
  .act .entry-actions { margin-left: 0; }

  .hbar-row { grid-template-columns: 110px 1fr 38px; font-size: .8rem; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
}

/* Bottom bar on mobile, since the nav links are hidden up top */
.mobile-bar { display: none; }
@media (max-width: 720px) {
  .mobile-bar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 70;
    background: rgba(11,15,18,.96); border-top: 1px solid var(--line);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  }
  .mobile-bar a {
    flex: 1; text-align: center; font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  }
  .mobile-bar a.on { color: var(--green); }
  body { padding-bottom: 62px; }
}
