/* ================================
   Film View Filter Component
   Tab-based filter for Latest Reviews / Best of Lists
   ================================ */

/* Filter Section (Sticky) */
.film-view-filter-section {
  background: var(--color-bg-primary);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-4) 0;
  position: sticky;
  top: 0;
  z-index: 500;
  transition: box-shadow 0.3s ease;
}

.film-view-filter-section.sticky {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Filter Container */
.film-view-filter {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  justify-content: center;
  overflow: visible; /* Changed from overflow-x: auto to allow dropdown to show */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: var(--space-2) 0;
  flex-wrap: wrap; /* Allow wrapping on small screens instead of scrolling */
}

.film-view-filter::-webkit-scrollbar {
  display: none;
}

/* Filter Buttons and Links */
.film-view-filter > button,
.film-view-filter > a {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  display: inline-block;
}

.film-view-filter > button:hover,
.film-view-filter > a:hover {
  color: var(--color-text-primary);
  border-color: var(--color-accent-primary);
  background: var(--color-bg-tertiary);
  transform: translateY(-2px);
}

.film-view-filter > button.active,
.film-view-filter > a.active {
  color: white;
  background: linear-gradient(135deg, #9D4EDD, #FF6B35);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(157, 78, 221, 0.3);
}

/* Archive dropdown maintains proper structure */
.archive-dropdown {
  display: inline-block;
  flex-shrink: 0;
}

/* Archive Dropdown */
.archive-dropdown {
  position: relative;
}

.archive-dropdown-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.archive-dropdown-btn:hover {
  color: var(--color-text-primary);
  border-color: var(--color-accent-primary);
  background: var(--color-bg-tertiary);
  transform: translateY(-2px);
}

.archive-dropdown-btn.active {
  color: white;
  background: linear-gradient(135deg, #9D4EDD, #FF6B35);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(157, 78, 221, 0.3);
}

.archive-dropdown-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.archive-dropdown.open .archive-dropdown-btn svg {
  transform: rotate(180deg);
}

.archive-dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  min-width: 160px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.3s ease;
  z-index: 1000;
  overflow: hidden;
}

.archive-dropdown.open .archive-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.archive-dropdown-menu a,
.archive-dropdown-menu button {
  display: block !important;
  width: 100%;
  padding: var(--space-3) var(--space-4) !important;
  font-size: var(--font-size-sm) !important;
  font-weight: var(--font-weight-normal) !important;
  color: var(--color-text-secondary) !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  text-align: left;
  text-decoration: none !important;
  transition: all 0.2s ease;
  box-shadow: none !important;
  cursor: pointer;
}

/* Prevent base.css link underline animation */
.archive-dropdown-menu a::after {
  content: none !important;
  display: none !important;
}

.archive-dropdown-menu a:hover,
.archive-dropdown-menu button:hover {
  color: var(--color-text-primary) !important;
  background: var(--color-bg-tertiary) !important;
  transform: none !important;
  box-shadow: none !important;
}

.archive-dropdown-menu a.active,
.archive-dropdown-menu button.active {
  color: var(--color-accent-primary);
  background: var(--color-bg-tertiary);
  font-weight: var(--font-weight-semibold);
}

.archive-dropdown-menu button:first-child,
.archive-dropdown-menu a:first-child {
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.archive-dropdown-menu button:last-child,
.archive-dropdown-menu a:last-child {
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* Mobile */
@media (max-width: 768px) {
  .film-view-filter-section {
    padding: var(--space-3) 0;
  }

  .film-view-filter > button,
  .film-view-filter > a,
  .archive-dropdown-btn {
    padding: var(--space-2) var(--space-3) !important;
    font-size: var(--font-size-xs) !important;
    line-height: 1.2 !important;
    height: auto !important;
    min-height: 0 !important;
  }

  /* Make dropdown button behave like links - remove flex layout */
  .archive-dropdown-btn {
    display: inline-block !important;
    position: relative;
    padding-right: calc(var(--space-3) + 16px) !important;
  }

  /* Position SVG absolutely to not affect height */
  .archive-dropdown-btn svg {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 10px !important;
    height: 10px !important;
  }

  /* Ensure dropdown menu items stay small */
  .archive-dropdown-menu a,
  .archive-dropdown-menu button {
    padding: var(--space-2) var(--space-3) !important;
    font-size: var(--font-size-xs) !important;
    line-height: 1.4 !important;
  }

  .archive-dropdown-menu {
    right: 0;
    left: auto;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .film-view-filter button,
  .archive-dropdown-btn svg,
  .archive-dropdown-menu {
    transition: none;
  }

  .film-view-filter button:hover,
  .archive-dropdown-menu button:hover {
    transform: none;
  }
}
