/* FOUCE Prevention: hide Web Awesome elements until their JS
   definitions load. :not(:defined) matches custom elements that
   haven't been upgraded yet. visibility:hidden preserves layout
   so there's no reflow when they appear. */
wa-dropdown:not(:defined),
wa-button:not(:defined),
wa-icon:not(:defined),
wa-icon-button:not(:defined),
wa-dropdown-item:not(:defined),
wa-divider:not(:defined),
wa-dialog:not(:defined),
wa-input:not(:defined),
wa-callout:not(:defined),
wa-details:not(:defined),
wa-card:not(:defined),
wa-tooltip:not(:defined),
wa-badge:not(:defined),
wa-spinner:not(:defined),
wa-checkbox:not(:defined),
wa-radio:not(:defined),
wa-radio-group:not(:defined),
wa-select:not(:defined),
wa-option:not(:defined),
wa-textarea:not(:defined),
wa-tab-group:not(:defined),
wa-tab:not(:defined),
wa-tab-panel:not(:defined),
wa-progress-bar:not(:defined) {
  visibility: hidden;
}

/**
 * Cubestream Theme for Web Awesome Components
 * Maps Cubestream brand colors to Web Awesome design tokens
 */

/* ==========================================================================
   MENU ICON TOGGLE
   Uncomment the rule below to hide all menu/dropdown icons site-wide.
   This uses display:none so icons won't render (saves bandwidth).
   Comment out to restore icons.
   ========================================================================== */
/*
.cs-dropdown-item wa-icon[slot="icon"],
.cs-nav-trigger > wa-icon:first-child,
.cs-parent-genre-item wa-icon,
.cs-genre-trigger-btn wa-icon:first-child {
  display: none !important;
}
*/

