/* =============================================================================
   TIREXO HD — Design System
   Dark-mode media platform CSS
   ============================================================================= */

/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── CSS Custom Properties ───────────────────────────────────────────────── */
:root {
  /* Colors */
  --bg-primary:      #0a0a0f;
  --bg-secondary:    #111118;
  --bg-card:         #16161f;
  --bg-card-hover:   #1e1e2a;
  --bg-overlay:      rgba(10, 10, 15, 0.85);
  --surface:         #1c1c26;
  --surface-2:       #22222e;
  --border:          rgba(255,255,255,0.07);
  --border-focus:    rgba(230, 57, 70, 0.5);

  /* Brand */
  --red:             #e63946;
  --red-dark:        #c62836;
  --red-glow:        rgba(230, 57, 70, 0.3);
  --red-subtle:      rgba(230, 57, 70, 0.12);

  /* Text */
  --text-primary:    #f0f0f5;
  --text-secondary:  #9898a8;
  --text-muted:      #5a5a6a;
  --text-inverse:    #0a0a0f;

  /* Quality badge colors */
  --badge-hd:        #2563eb;
  --badge-4k:        #7c3aed;
  --badge-cam:       #d97706;
  --badge-web:       #059669;

  /* Spacing */
  --gap-xs: 0.25rem;
  --gap-sm: 0.5rem;
  --gap:    1rem;
  --gap-md: 1.5rem;
  --gap-lg: 2rem;
  --gap-xl: 3rem;
  --gap-2xl:4rem;

  /* Sizing */
  --navbar-h:     64px;
  --card-radius:  10px;
  --radius-sm:    6px;
  --radius:       8px;
  --radius-lg:    14px;
  --radius-pill:  999px;

  /* Transitions */
  --transition:      all 0.2s ease;
  --transition-slow: all 0.4s ease;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px var(--red-glow);
  --shadow-nav:  0 2px 20px rgba(0,0,0,0.6);
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select, textarea { font-family: inherit; }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(239, 51, 68, 0.72) var(--bg-primary);
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
  background: rgba(239, 51, 68, 0.72);
  border: 2px solid var(--bg-primary);
  border-radius: var(--radius-pill);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--red); }
::-webkit-scrollbar-corner { background: var(--bg-primary); }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--gap-md);
}

.page-content {
  padding-top: calc(var(--navbar-h) + var(--gap-lg));
  padding-bottom: var(--gap-2xl);
  min-height: 100vh;
}

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-h);
  z-index: 1000;
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-nav);
  transition: var(--transition);
}

.navbar__inner {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  height: 100%;
  padding: 0 var(--gap-md);
  max-width: 1440px;
  margin: 0 auto;
}

.navbar__logo {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: -0.03em;
  flex-shrink: 0;
  color: var(--text-primary);
}

.navbar__logo .logo-tx  { color: var(--red); }
.navbar__logo .logo-hd  { 
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--red);
  color: white;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  align-self: flex-start;
  margin-top: 4px;
}

.navbar__nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.navbar__nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
}

.navbar__nav a:hover,
.navbar__nav a.active {
  color: var(--text-primary);
  background: var(--surface);
}

.navbar__nav a.active {
  color: var(--red);
}

/* Search bar */
.navbar__search {
  position: relative;
  flex: 0 1 320px;
}

.navbar__search input {
  width: 100%;
  height: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0 40px 0 16px;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: var(--transition);
  outline: none;
}

.navbar__search input::placeholder { color: var(--text-muted); }
.navbar__search input:focus {
  border-color: var(--border-focus);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--red-subtle);
}

.navbar__search__icon {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  z-index: 200;
  display: none;
}

.search-dropdown.open { display: block; }

.search-dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: var(--gap-sm) var(--gap);
  transition: var(--transition);
  cursor: pointer;
}

.search-dropdown__item:hover { background: var(--bg-card-hover); }

