/* ─────────────────────────────────────────────
   Moviehat — style.css
   Cinema noir aesthetic: deep blacks, warm gold,
   vintage marquee display type.
───────────────────────────────────────────── */

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --gold:        #c9a84c;
  --gold-dim:    #8a6d28;
  --gold-bright: #d4b060;
  --cream:       #f5f0e8;
  --dark:        #0e0c0a;
  --dark2:       #1a1713;
  --dark3:       #252118;
  --dark4:       #322d22;
  --dark5:       #3e3828;
  --red:         #9b2335;
  --red-hover:   #b52a3e;
  --green:       #3d7a4a;
  --muted:       #8a8070;
  --muted-light: #a09080;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;

  --radius-sm:  4px;
  --radius-md:  6px;
  --radius-lg:  10px;
  --radius-pill: 20px;

  --transition: 0.15s ease;
}

html, body {
  height: 100%;
}

body {
  background: var(--dark);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ── */
#app {
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
  padding: 0;
}

/* ── Screens ── */
.screen {
  display: none;
  padding: 2rem 1.5rem;
  animation: fadeIn 0.2s ease;
}
.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Logo ── */
.logo {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: -1px;
  line-height: 1;
}
.logo span { color: var(--cream); }

.logo-sm {
  font-size: 1.5rem;
  margin-bottom: 1.75rem;
}

/* ── Landing ── */
.landing-hero {
  text-align: center;
  padding: 2.5rem 0 1.5rem;
}

.tagline {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 6px;
}

.landing-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
  margin: 0 auto;
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--dark4);
  margin: 1.5rem 0;
}

/* ── Typography ── */
.section-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  margin-top: 1.25rem;
}
.section-label:first-of-type { margin-top: 0; }

.label-optional {
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: none;
  opacity: 0.7;
}

.omdb-key-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.omdb-key-note a {
  color: var(--gold);
  text-decoration: none;
}
.omdb-key-note a:hover { text-decoration: underline; }

.status-msg {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  min-height: 1.2em;
  margin-top: 8px;
  color: var(--muted);
  transition: color var(--transition);
}
.status-msg.error { color: var(--red); }
.status-msg.ok    { color: var(--green); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  cursor: pointer;
  border: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform 0.08s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-gold {
  background: var(--gold);
  color: var(--dark);
}
.btn-gold:hover:not(:disabled) { background: var(--gold-bright); }

.btn-outline {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--dark5);
}
.btn-outline:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 6px 8px;
}
.btn-ghost:hover { color: var(--red); }

.btn-sm { padding: 8px 14px; font-size: 0.8rem; }
.btn-block { display: flex; width: 100%; margin-top: 1.25rem; }

.back-btn { margin-top: 1.25rem; }

/* ── Inputs ── */
input[type="text"] {
  display: block;
  width: 100%;
  background: var(--dark3);
  border: 1px solid var(--dark4);
  color: var(--cream);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
  margin-bottom: 0;
}
input[type="text"]:focus {
  border-color: var(--gold);
}
input[type="text"]::placeholder { color: var(--muted); }

.input-code {
  text-transform: uppercase;
  letter-spacing: 5px;
  font-family: var(--font-mono);
  font-size: 1.1rem;
}

/* ── Hat Header ── */
.hat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 10px;
}

.hat-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hat-identity {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.hat-name {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--cream);
}

.hat-code-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--dark2);
  border: 1px solid var(--dark4);
  border-radius: var(--radius-sm);
  padding: 6px 10px 6px 14px;
}

.hat-code {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 5px;
}

/* ── Members ("who's around") ── */
.members-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.member-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--dark2);
  border: 1px solid var(--dark4);
  border-radius: var(--radius-pill);
  padding: 5px 12px 5px 9px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--cream);
}

.member-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.member-pill.active .member-dot {
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(61, 122, 74, 0.25);
}

.member-status {
  color: var(--muted);
  font-size: 0.68rem;
}
.member-pill.active .member-status { color: var(--green); }

/* ── Weight note ── */
.weight-note {
  background: var(--dark2);
  border-left: 3px solid var(--gold-dim);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--muted-light);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
.weight-note strong { color: var(--cream); font-weight: 500; }

/* ── Add movie form ── */
.add-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.add-form-row {
  display: flex;
  gap: 8px;
}
.add-form-row input:first-child { flex: 1; }

input[type="text"].input-year { width: 90px; flex-shrink: 0; }

