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

:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface2: #1c1c26;
  --border: #2a2a3a;
  --accent: #e8b84b;
  --accent2: #e85b4b;
  --text: #e8e8f0;
  --muted: #888;
  --radius: 10px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
}

/* HEADER */
header {
  background: linear-gradient(180deg, #0d0d14 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
}
.header-inner {
  max-width: 1600px; margin: 0 auto;
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  letter-spacing: 2px;
  color: var(--accent);
}
.logo span { color: var(--text); }
.header-stats { font-size: 0.78rem; color: var(--muted); }

/* FILTERS */
.filters-bar {
  max-width: 1600px; margin: 16px auto 0;
  padding: 0 20px;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.filters-bar input,
.filters-bar select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s;
}
.filters-bar input { flex: 1; min-width: 200px; }
.filters-bar input:focus,
.filters-bar select:focus { border-color: var(--accent); }
.filters-bar select option { background: var(--surface2); }
#clearBtn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}
#clearBtn:hover { border-color: var(--accent2); color: var(--accent2); }

/* RESULTS BAR */
.results-bar {
  max-width: 1600px; margin: 12px auto 0;
  padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
}
#resultCount { font-size: 0.8rem; color: var(--muted); }
.view-toggle { display: flex; gap: 4px; }
.view-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}
.view-btn.active, .view-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface2);
}

/* GALLERY GRID */
#gallery {
  max-width: 1600px; margin: 16px auto 40px;
  padding: 0 20px;
}
#gallery.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
#gallery.list-view {
  display: flex; flex-direction: column; gap: 8px;
}

/* CARD - GRID */
.card {
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 30px rgba(232,184,75,0.15);
}
.card-poster {
  width: 100%; aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  background: var(--surface2);
}
.card-poster-placeholder {
  width: 100%; aspect-ratio: 2/3;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: var(--border);
}
.card-info {
  padding: 8px;
}
.card-title {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 3px;
  display: flex; justify-content: space-between;
}
.card-vr {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
}
.card-type-badge {
  position: absolute; top: 6px; left: 6px;
  background: rgba(0,0,0,0.75);
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* CARD - LIST */
.list-view .card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px;
  border-radius: 8px;
}
.list-view .card-poster {
  width: 44px; height: 64px;
  aspect-ratio: unset;
  border-radius: 6px;
  flex-shrink: 0;
}
.list-view .card-poster-placeholder {
  width: 44px; height: 64px;
  aspect-ratio: unset;
  border-radius: 6px;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.list-view .card-info {
  flex: 1; padding: 0; min-width: 0;
}
.list-view .card-title {
  font-size: 0.9rem;
}
.list-view .card-meta {
  font-size: 0.75rem;
}
.list-view .card-type-badge {
  position: static;
  display: inline-block;
  margin-bottom: 3px;
}

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 780px; width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: sticky; top: 12px; float: right; margin: 12px 12px 0 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  z-index: 10;
  transition: all 0.2s;
}
.modal-close:hover { border-color: var(--accent2); color: var(--accent2); }
.modal-content { padding: 24px; }

.modal-top { display: flex; gap: 20px; }
.modal-poster {
  width: 140px; min-width: 140px; height: 210px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface2);
}
.modal-poster-placeholder {
  width: 140px; min-width: 140px; height: 210px;
  background: var(--surface2);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
}
.modal-header { flex: 1; }
.modal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  letter-spacing: 1px;
  line-height: 1.1;
  color: var(--text);
}
.modal-subtitle { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.modal-ratings {
  display: flex; gap: 16px; margin: 14px 0 10px;
}
.rating-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  text-align: center;
}
.rating-pill .val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  color: var(--accent);
  display: block;
}
.rating-pill .lbl { font-size: 0.65rem; color: var(--muted); display: block; }
.modal-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 20px;
}
.badge.lang { border-color: #3a5a7a; color: #7ab8e8; }
.badge.genre { border-color: #3a5a3a; color: #7ae87a; }
.badge.stream { border-color: #5a3a5a; color: #e87ae8; }
.modal-plot {
  margin-top: 18px;
  font-size: 0.85rem;
  line-height: 1.65;
  color: #b0b0c0;
}
.modal-details { margin-top: 18px; }
.detail-row {
  display: flex; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--muted); min-width: 110px; flex-shrink: 0; }
.detail-value { color: var(--text); }
.imdb-link {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 16px;
  background: #e8b800;
  color: #000;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 7px 14px;
  border-radius: 8px;
  text-decoration: none;
  transition: opacity 0.2s;
}
.imdb-link:hover { opacity: 0.85; }

/* LOADING */
.loading {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
  font-size: 1.2rem;
}
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 12px; }

/* RESPONSIVE */
@media (max-width: 600px) {
  #gallery.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }
  .filters-bar input { min-width: 100%; }
  .modal-top { flex-direction: column; }
  .modal-poster, .modal-poster-placeholder { width: 100%; min-width: unset; height: 220px; }
}