.search-dropdown__item img {
  width: 36px; height: 54px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.search-dropdown__info { overflow: hidden; }
.search-dropdown__title { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-dropdown__meta  { font-size: 0.75rem; color: var(--text-muted); }

/* Navbar right (auth) */
.navbar__auth {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  flex-shrink: 0;
}

.navbar__mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.btn-primary:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  border-color: transparent;
  backdrop-filter: blur(8px);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.18);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-outline:hover {
  border-color: var(--red);
  color: var(--red);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--surface); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-icon { padding: 9px; width: 38px; height: 38px; }
.btn-icon.btn-sm { padding: 6px; width: 30px; height: 30px; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.5;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.badge-quality {
  background: var(--badge-hd);
  color: white;
}
.badge-quality[data-q="4K"]     { background: var(--badge-4k); }
.badge-quality[data-q="CAM"]    { background: var(--badge-cam); }
.badge-quality[data-q="WEB-DL"],
.badge-quality[data-q="WEBRip"] { background: var(--badge-web); }

.badge-vf     { background: #b45309; color: white; }
.badge-vostfr { background: #1d4ed8; color: white; }
.badge-multi  { background: #047857; color: white; }

.badge-type {
  background: var(--surface-2);
  color: var(--text-secondary);
}

.badge-pending   { background: rgba(251,191,36,0.15); color: #fbbf24; }
.badge-fulfilled { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-rejected  { background: rgba(239,68,68,0.15);  color: #ef4444; }

/* ── Media Card ───────────────────────────────────────────────────────────── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: var(--gap);
}

.media-card {
  position: relative;
  border-radius: var(--card-radius);
  overflow: hidden;
  background: var(--bg-card);
  transition: var(--transition-slow);
  cursor: pointer;
  display: block;
}

.media-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), var(--shadow-glow);
  z-index: 5;
}

.media-card__poster {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--surface);
}

.media-card__poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: var(--transition-slow);
}

.media-card:hover .media-card__poster img {
  transform: scale(1.06);
}

.media-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3) 40%, transparent 70%);
  opacity: 0;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-card:hover .media-card__overlay { opacity: 1; }

.media-card__play {
  width: 52px; height: 52px;
  background: var(--red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: 0 0 24px var(--red-glow);
  transform: scale(0.7);
  transition: var(--transition);
}

.media-card:hover .media-card__play { transform: scale(1); }

.media-card__badges {
  position: absolute;
  top: 10px; left: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: max-content;
  max-width: calc(100% - 20px);
  gap: 6px;
}

.media-card__rating {
  position: absolute;
  top: 8px; right: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  color: #fbbf24;
}

.media-card__info {
  padding: var(--gap-sm) var(--gap-sm) var(--gap);
}

.media-card__title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.media-card__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Hero Section ─────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  height: 85vh;
  min-height: 540px;
  max-height: 900px;
  overflow: hidden;
  margin-top: calc(-1 * var(--navbar-h));
}

.hero__backdrop {
  position: absolute;
  inset: 0;
}

.hero__backdrop img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

.hero__backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(10,10,15,0.95) 0%,
    rgba(10,10,15,0.6)  50%,
    rgba(10,10,15,0.2)  100%
  ),
  linear-gradient(
    to top,
    rgba(10,10,15,1)    0%,
    rgba(10,10,15,0)    40%
  );
}

.hero__content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  padding-bottom: var(--gap-2xl);
  max-width: 600px;
  margin-left: calc((100vw - 1440px) / 2 + var(--gap-md));
}

@media (max-width: 1440px) { .hero__content { margin-left: var(--gap-md); } }

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-sm);
  margin-bottom: var(--gap);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: var(--gap);
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.hero__meta {
  display: flex;
  align-items: center;
  gap: var(--gap);
  margin-bottom: var(--gap);
  flex-wrap: wrap;
}

.hero__meta span { font-size: 0.875rem; color: var(--text-secondary); }
.hero__meta .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--text-muted); }

.hero__genres {
  display: flex;
  gap: var(--gap-sm);
  flex-wrap: wrap;
  margin-bottom: var(--gap-md);
}

.hero__synopsis {
  font-size: 0.925rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--gap-md);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero__actions {
  display: flex;
  gap: var(--gap);
  flex-wrap: wrap;
}

/* ── Content Rows ─────────────────────────────────────────────────────────── */
.section {
  margin-bottom: var(--gap-2xl);
}

.section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
}

.section__title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.section__title::before {
  content: '';
  display: block;
  width: 4px;
  height: 20px;
  background: var(--red);
  border-radius: 2px;
}

.section__link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}
.section__link:hover { gap: 8px; }

/* Horizontal scroll row */
.media-row {
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  padding-bottom: var(--gap-sm);
  scrollbar-width: thin;
  scrollbar-color: rgba(239, 51, 68, 0.72) rgba(255, 255, 255, 0.06);
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.media-row::-webkit-scrollbar { height: 8px; }
.media-row::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-pill);
}
.media-row::-webkit-scrollbar-thumb {
  background: rgba(239, 51, 68, 0.72);
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  background-clip: padding-box;
}
.media-row::-webkit-scrollbar-thumb:hover { background: var(--red); }

.media-row .media-card {
  flex: 0 0 165px;
}

/* ── Filters Sidebar ──────────────────────────────────────────────────────── */
.listing-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--gap-lg);
  align-items: start;
}

.filters {
  position: sticky;
  top: calc(var(--navbar-h) + var(--gap));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--gap-md);
}

.filters__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--gap-md);
}

.filter-group { margin-bottom: var(--gap-md); }

