/* ============================================================================= */
/* I. UTILITIES
/* ============================================================================= */

/**
 * Utility to hide the scrollbar for elements that are scrollable.
 * This is used for a cleaner look on custom scroll containers.
 */
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* ============================================================================= */
/* II. SIDEBAR STYLES
/* ============================================================================= */

/**
 * Defines smooth transitions for the sidebar's width and the main content's
 * margin when the sidebar collapses or expands.
 */
#logo-sidebar {
  transition: width 0.3s ease-in-out;
}

.ml-64,
.ml-16 {
  transition: margin-left 0.3s ease-in-out;
}

/**
 * Prevents a "white flash" or jarring effect on text and images inside the
 * sidebar during collapse/expand animations by syncing their opacity transition.
 */
.sidebar-text,
#sidebar-logo-img,
.sidebar-signin {
  transition: opacity 0.2s ease-in-out;
}

/* ============================================================================= */
/* III. POPUP AND DROPDOWN STYLES
/* ============================================================================= */

/**
 * WORKAROUND for positioning fixed popups within a scrolling container.
 * The parent needs a `position: relative` for the popups to be anchored correctly.
 */
#filters-section {
  position: relative;
}

/**
 * Desktop filter popups are positioned `fixed` to stay in place relative to the
 * viewport, which is necessary when they are triggered from within a sticky header.
 * The `!important` flag is used to override any conflicting inline styles.
 */
#filters-section [id$="-popup"] {
  position: fixed !important;
  z-index: 9999 !important;
  display: none !important;
}

#filters-section [id$="-popup"]:not(.hidden) {
  display: block !important;
}

/**
 * Nested popups (like gender/age within the people filter) must be positioned
 * `absolute` relative to their parent popup.
 */
#people-popup [id$="-popup"] {
  position: absolute !important;
}

/**
 * On mobile, filter popups should behave like normal block elements within their
 * container, not fixed to the viewport. These rules override the desktop styles.
 */
#mobile-filters-dropdown [id$="-popup"] {
  position: relative !important;
  width: 100% !important;
  left: auto !important;
  right: auto !important;
  display: none !important;
}

#mobile-filters-dropdown [id$="-popup"]:not(.hidden) {
  display: block !important;
}

.mobile-filter-popup {
  width: 100%;
  box-sizing: border-box;
  position: relative !important;
}

/* ============================================================================= */
/* IV. FORM & INPUT STYLES
/* ============================================================================= */

/**
 * Hides the default clear ('x') button that appears in search inputs
 * on WebKit and Firefox browsers for a consistent custom design.
 */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

input[type="search"] {
  -moz-appearance: textfield;
}

/* ============================================================================= */
/* V. DESKTOP NAVIGATION
/* ============================================================================= */

/**
 * Creates a bottom border effect for the active/hovered navigation item
 * on the main desktop navigation bar.
 */
.nav-item {
  position: relative;
  padding-bottom: 5px;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
}

.nav-item:hover,
.nav-item.active {
  border-bottom-color: white;
}

/* Similar styling for the "More" button to ensure consistency. */
#more-btn {
  position: relative;
  padding-bottom: 8px;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
}

#more-btn:hover,
#more-btn.active {
  border-bottom-color: white;
}

/* ============================================================================= */
/* VI. MOBILE-SPECIFIC STYLES
/* ============================================================================= */

/**
 * Prevents the main body from scrolling when a modal or full-screen
 * dropdown is active on mobile.
 */
body.no-scroll {
  overflow: hidden;
}

/**
 * Allows mobile dropdowns (like Filters and Settings) to be scrollable
 * on their own if their content exceeds the viewport height.
 * `calc(100vh - 200px)` provides space for the header and other UI elements.
 */
.mobile-dropdown-scroll {
  overflow-y: auto;
  max-height: calc(100vh - 200px);
}

/* ============================================================================= */
/* VII. DYNAMIC IMAGE CARD ENHANCEMENTS
/* ============================================================================= */

/**
 * Enhanced hover effects for image cards
 */
.image-card {
  transition: transform 0.2s ease;
}

.image-card:hover {
  transform: translateY(-2px);
}

/**
 * Smooth button animations
 */
.action-buttons button,
.discover-btn {
  transition: all 0.2s ease;
}

.action-buttons button:hover,
.discover-btn:hover {
  transform: scale(1.05);
}

/**
 * Notification styles
 */
.notification-enter {
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}