/* ---------- Core Variables & Settings ---------- */
:root {
  --pink: #ff385c;
  --divider: #ededed;
  --text-main: #222;
  --text-muted: #717171;
  --shadow-default: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-elevated: 0 6px 20px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 0 2px rgba(255, 56, 92, 0.25);
  --transition-time: 200ms;
  --transition-curve: cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 32px;
}

/* ---------- Base Container Styles ---------- */
.bigbar {
  height: 3.5rem; /* 56px at default font size */
  max-width: 720px;
  width: 100%;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-default);
  background: #fff;
  margin: 0 auto;
  position: relative;
  transition: transform var(--transition-time) var(--transition-curve),
    box-shadow var(--transition-time) var(--transition-curve),
    backdrop-filter var(--transition-time) var(--transition-curve);
  gap: 4px;
}

/* ---------- Animation Classes ---------- */
/* Subtle pulse animation for attracting attention */
.bigbar.pulse-hint {
  animation: pulse 2s linear infinite;
}

/* Pause pulse animation on interaction */
.bigbar.pulse-hint:hover,
.bigbar.pulse-hint:focus-within {
  animation-play-state: paused;
}

/* ---------- Segment Styling ---------- */
.bigbar .segment {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 8px;
  position: relative;
}

/* Vertical dividers between segments */
.bigbar .segment:not(:last-of-type)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background-color: var(--divider);
}

/* ---------- Label Styling ---------- */
.bigbar .segment label {
  font-size: 0.75rem; /* 12px */
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.125rem; /* 2px */
  text-transform: uppercase;
  letter-spacing: 0.031rem; /* 0.5px */
}

/* ---------- Input & Select Styling ---------- */
.bigbar .segment input:not(.dropdown-search-input),
.bigbar .segment select {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 1rem; /* 16px */
  line-height: 1.3;
  font-family: "Inter", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont,
    sans-serif;
  color: var(--text-main);
  caret-color: var(--pink);
  padding: 0;
}

/* Placeholder styling with transition */
.bigbar .segment input::placeholder,
.bigbar .segment select {
  color: var(--text-muted);
  transition: opacity 300ms ease;
}

/* Fade placeholder when input is focused */
.bigbar .segment input:focus::placeholder {
  opacity: 0.5;
}

/* Hide the original select element */
.bigbar .segment select.hidden {
  display: none;
}

/* ---------- Custom Dropdown Styling ---------- */
.custom-dropdown-container {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 100;
}

/* Selected option display */
.custom-dropdown-selected {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  cursor: pointer;
  padding: 2px 0;
  height: 100%;
  position: relative;
  outline: none;
}

.custom-dropdown-selected:focus {
  outline: none;
}

.custom-dropdown-selected:hover {
  color: var(--pink);
}

.selected-flag {
  display: flex;
  align-items: center;
}

.selected-flag img {
  width: 24px;
  height: 16px;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.selected-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1rem;
}

.select-icon {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--pink);
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.custom-dropdown-selected:focus .select-icon,
.custom-dropdown-selected.active .select-icon {
  transform: translateY(-50%) rotate(180deg);
}

/* Dropdown menu styling */
.custom-dropdown-options {
  position: absolute;
  top: calc(100% + 8px);
  left: -8px;
  width: 220px;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
  max-height: 300px;
  overflow: hidden;
  display: none;
  z-index: 110;
  animation: fadeIn 0.2s ease;
}

.dropdown-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 4px;
}

.dropdown-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
}

.dropdown-search-input:focus {
  outline: none;
  border-color: var(--pink);
}

.dropdown-options-container {
  max-height: 230px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.dropdown-options-container::-webkit-scrollbar {
  width: 6px;
}

.dropdown-options-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.dropdown-options-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.dropdown-options-container::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.dropdown-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.dropdown-option:hover {
  background-color: #f5f5f5;
}

.dropdown-option.selected,
.dropdown-option.selected:hover {
  background-color: rgba(255, 56, 92, 0.08);
  color: var(--pink);
  font-weight: 500;
}

.dropdown-option img {
  width: 24px;
  height: 16px;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Animation for dropdown */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.custom-dropdown-options.active {
  display: block;
}

/* ---------- Search Button Styling ---------- */
.bigbar .search-btn {
  width: 2.5rem; /* 40px */
  height: 2.5rem; /* 40px */
  border-radius: 50%;
  background-color: var(--pink);
  border: none;
  display: grid;
  place-content: center;
  cursor: pointer;
  color: white;
  transition: transform 120ms ease, filter var(--transition-time),
    opacity 0.2s ease;
  flex-shrink: 0;
}

.bigbar .search-btn:hover:not(:disabled) {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.bigbar .search-btn:active:not(:disabled) {
  transform: scale(0.95);
}

/* Disabled button styles */
.bigbar .search-btn:disabled,
.bigbar .search-btn.disabled {
  background-color: #ddd;
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
  filter: grayscale(1);
}

/* Syling from navbar */
.search-btn {
  background-color: #fe424d;
  color: white;
  border-radius: 25px;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-btn:hover:not(:disabled) {
  background-color: #fe424d;
  color: white;
}
.search-btn i {
  display: inline-block;
}
.search-inp {
  border-radius: 25px;
  padding: 0.5rem 3rem 0.5rem 3rem;
}

.navbar-nav.search-container {
  flex: 1;
  display: flex;
  justify-content: center;
  margin: 0 20px;
}

/* On desktop, center the search bar to the true page center (not the leftover
   space between the brand and the right-side links, which is uneven and pulls
   the bar off-center). This lines it up with page-centered content such as the
   flash messages. */
@media (min-width: 768px) {
  .navbar .container-fluid {
    position: relative;
  }
  .navbar-nav.search-container.always-visible {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    flex: 0 0 auto;
    width: min(720px, 48vw);
    z-index: 10;
  }
}

/* ---------- Interactive States ---------- */
/* Elevate effect when focused */
.bigbar:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.bigbar:focus-within {
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
  backdrop-filter: blur(2px);
}

/* Accessibility focus indicators */
.bigbar .segment input:focus-visible,
.bigbar .segment select:focus-visible,
.bigbar .search-btn:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Responsive Styling ---------- */
@media (max-width: 600px) {
  .bigbar {
    height: auto;
    flex-direction: row; /* Keep row direction for simplified layout */
    border-radius: 16px;
    padding: 8px 12px;
    gap: 6px;
    max-width: 100%;
  }

  /* Hide segments with hide-on-small class */
  .bigbar .segment.hide-on-small {
    display: none;
  }

  /* Make the always-visible segment take up available space */
  .bigbar .segment.always-visible {
    flex: 1;
    padding: 0;
  }

  /* Position search button */
  .bigbar .search-btn {
    position: static;
    margin-left: 8px;
    width: 2rem;
    height: 2rem;
  }
}

/* ---------- Accessibility & Motion Preference ---------- */
@media (prefers-reduced-motion: reduce) {
  .bigbar,
  .bigbar .search-btn,
  .bigbar .segment input::placeholder {
    transition: none;
    animation: none;
  }

  .bigbar:focus-within {
    transform: none;
  }

  .bigbar .search-btn:hover,
  .bigbar .search-btn:active {
    transform: none;
  }
}

/* ---------- Animations ---------- */
@keyframes pulse {
  0%,
  100% {
    box-shadow: var(--shadow-default);
  }
  50% {
    box-shadow: var(--shadow-glow);
  }
}