.filter-group__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--gap-sm);
}

.filter-group select,
.filter-group input[type="text"] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 10px;
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.filter-group select:focus,
.filter-group input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--red-subtle);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.filter-chip:hover, .filter-chip.active {
  background: var(--red-subtle);
  border-color: var(--red);
  color: var(--red);
}

/* Sort bar */
.sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
  flex-wrap: wrap;
  gap: var(--gap-sm);
}

.sort-bar__count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sort-options {
  display: flex;
  gap: 4px;
}

.sort-option {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
}

.sort-option:hover { border-color: var(--red); color: var(--red); }
.sort-option.active { background: var(--red); border-color: var(--red); color: white; }

/* ── Media Detail Page ────────────────────────────────────────────────────── */
.detail-backdrop {
  position: relative;
  height: 50vh;
  min-height: 320px;
  overflow: hidden;
  margin-top: calc(-1 * var(--navbar-h));
}

.detail-backdrop img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 25%;
}

.detail-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(10,10,15,0.3) 0%, rgba(10,10,15,1) 100%);
}

.detail-main {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--gap-xl);
  margin-top: -120px;
  position: relative;
  z-index: 2;
  align-items: flex-start;
}

.detail-poster {
  flex-shrink: 0;
}

.detail-poster img {
  width: 100%;
  border-radius: var(--card-radius);
  box-shadow: 0 24px 60px rgba(0,0,0,0.8);
}

.detail-info { padding-top: var(--gap-md); }

.detail-title {
  font-size: clamp(1.5rem, 4vw, 2.8rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: var(--gap-sm);
}

.detail-original-title {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: var(--gap);
  font-style: italic;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: var(--gap);
  flex-wrap: wrap;
  margin-bottom: var(--gap-md);
}

.detail-meta__item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.detail-meta__item svg { color: var(--text-muted); }

.detail-rating {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 1rem;
  font-weight: 700;
  color: #fbbf24;
}

.detail-genres {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-sm);
  margin-bottom: var(--gap-md);
}

.detail-synopsis {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: var(--gap-md);
  max-width: 680px;
}

.detail-credits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  margin-bottom: var(--gap-md);
}

.detail-credit__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.detail-credit__value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.detail-actions {
  display: flex;
  gap: var(--gap);
  flex-wrap: wrap;
  margin-bottom: var(--gap-xl);
}

/* Link tabs */
.tabs {
  margin-bottom: var(--gap-xl);
}

.tabs__nav {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--gap-md);
}

.tabs__nav-item {
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tabs__nav-item:hover { color: var(--text-primary); }
.tabs__nav-item.active { color: var(--red); border-bottom-color: var(--red); }

.tabs__panel { display: none; }
.tabs__panel.active { display: block; }

.links-table { width: 100%; border-collapse: collapse; }
.links-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.links-table td {
  padding: 12px 14px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.links-table tr:hover td { background: var(--bg-card-hover); }

/* ── Top 100 ──────────────────────────────────────────────────────────────── */
.top-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: var(--gap);
}

.top-card { position: relative; }

.top-rank {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 3;
  font-size: 1.6rem;
  font-weight: 900;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  line-height: 1;
}

.top-rank.rank-1 { color: #fbbf24; }
.top-rank.rank-2 { color: #d1d5db; }
.top-rank.rank-3 { color: #cd7c2e; }

/* ── Zone de Requêtes ─────────────────────────────────────────────────────── */
.request-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--gap-xl);
  margin-bottom: var(--gap-xl);
}

.request-form__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: var(--gap-md);
}

.form-group { margin-bottom: var(--gap-md); }

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--red-subtle);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.request-list { display: flex; flex-direction: column; gap: var(--gap); }

.request-item {
  display: flex;
  align-items: center;
  gap: var(--gap);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--gap-md);
  transition: var(--transition);
}

.request-item:hover { border-color: rgba(255,255,255,0.12); }

.request-item__info { flex: 1; min-width: 0; }
.request-item__title { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.request-item__meta  { font-size: 0.8rem; color: var(--text-muted); }

.request-item__vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.vote-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}
.vote-btn:hover { background: var(--red-subtle); border-color: var(--red); color: var(--red); }
.vote-count { font-size: 0.85rem; font-weight: 700; color: var(--text-secondary); }