:root {
  /* Primary Colors - Cubestream Blue */
  --wa-color-primary-50: #e8f1fe;
  --wa-color-primary-100: #b9d6fc;
  --wa-color-primary-200: #8abbfa;
  --wa-color-primary-300: #5ba0f8;
  --wa-color-primary-400: #2c85f6;
  --wa-color-primary-500: #0c6af5; /* CS-blue */
  --wa-color-primary-600: #0a55c4;
  --wa-color-primary-700: #074093;
  --wa-color-primary-800: #052b62;
  --wa-color-primary-900: #021631;

  /* Accent Colors - Cubestream Aqua */
  --wa-color-success-500: #00fff6; /* CS-aqua */
  --wa-color-success-600: #00ccc5;

  /* Cubestream brand gradient */
  --cs-gradient: linear-gradient(135deg, #00FDf6, #0B7BF5);
  --cs-gradient-hover: linear-gradient(135deg, #00e5df, #0a6ad4);

  /* Site container max width */
  --site-max-width: 1200px;
}

/* Primary Button with Cubestream Gradient */
wa-button[variant="primary"]::part(base) {
  background: var(--cs-gradient);
  border: none;
  color: #000;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.1s ease;
}

wa-button[variant="primary"]::part(base):hover {
  background: var(--cs-gradient-hover);
}

wa-button[variant="primary"]::part(base):active {
  transform: scale(0.98);
}

/* Text Button styling for dark theme */
wa-button[variant="text"]::part(base) {
  color: #fff;
  background: transparent;
}

wa-button[variant="text"]::part(base):hover {
  color: var(--wa-color-primary-300, #5ba0f8);
  background: rgba(255, 255, 255, 0.05);
}

/* Default Button styling for dark backgrounds */
wa-button[variant="default"]::part(base) {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

wa-button[variant="default"]::part(base):hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Card styling to match existing panels */
wa-card::part(base) {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

wa-card::part(header) {
  border-bottom: 1px solid #e5e5e5;
  padding: 16px 20px;
}

wa-card::part(body) {
  padding: 20px;
}

/* Input styling to match current form fields */
wa-input::part(base),
wa-textarea::part(base),
wa-select::part(combobox) {
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

wa-input::part(base):focus-within,
wa-textarea::part(base):focus-within,
wa-select::part(combobox):focus-within {
  border-color: var(--wa-color-primary-500);
  box-shadow: 0 0 0 3px rgba(12, 106, 245, 0.15);
}

wa-input::part(input),
wa-textarea::part(textarea) {
  font-family: var(--font-stack, helvetica, arial, sans-serif);
  font-size: 14px;
}

/* Details/Accordion styling for progressive form */
wa-details::part(base) {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

wa-details::part(header) {
  padding: 16px 20px;
  background: #fafafa;
  font-weight: 600;
  transition: background 0.2s ease;
}

wa-details::part(header):hover {
  background: #f0f0f0;
}

wa-details[open]::part(header) {
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
}

wa-details::part(content) {
  padding: 20px;
}

/* Locked accordion state */
wa-details[disabled]::part(header) {
  opacity: 0.6;
  cursor: not-allowed;
}

wa-details[disabled]::part(base) {
  background: #f8f8f8;
}

/* Completed section indicator */
wa-details.section-completed::part(header)::after {
  content: '\2713';
  color: #00c853;
  margin-left: auto;
  font-size: 18px;
}

/* Dialog/Modal styling - Light theme (default) */
wa-dialog::part(dialog) {
  border-radius: 12px;
  max-width: 500px;
  border: 3px solid #00bcd4;
}

wa-dialog::part(header) {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e5e5;
}

wa-dialog::part(body) {
  padding: 24px;
}

wa-dialog::part(footer) {
  padding: 16px 24px;
  border-top: 1px solid #e5e5e5;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Dialog/Modal styling - Dark theme variant */
wa-dialog.wa-dialog-dark::part(dialog) {
  background: #1a1a1a;
  border: 1px solid rgba(0, 253, 246, 0.2);
  border-radius: 12px;
  max-width: 500px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(0, 253, 246, 0.15),
    0 0 80px rgba(0, 253, 246, 0.08);
}

wa-dialog.wa-dialog-dark::part(header) {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: #000;
}

wa-dialog.wa-dialog-dark::part(title) {
  color: var(--CS-blue, #0066cc);
  font-weight: 600;
  font-family: helvetica, arial, sans-serif;
}

wa-dialog.wa-dialog-dark::part(close-button) {
  color: rgba(255, 255, 255, 0.7);
}

wa-dialog.wa-dialog-dark::part(close-button):hover {
  color: #fff;
}

wa-dialog.wa-dialog-dark::part(body) {
  padding: 24px;
  color: #e0e0e0;
  font-family: helvetica, arial, sans-serif;
  line-height: 1.6;
}

wa-dialog.wa-dialog-dark::part(footer) {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #000;
}

/* Dark dialog overlay */
wa-dialog.wa-dialog-dark::part(overlay) {
  background: rgba(0, 0, 0, 0.7);
}

/* Dark-themed form inputs inside dark dialogs */
.wa-dialog-dark wa-input::part(base),
.wa-dialog-dark wa-textarea::part(base),
.wa-dialog-dark wa-select::part(combobox) {
  background: #2a2a2a;
  border-color: rgba(255, 255, 255, 0.2);
}

.wa-dialog-dark wa-input::part(input),
.wa-dialog-dark wa-textarea::part(textarea),
.wa-dialog-dark wa-select::part(display-input) {
  color: #e0e0e0;
}

.wa-dialog-dark wa-input::part(form-control-label),
.wa-dialog-dark wa-textarea::part(form-control-label),
.wa-dialog-dark wa-select::part(form-control-label) {
  color: #ccc;
}

/* Dialog responsive styles for mobile */
@media (max-width: 550px) {
  wa-dialog::part(panel) {
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 64px);
    margin: 16px;
  }

  wa-dialog::part(dialog) {
    max-width: 100%;
  }

  wa-dialog::part(header) {
    padding: 16px;
  }

  wa-dialog::part(body) {
    padding: 16px;
    font-size: 14px;
  }

  wa-dialog::part(footer) {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  wa-dialog.wa-dialog-dark::part(dialog) {
    max-width: 100%;
  }

  wa-dialog.wa-dialog-dark::part(header) {
    padding: 16px;
  }

  wa-dialog.wa-dialog-dark::part(body) {
    padding: 16px;
    font-size: 14px;
  }

  wa-dialog.wa-dialog-dark::part(footer) {
    padding: 12px 16px;
  }
}

/* Callout/Notification styling - Clean white with colored border */
wa-callout::part(base) {
  border-radius: 8px;
  border: 1px solid #ccc;
  border-left-width: 4px;
  background: #fff;
  color: #000;
}

wa-callout::part(message) {
  color: #333;
}

wa-callout[variant="success"]::part(base) {
  background: #fff;
  border-color: #00c853;
  border-left-color: #00c853;
  color: #000;
}

wa-callout[variant="danger"]::part(base) {
  background: #fff;
  border-color: #f44336;
  border-left-color: #f44336;
  color: #000;
}

wa-callout[variant="warning"]::part(base) {
  background: #fff;
  border-color: #ff9800;
  border-left-color: #ff9800;
  color: #000;
}

wa-callout[variant="primary"]::part(base) {
  background: #fff;
  border-color: var(--wa-color-primary-500);
  border-left-color: var(--wa-color-primary-500);
  color: #000;
}

/* Select dropdown styling */
wa-select::part(listbox) {
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Checkbox and Radio styling */
wa-checkbox::part(control),
wa-radio::part(control) {
  border-color: #ccc;
}

/* Web Awesome 3.0 uses :state(checked) instead of deprecated ::part(control--checked) */
wa-checkbox:state(checked)::part(control),
wa-radio:state(checked)::part(control) {
  background: var(--wa-color-primary-500);
  border-color: var(--wa-color-primary-500);
}

/* Radio Button (pill/toggle style) styling */
wa-radio-button::part(button) {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  transition: all 0.2s ease;
}

wa-radio-button::part(button):hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Web Awesome 3.0: use [checked] attribute or :state(checked) instead of deprecated ::part(button--checked) */
wa-radio-button[checked]::part(button),
wa-radio-button:state(checked)::part(button) {
  background: var(--cs-gradient);
  border-color: transparent;
  color: #000;
  font-weight: 600;
}

wa-radio-group::part(button-group) {
  background: transparent;
  border: none;
}

/* Badge styling */
wa-badge::part(base) {
  font-size: 12px;
  font-weight: 600;
}

wa-badge[variant="primary"]::part(base) {
  background: var(--cs-gradient);
  color: #000;
}

/* Spinner styling */
wa-spinner {
  --indicator-color: var(--wa-color-primary-500);
  --track-color: #e5e5e5;
}

/* Tooltip styling */
wa-tooltip::part(body) {
  background: #333;
  color: #fff;
  font-size: 13px;
  border-radius: 6px;
  padding: 8px 12px;
}

/* Icon button styling */
wa-icon-button::part(base):hover {
  color: var(--wa-color-primary-500);
}

/* Progress bar styling */
wa-progress-bar::part(indicator) {
  background: var(--cs-gradient);
}

/* Tab styling for potential future use */
wa-tab-group::part(tabs) {
  border-bottom: 2px solid #e5e5e5;
}

wa-tab::part(base) {
  padding: 12px 20px;
  font-weight: 500;
}

wa-tab[active]::part(base) {
  color: var(--wa-color-primary-500);
  border-bottom: 2px solid var(--wa-color-primary-500);
  margin-bottom: -2px;
}

/* ============================================
   Header Navigation Dropdown Styles
   ============================================ */

/* Base dropdown styling for header */
.cs-header-dropdown::part(menu) {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  min-width: 180px;
  padding: 8px 0;
}

/* Trigger button styling */
.cs-hamburger-trigger::part(base),
.cs-movies-trigger::part(base),
.cs-profile-trigger::part(base) {
  background: transparent;
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.cs-hamburger-trigger::part(base):hover,
.cs-movies-trigger::part(base):hover,
.cs-profile-trigger::part(base):hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Movies trigger specific styling */
.cs-movies-trigger::part(base) {
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  font-family: helvetica, arial, sans-serif;
}

.cs-movies-trigger::part(caret) {
  color: rgba(255, 255, 255, 0.6);
}

/* Dropdown item styling */
.cs-dropdown-item::part(base) {
  color: #fff;
  padding: 10px 16px;
  font-size: 14px;
  font-family: helvetica, arial, sans-serif;
  transition: all 0.15s ease;
}

.cs-dropdown-item::part(base):hover {
  background: rgba(0, 253, 246, 0.1);
  color: #00fdf6;
}

.cs-dropdown-item::part(icon) {
  color: rgba(255, 255, 255, 0.7);
  margin-right: 12px;
  display: flex;
  align-items: center;
}

/* Ensure icons inside dropdown items are visible */
.cs-dropdown-item wa-icon[slot="icon"] {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  width: 1.25em;
  display: inline-flex;
}

.cs-dropdown-item::part(base):hover wa-icon[slot="icon"],
.cs-dropdown-item:hover wa-icon[slot="icon"] {
  color: #00fdf6;
}

/* Dropdown item label text */
.cs-dropdown-item::part(label) {
  color: #fff;
}

/* Danger variant for logout */
wa-dropdown-item[variant="danger"].cs-dropdown-item::part(base) {
  color: #ff6b6b;
}

wa-dropdown-item[variant="danger"].cs-dropdown-item::part(base):hover {
  background: rgba(255, 107, 107, 0.1);
  color: #ff4444;
}

wa-dropdown-item[variant="danger"].cs-dropdown-item::part(prefix) {
  color: #ff6b6b;
}

/* Divider styling */
.cs-header-dropdown wa-divider {
  --color: rgba(255, 255, 255, 0.1);
  margin: 6px 0;
}

/* Profile dropdown specific styles */
.cs-profile-dropdown::part(menu) {
  min-width: 220px;
}

.cs-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.cs-profile-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: #333;
  border: 2px solid rgba(0, 253, 246, 0.3);
}

.cs-profile-greeting {
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  font-family: helvetica, arial, sans-serif;
}

/* Two-tier genre panel - parent/sub-genre hierarchy */
.cs-genre-panel {
  position: absolute;
  left: 100%;
  top: 0;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  padding: 8px 0;
  display: none;
  z-index: 1000;
  min-width: 280px;
  max-height: 70vh;
  overflow-y: auto;
}

.cs-genre-panel.show {
  display: block;
}

/* Parent genre item - clickable item that loads sub-genre carousels */
.cs-parent-genre-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  font-family: helvetica, arial, sans-serif;
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cs-parent-genre-item:last-child {
  border-bottom: none;
}

.cs-parent-genre-item:hover {
  background: rgba(0, 253, 246, 0.1);
  color: #00fdf6;
}

.cs-parent-genre-item wa-icon {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.15s ease;
}

.cs-parent-genre-item:hover wa-icon {
  color: #00fdf6;
}

.cs-parent-genre-item span {
  flex: 1;
}

/* Legacy grid panel styles (kept for backward compatibility) */
.cs-genre-grid-panel {
  position: absolute;
  left: 100%;
  top: 0;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  padding: 16px;
  display: none;
  z-index: 1000;
  min-width: 320px;
}

.cs-genre-grid-panel.show {
  display: block;
}

.cs-genre-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.cs-genre-item {
  color: #fff;
  padding: 10px 14px;
  font-size: 13px;
  font-family: helvetica, arial, sans-serif;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
}

.cs-genre-item:hover {
  background: rgba(0, 253, 246, 0.1);
  color: #00fdf6;
}

/* Genre trigger button (custom div that looks like dropdown item) */
.cs-genre-trigger-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #fff;
  font-size: 14px;
  font-family: helvetica, arial, sans-serif;
  cursor: pointer;
  transition: background 0.15s ease;
}

.cs-genre-trigger-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.cs-genre-trigger-btn wa-icon {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
}

.cs-genre-trigger-btn span {
  flex: 1;
}

.cs-genre-chevron {
  font-size: 0.75rem !important;
  color: rgba(255, 255, 255, 0.5) !important;
}

/* Movies dropdown wider for genre submenu */
.cs-movies-dropdown::part(menu) {
  min-width: 200px;
  overflow: visible;
}

/* Genre wrapper for positioning */
.cs-genre-wrapper {
  position: relative;
}

/* ============================================
   Header Navigation - Flank Layout
   ============================================ */

/* Custom flank layout for header navigation.
   The bar (background) spans the full viewport width; horizontal padding
   grows on screens wider than 1920px so the inner nav content stays within
   the same 1920px-wide region it always has. */
.cs-header-flank {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0 auto !important;
  padding: 8px max(12px, calc((100vw - 1920px) / 2));
  gap: 8px;
  /* Sticky header positioning */
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
  background-color: #000 !important;
  box-sizing: border-box;
}

/* Override any old grid styles on this ID and make header sticky */
#common-header-nav-table {
  display: flex !important;
  grid-template-columns: unset !important;
  grid-template-areas: unset !important;
  margin: 0 auto !important;
  /* Sticky header positioning */
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
  background-color: #000 !important;
  padding-top: max(8px, env(safe-area-inset-top)) !important;
  padding-bottom: 8px !important;
  padding-left: max(12px, calc((100vw - 1920px) / 2)) !important;
  padding-right: max(12px, calc((100vw - 1920px) / 2)) !important;
}

/* ============================================
   TRANSPARENT HEADER STATES (Index Page Only)
   ============================================ */

/* Transparent header for index carousel view */
#common-header-nav-table.header-transparent {
  background-color: transparent !important;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 60%, transparent 100%) !important;
  transition: background 0.3s ease-in-out, background-color 0.3s ease-in-out;
}

/* Solid header after scroll or movie detail view */
#common-header-nav-table.header-solid {
  background-color: #000 !important;
  background: #000 !important;
  transition: background 0.3s ease-in-out, background-color 0.3s ease-in-out;
}

/* Ensure solid on non-index/about pages */
body:not(.index-page):not(.about-page) #common-header-nav-table {
  background-color: #000 !important;
}

/* On index/about page, use fixed positioning so content starts at top of viewport */
body.index-page #common-header-nav-table,
body.about-page #common-header-nav-table {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
}

/* Left group: logo + navigation dropdowns */
.nav-left-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Logo button — give the host an explicit min size so the home button stays
   visible/clickable even if the CDN-hosted logo SVG fails to load
   (otherwise the button collapses to 0×0 because it sizes to its <img>). */
.cs-logo-button {
  background: transparent;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  min-width: 110px;
  min-height: 32px;
}

.cs-logo-button img {
  height: 32px;
  width: auto;
}

/* Unified nav trigger styling for all dropdowns */
.cs-nav-trigger::part(base) {
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  font-family: helvetica, arial, sans-serif;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cs-nav-trigger::part(base):hover {
  background: rgba(255, 255, 255, 0.1);
}

.cs-nav-trigger::part(caret) {
  color: rgba(255, 255, 255, 0.6);
  margin-left: 2px;
}

.cs-nav-trigger wa-icon {
  font-size: 1rem;
  opacity: 0.85;
}

/* Nav trigger text label and caret */
.cs-nav-trigger .nav-label {
  margin: 0 4px;
}

.cs-nav-trigger .nav-caret {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-left: 2px;
}

/* Navigation link buttons (matches about.html style) */
wa-button.nav-link::part(base) {
  color: #fff;
  font-size: 1rem;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  transition: background 0.2s ease;
}

wa-button.nav-link::part(base):hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Hamburger menu trigger (left) */
.cs-hamburger-trigger::part(base) {
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: 8px;
  color: #fff;
  transition: background 0.2s ease;
}

.cs-hamburger-trigger::part(base):hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Middle group: search bar - grows to fill space */
.nav-search-group {
  flex: 1 1 auto;
  min-width: 150px;
  max-width: 600px;
  padding: 0 16px;
  display: flex;
  justify-content: center;
}

.nav-search-group .nav_search_container {
  width: 100%;
}

/* Right group: user info + profile dropdown - pushed to far right */
.nav-right-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.nav-right-group .name-i-tag {
  white-space: nowrap;
}

/* Profile trigger with icon */
.cs-profile-trigger::part(base) {
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: 50%;
  color: #fff;
  transition: background 0.2s ease;
}

.cs-profile-trigger::part(base):hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Responsive adjustments for flank layout */
@media (max-width: 768px) {
  /* Wrap header so search moves to second row, freeing space for bell + menu */
  #common-header-nav-table {
    flex-wrap: wrap;
  }

  .nav-left-group {
    order: 1;
    flex: 0 0 auto;
    gap: 2px;
  }

  .nav-search-group {
    order: 3;
    flex: 1 0 100%;
    max-width: 100%;
    padding: 0 8px;
  }

  .nav-right-group {
    order: 2;
    flex: 0 0 auto;
    margin-left: auto;
  }

  /* Hide greeting text on tablet to save space */
  .nav-right-group .name-i-tag {
    display: none;
  }

  /* Hide Browse, Submissions on tablet (available via hamburger/three-dot menu) */
  #moviesMenuDropdown,
  #createMenuDropdown,
  a.nav-link.submissions-link {
    display: none;
  }

  /* Show mobile-only items in three-dot menu on tablet */
  .mobile-only-item {
    display: block !important;
  }

  wa-dropdown-item.mobile-only-item {
    display: flex !important;
  }

  .cs-nav-trigger::part(base) {
    padding: 6px 8px;
    font-size: 13px;
  }

  /* Genre panel centered on screen for tablet */
  .cs-genre-panel,
  .cs-genre-grid-panel {
    position: fixed;
    left: 50%;
    right: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    max-width: calc(100vw - 40px);
    max-height: 70vh;
    overflow-y: auto;
  }

  .cs-genre-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Hide mobile-only hamburger items on desktop/tablet */
.mobile-only-item {
  display: none !important;
}

/* Link.php hamburger: desktop-only items (hidden on mobile) */
.link-desktop-item {
  /* visible by default */
}

/* Link.php hamburger: mobile-only items (hidden on desktop) */
.link-mobile-item {
  display: none !important;
}

/* Link.php hamburger: show sidebar nav items when sidebar is hidden */
@media (max-width: 1199px) {
  .link-mobile-item {
    display: block !important;
  }
  wa-dropdown-item.link-mobile-item {
    display: flex !important;
  }
}

@media (max-width: 550px) {
  /* Stack to mobile layout with search on second row */
  #common-header-nav-table {
    flex-wrap: wrap;
    gap: 4px;
  }

  .nav-left-group {
    order: 1;
    flex: 0 0 auto;
    gap: 1px;
  }

  .nav-search-group {
    order: 3;
    flex: 1 0 100%;
    max-width: 100%;
    padding: 0;
  }

  .nav-right-group {
    order: 2;
    flex: 0 0 auto;
    margin-left: auto;
    gap: 2px;
    flex-wrap: nowrap;
  }

  /* Hide greeting text on mobile, show Sign In button */
  .nav-right-group .name-i-tag {
    display: none;
  }

  /* Hide text labels and carets on mobile, keep icons visible */
  .cs-nav-trigger .nav-label,
  .cs-nav-trigger .nav-caret {
    display: none;
  }

  /* Smaller buttons on mobile */
  .cs-nav-trigger::part(base) {
    padding: 6px;
  }

  .cs-hamburger-trigger::part(base) {
    padding: 6px;
  }

  .cs-profile-trigger::part(base) {
    padding: 6px;
  }

  /* Smaller icons on mobile */
  .cs-hamburger-trigger wa-icon,
  .cs-profile-trigger wa-icon {
    font-size: 1.1rem;
  }

  .notification-bell wa-icon {
    font-size: 1.1rem;
  }

  /* Hide Browse, Submissions dropdown and plain link on mobile */
  #moviesMenuDropdown,
  #createMenuDropdown,
  a.nav-link.submissions-link {
    display: none;
  }

  /* Show mobile-only items on small screens */
  .mobile-only-item {
    display: block !important;
  }

  /* wa-dropdown-item needs flex display for icon+text layout, not block */
  wa-dropdown-item.mobile-only-item {
    display: flex !important;
  }

  /* wa-dropdown needs inline-block to behave as a dropdown trigger */
  wa-dropdown.mobile-only-item {
    display: inline-block !important;
  }

  /* Link.php hamburger: show desktop items on mobile too */
  .link-desktop-item {
    display: flex !important;
  }


  /* Ensure dropdown items don't wrap text */
  .cs-profile-dropdown wa-dropdown-item::part(base) {
    white-space: nowrap;
  }

  .cs-profile-dropdown::part(menu) {
    min-width: 220px;
  }

  /* Smaller logo on mobile */
  .cs-logo-button {
    min-width: 110px;
    min-height: 22px;
  }
  .cs-logo-button img {
    height: 22px;
    width: auto;
    max-width: 110px;
  }
}

@media (max-width: 480px) {
  .cs-header-dropdown::part(menu) {
    min-width: 160px;
  }

  #leftMenuDropdown::part(menu) {
    min-width: 200px;
  }

  .cs-profile-dropdown::part(menu) {
    min-width: 200px;
  }

  .cs-dropdown-item::part(base) {
    padding: 12px 14px;
  }

  /* Genre panel centered on screen for mobile */
  .cs-genre-panel,
  .cs-genre-grid-panel {
    position: fixed;
    left: 50%;
    right: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: calc(100vw - 40px);
    max-width: 320px;
    max-height: 70vh;
    overflow-y: auto;
  }

  .cs-genre-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   Movie Carousel Styles (CSS Flexbox Scroll)
   ============================================ */

/* Carousel title row with clickable sub-genre titles */
.carousel-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.carousel-title-clickable {
  cursor: pointer;
  transition: color 0.15s ease;
  border-bottom: 1px dashed transparent;
}

.carousel-title-clickable:hover {
  color: #00fdf6;
  border-bottom-color: #00fdf6;
}

/* Two-part carousel title: Parent (darker) : Sub-genre (bright) */
.carousel-title-parent {
  color: #888;
  font-weight: 400;
}

.carousel-title-subgenre {
  color: #fff;
  font-weight: 600;
}

.carousel-title-clickable:hover .carousel-title-parent {
  color: #00fdf6;
  opacity: 0.6;
}

.carousel-title-clickable:hover .carousel-title-subgenre {
  color: #00fdf6;
}

/* Parent genre link on home page - subtle indicator it's clickable */
.carousel-title-parent-link {
  color: #fff;
  font-weight: 600;
  border-bottom: none !important;
}

.carousel-title-parent-link::after {
  content: ' ▸';
  color: #666;
  font-size: 1.3em;
  line-height: 0;
  font-weight: 400;
  transition: color 0.15s ease;
}

.carousel-title-parent-link:hover::after {
  content: ' →';
  color: #00fdf6;
}

/* Carousel wrapper - positions nav buttons */
.movie-carousel-wrapper {
  position: relative;
  width: 95%;
  margin: 0 auto 4px auto;
  padding: 8px 0; /* Space for shadow and hover lift */
}

/* Scroll container */
.movie-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 8px 0; /* Space for shadows */
  min-height: 190px; /* Prevent vertical clipping: 200px tile + shadows + hover */

  /* Hide scrollbar but keep functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.movie-carousel::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* Dragging state */
.movie-carousel.dragging {
  cursor: grabbing;
  scroll-behavior: auto; /* Disable smooth scroll while dragging */
  user-select: none;
}

.movie-carousel.dragging * {
  pointer-events: none; /* Prevent hover effects while dragging */
}

/* Navigation buttons */
.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.carousel-nav:hover {
  background: rgba(0, 253, 246, 0.2);
  border-color: #00fdf6;
  color: #00fdf6;
}

.carousel-nav-prev {
  left: -20px;
}

.carousel-nav-next {
  right: -20px;
}

/* Fixed-size carousel tiles */
.movie-carousel-item {
  flex: 0 0 272px; /* Don't grow, don't shrink, 272px wide */
}

/* Movie tile button - FIXED DIMENSIONS */
.movie-carousel-item .movie_tile_image {
  width: 272px;
  height: 170px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 0;
}

.movie-carousel-item .movie_tile_image img {
  display: block;
  width: 272px;
  height: 170px;
  object-fit: cover;
  object-position: 50% 50%;
  border-radius: 10px;
  box-shadow: 0 2px 8px #777;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.movie-carousel-item .movie_tile_image:hover img {
  box-shadow: 0 4px 12px #0CD8FE;
  transform: translateY(-4px);
}

/* Mobile: Smaller fixed tiles + hide navigation */
@media (max-width: 600px) {
  .movie-carousel-wrapper {
    width: 98%;
  }

  .movie-carousel {
    min-height: 140px; /* 116px tile + shadows + hover */
  }

  .movie-carousel-item {
    flex: 0 0 177px;
  }

  .movie-carousel-item .movie_tile_image,
  .movie-carousel-item .movie_tile_image img {
    width: 186px;
    height: 116px;
  }

  /* Disable hover effects on mobile to prevent sticky hover after tap */
  .movie-carousel-item .movie_tile_image:hover img {
    box-shadow: 0 2px 8px #777;
    transform: none;
  }

  .movie_tile_image img:hover {
    border: 2px solid #7777;
  }

  /* Keep nav arrows but make them smaller on mobile */
  .carousel-nav {
    width: 32px;
    height: 32px;
  }

  .carousel-nav-prev {
    left: 4px;
  }

  .carousel-nav-next {
    right: 4px;
  }
}

/* ============================================
   Movie Grid Styles (for search results)
   ============================================ */

/* Grid container - constrained to site-container width (max 4 columns at 1200px) */
.four_column_grid_container {
  display: grid;
  grid-template-columns: repeat(1, 272px);
  grid-auto-rows: auto;
  justify-content: center;
  width: 100%;
  max-width: var(--site-max-width);
  column-gap: 12px;
  row-gap: 24px;
  margin: auto;
  padding: 12px 0;
  box-sizing: border-box;
}

/* Responsive columns - based on container fitting, not viewport */
@media (min-width: 580px) {
  .four_column_grid_container {
    grid-template-columns: repeat(2, 272px);
  }
}

@media (min-width: 870px) {
  .four_column_grid_container {
    grid-template-columns: repeat(3, 272px);
  }
}

@media (min-width: 1160px) {
  .four_column_grid_container {
    grid-template-columns: repeat(4, 272px);
  }
}

/* Grid item - FIXED SIZE */
.movie-grid-item {
  width: 272px;
  height: 170px;
}

.movie-grid-item .movie_tile_image {
  width: 272px;
  height: 170px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 0; /* Remove any line-height spacing */
}

.movie-grid-item .movie_tile_image img {
  display: block; /* Remove inline spacing */
  width: 272px;
  height: 170px;
  object-fit: cover;
  object-position: 50% 50%;
  border-radius: 10px;
  box-shadow: 0 2px 8px #777;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.movie-grid-item .movie_tile_image:hover img {
  box-shadow: 0 4px 12px #0CD8FE;
  transform: translateY(-4px);
}

/* Tablet: Smaller fixed tiles */
@media (max-width: 600px) {
  .four_column_grid_container {
    grid-template-columns: repeat(auto-fill, 238px);
    grid-gap: 8px;
  }

  .movie-grid-item,
  .movie-grid-item .movie_tile_image,
  .movie-grid-item .movie_tile_image img {
    width: 238px;
    height: 149px;
  }
}

/* Mobile: 2 items per row on small screens */
@media (max-width: 500px) {
  .four_column_grid_container {
    grid-template-columns: repeat(2, 1fr) !important;
    grid-gap: 8px !important;
    width: 100% !important;
    padding: 8px !important;
    box-sizing: border-box;
  }

  .movie-grid-item,
  .movie-grid-item .movie_tile_image,
  .movie-grid-item .movie_tile_image img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 10;
  }
}
