@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,400&display=swap');

:root {
  --bg-base: #0e1013;
  --bg-header: #13161a;
  --bg-card: #121519;
  --bg-card-alt: #14171b;
  --bg-surface: #171b20;
  --bg-input: #1b1f24;
  --border-subtle: #22262c;
  --border-default: #262b31;
  --border-medium: #303740;
  --border-strong: #3a424a;
  --text-primary: #e6e8eb;
  --text-secondary: #98a0a8;
  --text-muted: #6a737c;
  --text-dim: #434b54;
  
  --color-sex: #e05a5a;
  --color-sex-bg: #231a1b;
  --color-sex-border: #4a3033;
  --color-sex-fg: #e8938e;

  --color-nudity: #d98a4a;
  --color-nudity-bg: #221c18;
  --color-nudity-border: #4a3a2c;
  --color-nudity-fg: #e0a878;

  --color-suggestive: #d9a441;
  --color-suggestive-bg: #221f1a;
  --color-suggestive-border: #4a4130;
  --color-suggestive-fg: #e0c078;

  --color-clean: #5aa469;
  --color-clean-bg: #16211a;
  --color-clean-border: #2e4a36;
  --color-clean-fg: #7cc08a;

  --color-coral: #ff4d6d;
  --color-blue: #4a72a0;
  --color-blue-bg: #1c2b3c;
  --color-blue-fg: #a9cdf0;
  --color-blue-link: #6fa8dc;

  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-serif: 'Source Serif 4', Georgia, serif;
}

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

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

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

/* Header & Brand */
.site-header {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px 24px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-default);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-logo {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  flex: none;
  cursor: pointer;
  text-decoration: none;
}

.brand-wordmark {
  font: 700 23px/1 var(--font-sans);
  letter-spacing: -0.04em;
  color: #f2f4f6;
}

.brand-wordmark .accent {
  color: var(--color-coral);
}

.brand-scrubber {
  position: relative;
  height: 5px;
}

.brand-scrubber-line {
  position: absolute;
  top: 2px;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--text-dim);
  border-radius: 1px;
}

.brand-scrubber-dot {
  position: absolute;
  top: 0;
  left: 58%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-coral);
}

/* Search bar */
.header-search {
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: 3px;
  padding: 7px 12px;
}

.header-search input {
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  color: var(--text-primary);
  font-size: 13.5px;
}

.header-search input::placeholder {
  color: var(--text-muted);
}

/* Nav & User Menu */
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.lang-toggle {
  display: flex;
  border: 1px solid var(--border-medium);
  border-radius: 3px;
  overflow: hidden;
  font: 500 11.5px/1 var(--font-mono);
}

.lang-toggle a {
  padding: 6px 9px;
  color: var(--text-secondary);
}

.lang-toggle a.active {
  background: #2c333b;
  color: #fff;
}

/* Buttons & Tags */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 3px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
  line-height: 1;
  transition: opacity 0.1s ease;
}

.btn-primary {
  background: var(--color-blue-bg);
  border-color: var(--color-blue);
  color: var(--color-blue-fg);
}

.btn-primary:hover {
  background: #24374d;
}

.btn-secondary {
  background: var(--bg-input);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
}

.btn-clean {
  background: var(--color-clean-bg);
  border-color: var(--color-clean-border);
  color: var(--color-clean-fg);
}

.btn-clean:hover {
  background: #1f3024;
}

.btn-danger {
  background: var(--color-sex-bg);
  border-color: var(--color-sex-border);
  color: var(--color-sex-fg);
}

.btn-danger:hover {
  background: #322123;
}

/* Verdict Badges */
.badge-verdict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 2px;
  font: 600 12px/1 var(--font-sans);
}

.badge-intensity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--border-medium);
  border-radius: 2px;
  background: var(--bg-input);
  font: 500 11px/1 var(--font-mono);
  color: var(--text-secondary);
}

.intensity-bars {
  display: flex;
  gap: 2px;
}

.intensity-bar {
  width: 12px;
  height: 5px;
  border-radius: 1px;
  background: #2c333b;
}

