/* ═══════════════════════════════════════════════════════════
   WATCHLIST — styles.css  (mobile-first)
════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@300;400;500;600;700;900&display=swap');

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

:root {
  --red:        #e50914;
  --red-dim:    rgba(229,9,20,0.15);
  --red-border: rgba(229,9,20,0.35);
  --bg:         #0a0a0a;
  --bg2:        #141414;
  --bg3:        #1e1e1e;
  --border:     rgba(255,255,255,0.09);
  --text:       #e8e8e8;
  --muted:      #888;
  --dim:        #555;
  --gold:       #f5c518;
  --green:      #46d369;
  --yellow:     #f5c518;
  --nav-h:      58px;
  --bottom-h:   62px;
}

html, body {
  background: var(--bg); color: var(--text);
  font-family: 'Inter', sans-serif; min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; }

/* ─── NAVBAR ─────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 200;
  background: linear-gradient(to bottom, rgba(0,0,0,0.97), rgba(10,10,10,0.93));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h); padding: 0 14px;
}
.navbar-inner {
  display: flex; align-items: center;
  justify-content: space-between; height: 100%; gap: 10px;
}
.nav-left  { display: flex; align-items: center; flex: 1; min-width: 0; }
.nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px; letter-spacing: 2px; color: var(--red);
  white-space: nowrap; user-select: none; flex-shrink: 0;
}

/* Desktop tabs — hidden on mobile */
.nav-tabs-row { display: none; }