/* ── Search results (OMDb picker dropdown) ── */
.search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}
.search-results.hidden { display: none; }

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--dark2);
  border: 1px solid var(--dark4);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.search-result:hover { border-color: var(--gold-dim); background: var(--dark3); }
.search-result .movie-poster { width: 34px; height: 50px; font-size: 1.1rem; }

.search-result-info { flex: 1; min-width: 0; }

.search-result-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-year {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.search-loading,
.search-empty {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  padding: 8px 2px;
}

/* ── Movies list ── */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}

.view-tabs {
  display: flex;
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--cream); }
.tab-btn.active {
  background: var(--dark3);
  color: var(--gold);
}

.contributors-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.contributor-pill {
  background: var(--dark3);
  border: 1px solid var(--dark4);
  border-radius: var(--radius-pill);
  padding: 4px 14px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--cream);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  user-select: none;
}
.contributor-pill.active {
  background: var(--gold);
  color: var(--dark);
  border-color: var(--gold);
}
.contributor-pill:hover:not(.active) { border-color: var(--gold-dim); }

/* ── Movie card ── */
.movie-card {
  background: var(--dark2);
  border: 1px solid var(--dark4);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
  transition: border-color var(--transition);
  animation: slideIn 0.18s ease;
}
.movie-card:hover { border-color: var(--dark5); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.movie-poster {
  width: 46px;
  height: 68px;
  border-radius: 3px;
  object-fit: cover;
  background: var(--dark3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1.4rem;
}
.movie-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}

.movie-info { flex: 1; min-width: 0; }

.movie-title {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-year {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--muted);
}

.movie-plot {
  font-size: 0.78rem;
  color: var(--muted-light);
  margin-top: 5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.movie-rating {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gold);
  margin-top: 4px;
}

.contributor-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  background: var(--dark3);
  border: 1px solid var(--dark4);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-top: 5px;
}

.watched-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--green);
  margin-top: 5px;
  margin-left: 6px;
}

.delete-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  padding: 2px 4px;
  flex-shrink: 0;
  opacity: 0.45;
  transition: opacity var(--transition), color var(--transition);
  line-height: 1;
  margin-top: 2px;
}
.delete-btn:hover { opacity: 1; color: var(--red); }

/* ── History log ── */
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--dark2);
  border: 1px solid var(--dark4);
  border-radius: var(--radius-md);
  padding: 0.7rem 1rem;
  margin-bottom: 8px;
  animation: slideIn 0.18s ease;
}

.history-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.history-text {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  color: var(--muted-light);
}
.history-text strong { color: var(--cream); font-weight: 500; }

.history-time {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Empty state ── */
.empty-hat {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.empty-hat-icon {
  font-size: 2.8rem;
  margin-bottom: 0.75rem;
  display: block;
}

/* ── Draw Overlay ── */
.draw-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.93);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem;
  z-index: 200;
}
.draw-overlay.hidden { display: none; }

#draw-spinning { text-align: center; }

.spin-text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--gold);
  animation: pulse 0.65s ease-in-out infinite alternate;
}
.spin-sub {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 8px;
}

@keyframes pulse {
  from { opacity: 0.35; }
  to   { opacity: 1; }
}

#draw-result {
  width: 100%;
  max-width: 380px;
  animation: fadeIn 0.3s ease;
}
#draw-result.hidden { display: none; }

.draw-eyebrow {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.winner-card {
  background: var(--dark2);
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
}

.winner-poster {
  width: 100px;
  height: 148px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  margin: 0 auto 1rem;
  display: block;
  background: var(--dark3);
}
.winner-poster.hidden { display: none; }
.winner-meta.hidden,
.winner-plot.hidden { display: none; }

.winner-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
  line-height: 1.2;
}

.winner-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.winner-plot {
  font-size: 0.82rem;
  color: var(--cream);
  line-height: 1.65;
  margin-bottom: 14px;
}

.winner-by {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.winner-by span { color: var(--gold); }

.draw-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--dark2); }
::-webkit-scrollbar-thumb { background: var(--dark5); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ── Responsive ── */
@media (max-width: 400px) {
  .screen { padding: 1.5rem 1.1rem; }
  .logo { font-size: 2.2rem; }
  .hat-header { flex-direction: column; align-items: flex-start; }
}

/* ── Generic utility (kept last so it wins specificity ties) ── */
.hidden { display: none; }