.intensity-bar.active {
  background: var(--color-sex);
}

/* Layout */
.app-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 24px;
}

/* Filter Rail */
.filter-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-section-title {
  font: 600 11px/1 var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 500 12.5px/1 var(--font-sans);
  padding: 7px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-chip.active {
  border-color: var(--color-blue);
  background: var(--color-blue-bg);
  color: var(--color-blue-fg);
}

/* Movie Card Grid */
.films-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

.film-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 3px;
  overflow: hidden;
  transition: border-color 0.1s ease;
}

.film-card:hover {
  border-color: var(--border-strong);
}

.film-poster-wrap {
  aspect-ratio: 2/3;
  width: 100%;
  background: repeating-linear-gradient(135deg, #1b1f24 0 6px, #171b20 6px 12px);
  position: relative;
  overflow: hidden;
}

.film-poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.film-poster-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.film-card-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.film-card-title {
  font: 600 15px/1.25 var(--font-serif);
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.film-card-meta {
  font: 400 11.5px/1 var(--font-mono);
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Footer */
.site-footer {
  margin-top: 60px;
  border-top: 1px solid var(--border-subtle);
  background: #0b0d0f;
  padding: 18px 24px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.tmdb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  opacity: 0.9;
  transition: opacity 0.15s ease;
}

.tmdb-badge:hover {
  opacity: 1;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-dialog {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}

.modal-header {
  padding: 12px 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  font: 600 12px/1 var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.08em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Layout Containers */
.catalog-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.catalog-sidebar {
  width: 240px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.catalog-main {
  flex: 1;
  min-width: 0;
}

.editor-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.editor-sidebar {
  width: 230px;
  flex: none;
  border-right: 1px solid var(--border-default);
  background: var(--bg-card);
  min-height: 600px;
  padding: 14px 0;
}

.editor-nav-list {
  display: flex;
  flex-direction: column;
}

.editor-main {
  flex: 1;
  min-width: 0;
}

.film-header-layout {
  display: flex;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.film-poster-container {
  width: 150px;
  flex: none;
  aspect-ratio: 2/3;
  background: repeating-linear-gradient(135deg, #1b1f24 0 6px, #171b20 6px 12px);
  border: 1px solid var(--border-default);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.film-facts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 24px;
  max-width: 880px;
}

.film-details-body {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.film-similar-sidebar {
  width: 260px;
  flex: none;
  border: 1px solid var(--border-default);
  border-radius: 3px;
  background: var(--bg-card);
  padding: 14px;
}

.legal-layout {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.legal-toc {
  width: 260px;
  flex: none;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
}

.legal-layout > article {
  flex: 1;
  min-width: 0;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.profile-body {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.profile-main {
  flex: 1;
  min-width: 0;
}

.profile-history {
  width: 320px;
  flex: none;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .app-container {
    padding: 14px 16px;
  }

  .site-header {
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 16px;
  }

  /* flex-basis must be 100% (not the desktop flex: 1 / basis 0) or the search never wraps to its own row */
  .header-search {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
    width: 100%;
  }

  .catalog-layout {
    flex-direction: column;
    gap: 16px;
  }

  .catalog-sidebar {
    width: 100%;
  }

  .editor-layout {
    flex-direction: column;
    gap: 16px;
  }

  .editor-sidebar {
    width: 100%;
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-default);
    padding: 8px 0;
  }

  .editor-nav-list {
    flex-direction: row;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding: 0 12px 8px;
  }

  .editor-nav-list a {
    border-left: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 3px;
    padding: 7px 12px !important;
  }

  .editor-nav-list a.active-tab {
    border-bottom-color: var(--color-blue-link) !important;
    background: #1a1f25 !important;
  }

  .film-header-layout {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 18px;
  }

  .film-poster-container {
    width: 140px;
  }

  .film-facts-grid {
    grid-template-columns: repeat(2, 1fr);
    text-align: left;
    max-width: 100%;
  }

  .film-details-body {
    flex-direction: column;
    gap: 20px;
  }

  .film-similar-sidebar {
    width: 100%;
  }

  .legal-layout {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .legal-toc {
    width: 100%;
    position: static;
    max-height: none;
  }

  .profile-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .profile-body {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .profile-history {
    width: 100%;
  }

  .welcome-section {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
}

@media (max-width: 640px) {
  .app-container {
    padding: 10px 12px;
  }

  .site-header {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
  }

  .site-nav {
    display: none !important;
  }

  .brand-wordmark {
    font-size: 21px;
  }

  .header-actions {
    gap: 8px;
    margin-left: auto;
  }

  .header-search {
    order: 3;
    max-width: 100%;
    width: 100%;
    padding: 7px 10px;
  }

  /* Critical: Balanced 2-column mobile grid so cards don't shrink into thin lines */
  .films-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .film-card-title {
    font-size: 13.5px;
  }

  .film-card-body {
    padding: 8px;
    gap: 4px;
  }

  .film-facts-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px 14px !important;
  }

  .profile-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .badge-intensity {
    padding: 4px 6px;
    font-size: 10px;
  }

  .intensity-bar {
    width: 8px;
    height: 4px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .welcome-section {
    padding-left: 14px !important;
    padding-right: 14px !important;
    padding-top: 28px !important;
    padding-bottom: 28px !important;
    gap: 20px !important;
  }
}

/* Mobile Filter Drawer Styles */
.mobile-filter-drawer {
  width: 100%;
}

.mobile-filter-summary {
  display: none;
}

@media (min-width: 993px) {
  .mobile-filter-drawer {
    display: block !important;
  }

  .mobile-filter-drawer > summary {
    display: none !important;
  }

  .mobile-filter-content {
    display: flex !important;
  }
}

@media (max-width: 992px) {
  .mobile-filter-drawer {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    padding: 12px 14px;
  }

  .mobile-filter-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    user-select: none;
  }

  .mobile-filter-summary::-webkit-details-marker {
    display: none;
  }

  .mobile-filter-content {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
  }

  .welcome-hero {
    padding: 32px 18px 36px !important;
    gap: 28px !important;
  }

  .welcome-hero-left {
    min-width: 100% !important;
    max-width: 100% !important;
  }

  .welcome-hero-logo {
    font-size: 42px !important;
  }

  .welcome-hero-title {
    font-size: 26px !important;
  }

  .welcome-preview-card {
    width: 100% !important;
    padding: 16px !important;
  }

  .welcome-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .welcome-stats-item {
    padding: 16px 20px !important;
  }

  .welcome-stats-item:last-child {
    grid-column: span 2;
    border-top: 1px solid var(--border-subtle);
  }

  .welcome-shelf-section {
    padding: 28px 18px !important;
  }

  .welcome-shelf-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
}

/* ==========================================================================
   Pagination Styling & Giant Arrow Guard
   ========================================================================== */
nav[role="navigation"] svg,
.pagination svg,
.nsfwhen-pagination svg {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  display: inline-block !important;
  vertical-align: middle;
  flex: none !important;
}

.nsfwhen-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 0 6px;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  font-size: 13px;
}

.nsfwhen-pagination-info {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.nsfwhen-pagination-info strong {
  color: var(--text-primary);
  font-weight: 600;
}

.nsfwhen-pagination-links {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nsfwhen-page-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  transition: all 0.15s ease;
  user-select: none;
}

.nsfwhen-page-item:hover:not(.disabled):not(.active) {
  background: var(--bg-surface);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.nsfwhen-page-item.active {
  background: #192738;
  border-color: #388bfd;
  color: #79c0ff;
  font-weight: 600;
  cursor: default;
}

.nsfwhen-page-item.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.nsfwhen-page-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 32px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .nsfwhen-pagination {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .nsfwhen-pagination-info {
    order: 2;
    text-align: center;
  }

  .nsfwhen-pagination-links {
    order: 1;
    justify-content: center;
    width: 100%;
    gap: 4px;
  }

  .nsfwhen-page-item {
    min-width: 30px;
    height: 30px;
    font-size: 12px;
    padding: 0 6px;
  }
}