.nav-tab {
  background: none; border: none; color: var(--muted);
  font-size: 13px; font-weight: 500; padding: 6px 11px;
  border-radius: 6px; position: relative; transition: color 0.15s;
  white-space: nowrap;
}
.nav-tab:hover { color: #ccc; }
.nav-tab.active { color: #fff; font-weight: 700; }
.nav-tab.active::after {
  content: ''; position: absolute;
  bottom: -1px; left: 0; right: 0; height: 2px;
  background: var(--red); border-radius: 2px;
}
.nav-tab .badge {
  margin-left: 4px; font-size: 10px; padding: 1px 5px;
  border-radius: 10px; font-weight: 700;
  background: rgba(255,255,255,0.1); color: var(--muted);
}
.nav-tab.active .badge { background: var(--red); color: #fff; }

.search-wrap { position: relative; }
.search-icon {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%); font-size: 13px;
  pointer-events: none; color: var(--dim);
}
.search-input { padding-left: 32px; width: 150px; height: 36px; font-size: 13px; }
.btn-add { display: flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13px; padding: 7px 12px; }

/* ─── BOTTOM NAV (mobile) ────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: rgba(10,10,10,0.97); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  height: var(--bottom-h); display: flex;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; color: var(--muted);
  font-size: 10px; font-weight: 600; padding: 6px 2px;
  transition: color 0.15s; position: relative; min-width: 0;
}
.tab-icon-wrap { position: relative; display: flex; align-items: center; justify-content: center; }
.bottom-nav-tab .tab-icon { font-size: 19px; line-height: 1; }
.bottom-nav-tab .tab-label { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bottom-nav-tab.active { color: #fff; }
.bottom-nav-tab.active .tab-icon-wrap::before {
  content: ''; position: absolute; top: -6px;
  width: 28px; height: 2px; background: var(--red); border-radius: 2px;
}
.bottom-nav-tab .badge {
  position: absolute; top: -3px; right: -9px;
  background: var(--red); color: #fff;
  font-size: 8px; font-weight: 800; min-width: 15px; height: 15px;
  border-radius: 8px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
}

/* ─── MAIN ───────────────────────────────────────────────── */
.main-content {
  max-width: 1440px; margin: 0 auto;
  padding: 18px 12px;
  padding-bottom: calc(var(--bottom-h) + 16px);
}
.section-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.section-title { font-family: 'Bebas Neue', sans-serif; font-size: 21px; color: #fff; letter-spacing: 1px; }
.section-count { font-size: 12px; color: var(--dim); }

/* ─── CARD GRID ──────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }

.watch-card {
  border-radius: 8px; overflow: hidden; background: var(--bg3);
  cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; position: relative;
}
.watch-card:active { transform: scale(0.96); }
@media (hover: hover) {
  .watch-card:hover { transform: scale(1.04); box-shadow: 0 12px 36px rgba(0,0,0,0.7); z-index: 2; }
  .watch-card:hover .card-overlay { opacity: 1; }
}

.card-poster {
  position: relative; padding-bottom: 148%;
  background: linear-gradient(135deg, #1a1a2e, #16213e); overflow: hidden;
}
.card-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-poster-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px; font-size: 28px; color: var(--dim);
}
.card-poster-placeholder span { font-size: 9px; text-align: center; padding: 0 6px; color: #444; }
.card-overlay {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.2s;
  background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, transparent 60%);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 8px;
}
.card-overlay-title { font-size: 11px; font-weight: 700; color: #fff; line-height: 1.3; margin-bottom: 3px; }
.card-overlay-desc {
  font-size: 9px; color: #bbb; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-type-badge {
  position: absolute; top: 5px; left: 5px;
  background: rgba(229,9,20,0.85); color: #fff;
  font-size: 8px; font-weight: 800; padding: 2px 5px; border-radius: 3px;
  letter-spacing: 0.06em; backdrop-filter: blur(4px);
}
.card-watching-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--yellow); box-shadow: 0 0 5px var(--yellow);
}
.card-rewatch {
  position: absolute; bottom: 44px; right: 5px;
  background: rgba(0,0,0,0.75); color: var(--gold);
  font-size: 9px; font-weight: 700; padding: 2px 5px; border-radius: 3px;
}
.card-info { padding: 7px 8px 9px; }
.card-info-title {
  font-size: 11px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px;
}
.card-info-row { display: flex; align-items: center; justify-content: space-between; }
.card-stars { display: flex; gap: 1px; }
.card-stars span { font-size: 9px; color: #333; }
.card-stars span.lit { color: var(--gold); }
.card-stars span.special { color: #ff6b6b; }
.card-date { font-size: 9px; color: var(--dim); }

/* ─── EMPTY STATE ────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; text-align: center;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-msg { font-size: 16px; color: var(--dim); font-weight: 600; margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: #444; }

/* ─── DARK INPUTS ────────────────────────────────────────── */
.dark-input {
  background: rgba(255,255,255,0.07) !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  border-radius: 8px !important; color: var(--text) !important;
  font-size: 14px !important; min-height: 44px;
}
.dark-input:focus {
  background: rgba(255,255,255,0.1) !important;
  border-color: rgba(229,9,20,0.5) !important;
  box-shadow: 0 0 0 3px rgba(229,9,20,0.12) !important;
  color: #fff !important; outline: none !important;
}
.dark-input option { background: #1e1e1e; color: var(--text); }
textarea.dark-input { min-height: auto; resize: vertical; }

/* ─── MODALS ─────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 500;
  display: none; align-items: flex-end; justify-content: center; padding: 0;
}
.modal-backdrop.visible { display: flex; }

.modal-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 18px 18px 0 0; width: 100%; max-height: 92vh;
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.8);
  animation: slideUp 0.28s cubic-bezier(0.32,0.72,0,1);
}
@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0.5; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-drag-handle {
  width: 36px; height: 4px; background: rgba(255,255,255,0.18);
  border-radius: 2px; margin: 10px auto 0; flex-shrink: 0;
}
.modal-header-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-header-row h3 { font-family: 'Bebas Neue', sans-serif; font-size: 20px; color: #fff; letter-spacing: 1px; }
.modal-close {
  background: rgba(255,255,255,0.08); border: none; color: var(--muted);
  font-size: 17px; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; transition: background 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.16); color: #fff; }

.modal-body-scroll {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 16px 24px; flex: 1;
  display: flex; flex-direction: column; gap: 18px;
}
.modal-footer-row {
  display: flex; gap: 10px;
  padding-top: 14px; border-top: 1px solid var(--border); margin-top: 2px;
}
.modal-footer-row .btn { flex: 1; padding: 13px; font-size: 15px; border-radius: 10px; }
.modal-footer-row .btn-sm { flex: 0; padding: 10px 14px; font-size: 13px; }

.btn-secondary-dark {
  background: rgba(255,255,255,0.08); color: var(--text);
  border: 1px solid rgba(255,255,255,0.14); border-radius: 10px;
  padding: 13px 20px; font-size: 15px; font-weight: 600; transition: background 0.15s;
}
.btn-secondary-dark:hover { background: rgba(255,255,255,0.14); }

/* ─── FIELD LABEL ────────────────────────────────────────── */
.field-label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}

/* ─── SEARCH SPINNER & DROPDOWN ──────────────────────────── */
.search-spinner {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--red); font-size: 16px; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }

.suggestion-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #1e1e1e; border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 10px 36px rgba(0,0,0,0.7); z-index: 600;
  max-height: 300px; overflow-y: auto;
}
.suggestion-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer; min-height: 52px;
  border-bottom: 1px solid rgba(255,255,255,0.05); transition: background 0.12s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover, .suggestion-item:active { background: var(--red-dim); }
.suggestion-thumb {
  width: 32px; height: 46px; border-radius: 4px; flex-shrink: 0;
  background: rgba(255,255,255,0.06); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.suggestion-thumb img { width: 100%; height: 100%; object-fit: cover; }
.suggestion-thumb .thumb-icon { font-size: 16px; }
.suggestion-text-title { font-size: 13px; font-weight: 600; color: var(--text); }
.suggestion-text-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ─── MODAL TABS ─────────────────────────────────────────── */
.modal-tabs {
  display: flex; gap: 3px; background: rgba(255,255,255,0.05);
  border-radius: 10px; padding: 4px; flex-shrink: 0;
}
.modal-tab {
  flex: 1; padding: 9px 4px; border: none; border-radius: 7px;
  background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 500; transition: all 0.18s; white-space: nowrap;
}
.modal-tab.active { background: rgba(229,9,20,0.8); color: #fff; font-weight: 700; }
.modal-tab:hover:not(.active) { background: rgba(255,255,255,0.07); color: #ccc; }
.tab-pane { display: flex; flex-direction: column; gap: 16px; }

/* ─── INFO TAB ───────────────────────────────────────────── */
.info-layout-top { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.poster-col { flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; }
.poster-preview {
  width: 80px; height: 118px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.poster-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster-placeholder { font-size: 28px; }
.poster-url-wrap { flex: 1; }
.poster-url-label { font-size: 10px; color: var(--muted); font-weight: 600; margin-bottom: 4px; letter-spacing: 0.06em; text-transform: uppercase; }
.info-fields { display: flex; flex-direction: column; gap: 12px; }
.info-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ─── STATUS ─────────────────────────────────────────────── */
.status-movie-note {
  background: rgba(229,9,20,0.12); border: 1px solid var(--red-border);
  border-radius: 8px; padding: 10px 14px; color: var(--red); font-size: 13px; font-weight: 600;
}
.status-btns { display: flex; gap: 8px; }
.status-btn {
  flex: 1; padding: 10px 4px; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 500; transition: all 0.15s; min-height: 44px;
}
.status-btn:active { background: rgba(255,255,255,0.06); }
.status-btn.active { background: var(--red-dim); border-color: var(--red-border); color: var(--red); font-weight: 700; }

/* ─── STARS ──────────────────────────────────────────────── */
.star-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.star { font-size: 28px; cursor: pointer; transition: transform 0.12s; user-select: none; line-height: 1; }
.star:active { transform: scale(1.3); }
@media (hover: hover) { .star:hover { transform: scale(1.28); } }
.star.sixth { font-size: 30px; }
.star.lit-normal { filter: drop-shadow(0 0 4px var(--gold)); }
.star.lit-sixth  { filter: drop-shadow(0 0 6px #ff6b6b); }
.star-label { font-size: 13px; margin-left: 4px; font-weight: 700; font-family: monospace; }
.star-label.normal { color: var(--gold); }
.star-label.sixth  { color: #ff6b6b; }

/* ─── COUNTER ────────────────────────────────────────────── */
.counter-row { display: flex; align-items: center; gap: 16px; }
.counter-btn {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px; color: var(--text); width: 44px; height: 44px;
  font-size: 22px; display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.counter-btn:active { background: rgba(255,255,255,0.18); }
.counter-val { font-size: 24px; font-weight: 800; color: #fff; min-width: 32px; text-align: center; }

/* ─── SEASON ROWS ────────────────────────────────────────── */
.season-row { display: grid; grid-template-columns: 36px 1fr 16px 1fr; align-items: center; gap: 6px; }
.season-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.season-arrow { color: var(--dim); font-size: 13px; text-align: center; }
.season-row .dark-input { min-height: 38px !important; font-size: 12px !important; padding: 6px 8px !important; }

/* ─── DETAIL MODAL ───────────────────────────────────────── */
.detail-hero {
  position: relative; min-height: 170px;
  border-radius: 18px 18px 0 0; overflow: hidden; flex-shrink: 0;
}
.detail-hero-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  filter: blur(20px) brightness(0.25); transform: scale(1.1);
}
.detail-hero-content {
  position: relative; display: flex; gap: 14px;
  align-items: flex-end; padding: 18px 16px;
}
.detail-hero-poster {
  width: 88px; height: 130px; border-radius: 8px;
  object-fit: cover; flex-shrink: 0; box-shadow: 0 6px 20px rgba(0,0,0,0.6);
}
.detail-hero-poster-placeholder {
  width: 88px; height: 130px; border-radius: 8px;
  background: rgba(255,255,255,0.07); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.detail-info { flex: 1; min-width: 0; }
.detail-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 6px; }
.badge-type { background: rgba(229,9,20,0.85); color: #fff; font-size: 9px; font-weight: 800; padding: 3px 7px; border-radius: 4px; letter-spacing: 0.07em; }
.badge-status-watching { background: rgba(245,197,24,0.2);   border: 1px solid rgba(245,197,24,0.4);  color: var(--yellow); font-size: 9px; font-weight: 700; padding: 3px 7px; border-radius: 4px; }
.badge-status-watched  { background: rgba(70,211,105,0.15);  border: 1px solid rgba(70,211,105,0.35); color: var(--green);  font-size: 9px; font-weight: 700; padding: 3px 7px; border-radius: 4px; }
.badge-status-abandoned{ background: rgba(136,136,136,0.15); border: 1px solid rgba(136,136,136,0.3); color: var(--muted);  font-size: 9px; font-weight: 700; padding: 3px 7px; border-radius: 4px; }
.detail-title { font-family: 'Bebas Neue', sans-serif; font-size: 22px; color: #fff; letter-spacing: 1px; line-height: 1.1; margin-bottom: 3px; word-break: break-word; }
.detail-subtitle { font-size: 11px; color: var(--muted); margin-bottom: 7px; }
.detail-body { padding: 14px 16px 18px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.detail-plot { font-size: 13px; color: #ccc; line-height: 1.7; margin-bottom: 14px; }
.detail-meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin-bottom: 14px; }
.detail-meta-item { background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.detail-meta-label { font-size: 9px; color: #555; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 2px; }
.detail-meta-value { font-size: 13px; color: var(--text); font-weight: 600; word-break: break-word; }
.detail-seasons { margin-bottom: 12px; }
.detail-seasons-title { font-size: 10px; color: #555; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 7px; }
.season-timeline-item { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,0.04); border-radius: 6px; padding: 7px 10px; margin-bottom: 5px; }
.season-num { font-size: 11px; color: var(--red); font-weight: 700; min-width: 24px; }
.season-range { font-size: 12px; color: #ccc; }

/* ═══════════════════════════════════════════════════════════
   TABLET  ≥ 520px
════════════════════════════════════════════════════════════ */
@media (min-width: 520px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); gap: 11px; }
  .main-content { padding: 22px 18px; padding-bottom: calc(var(--bottom-h) + 20px); }
  .search-input { width: 180px; }
}

/* ═══════════════════════════════════════════════════════════
   DESKTOP  ≥ 768px
════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  :root { --nav-h: 62px; }

  .navbar { padding: 0 28px; }
  .nav-tabs-row { display: flex; gap: 2px; margin-left: 28px; }
  .bottom-nav   { display: none; }
  .search-input { width: 220px; height: 38px; }
  .btn-add { font-size: 14px; padding: 8px 16px; }

  .main-content { padding: 32px 28px; }

  .card-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 14px; }
  .card-info-title { font-size: 12px; }
  .card-type-badge { font-size: 9px; }

  /* Modal: centered */
  .modal-backdrop { align-items: center; padding: 16px; }
  .modal-box { border-radius: 14px; max-width: 690px; max-height: 88vh; animation: modalIn 0.22s ease; }
  .modal-drag-handle { display: none; }
  @keyframes modalIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }
  .modal-body-scroll { padding: 22px 24px 28px; }
  .modal-header-row  { padding: 18px 24px; }
  .modal-header-row h3 { font-size: 22px; }
  .modal-footer-row { justify-content: flex-end; }
  .modal-footer-row .btn { flex: 0; padding: 10px 22px; font-size: 14px; }

  /* Info tab: side-by-side */
  .info-layout-top { gap: 18px; margin-bottom: 0; flex-direction: row; }
  .poster-col { width: 110px; }
  .poster-preview { width: 110px; height: 163px; }
  .poster-placeholder { font-size: 34px; }

  /* Detail modal */
  #detailModalBackdrop .modal-box { max-width: 700px; }
  .detail-hero-content { padding: 26px 26px; gap: 20px; }
  .detail-hero-poster { width: 115px; height: 170px; }
  .detail-hero-poster-placeholder { width: 115px; height: 170px; }
  .detail-title { font-size: 26px; }
  .detail-body { padding: 20px 26px 26px; }
  .detail-meta-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

@media (min-width: 1024px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
}