/* ── Auth Pages ───────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center top, rgba(230,57,70,0.08) 0%, transparent 60%), var(--bg-primary);
  padding: var(--gap-xl) var(--gap-md);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--gap-xl);
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}

.auth-logo {
  text-align: center;
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: var(--gap-xl);
  color: var(--text-primary);
}
.auth-logo .logo-tx { color: var(--red); }

.auth-title {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: var(--gap-xl);
}

.auth-divider {
  text-align: center;
  margin: var(--gap-md) 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  position: relative;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%; width: calc(50% - 28px);
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

/* ── Admin Panel ──────────────────────────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  min-height: 100vh;
}

.admin-sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: var(--gap-md);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-sidebar__logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--red);
  margin-bottom: var(--gap-xl);
  padding: var(--gap-sm);
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  margin-bottom: 2px;
}

.admin-nav a:hover, .admin-nav a.active {
  background: var(--surface);
  color: var(--text-primary);
}

.admin-nav a.active { color: var(--red); }

.admin-content {
  padding: var(--gap-xl);
  overflow-x: auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-xl);
}

.admin-title { font-size: 1.5rem; font-weight: 800; }

/* Stats cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap-xl);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--gap-md);
  text-align: center;
}

.stat-card__number {
  font-size: 2rem;
  font-weight: 900;
  color: var(--red);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card__label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 12px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:hover td { background: var(--bg-card-hover); }

.admin-table__poster {
  width: 36px; height: 52px;
  object-fit: cover;
  border-radius: 4px;
}

/* ── Alert / Toast ────────────────────────────────────────────────────────── */
.alert {
  padding: var(--gap) var(--gap-md);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: var(--gap);
  border: 1px solid transparent;
}
.alert-success { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }
.alert-error   { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-warning { background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.3); color: #fde68a; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: var(--gap-xl);
  flex-wrap: wrap;
}

.pagination a, .pagination span {
  display: flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px;
  padding: 0 var(--gap-sm);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: var(--transition);
}

.pagination a:hover { border-color: var(--red); color: var(--red); }
.pagination .active, .pagination [aria-current="page"] > span {
  background: var(--red); border-color: var(--red); color: white;
}
.pagination .disabled span { opacity: 0.4; cursor: not-allowed; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: var(--gap-xl) 0 var(--gap-lg);
  margin-top: var(--gap-2xl);
}

.footer__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--gap-md);
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--gap-xl);
  margin-bottom: var(--gap-xl);
}

.footer__brand__logo {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: var(--gap);
  color: var(--text-primary);
}
.footer__brand__logo .logo-tx { color: var(--red); }

.footer__brand__desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.footer__nav-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--gap);
}

.footer__nav a {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--gap-sm);
  transition: var(--transition);
}
.footer__nav a:hover { color: var(--red); }

.footer__bottom {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--gap) var(--gap-md) 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--gap);
}

.footer__copyright { font-size: 0.8rem; color: var(--text-muted); }

/* ── Skeleton Loader ──────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--surface) 50%, var(--bg-card) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .listing-layout { grid-template-columns: 200px 1fr; }
  .footer__inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .detail-main { grid-template-columns: 160px 1fr; gap: var(--gap-md); margin-top: -80px; }
  .listing-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { 
    height: auto; 
    position: static; 
    border-right: none; 
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--gap-sm);
  }
  .admin-sidebar__logo { margin-bottom: var(--gap-sm); }
  .admin-nav { display: flex; overflow-x: auto; gap: var(--gap-sm); padding-bottom: 4px; }
  .admin-nav a { margin-bottom: 0; white-space: nowrap; }
}

@media (max-width: 768px) {
  :root { --navbar-h: 56px; }

  .navbar__nav { display: none; }
  .navbar__nav.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--navbar-h); left: 0; right: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    padding: var(--gap) var(--gap-md);
    z-index: 999;
    gap: var(--gap-sm);
    max-height: calc(100vh - var(--navbar-h));
    overflow-y: auto;
  }
  .navbar__nav.open a { padding: 12px; }

  .navbar__mobile-toggle { display: flex; }

  .navbar__search { max-width: 200px; }

  .hero { height: 70vh; min-height: 420px; }
  .hero__content { max-width: 100%; }
  .hero__title { font-size: 1.8rem; }

  .detail-main { grid-template-columns: 1fr; }
  .detail-poster { max-width: 180px; margin: 0 auto; }

  .footer__inner { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  .media-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .top-grid   { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 480px) {
  .navbar__search { display: none; }
  .media-grid { grid-template-columns: repeat(2, 1fr); }
  .hero__actions .btn { flex: 1; }
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.text-red     { color: var(--red); }
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.75rem; }
.fw-bold      { font-weight: 700; }
.fw-black     { font-weight: 900; }
.mt-0 { margin-top: 0; }
.mb-sm  { margin-bottom: var(--gap-sm); }
.mb-md  { margin-bottom: var(--gap-md); }
.mb-lg  { margin-bottom: var(--gap-lg); }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-sm { gap: var(--gap-sm); }
.gap    { gap: var(--gap); }
.flex-1 { flex: 1; }
.overflow-hidden { overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
