/**
 * classic-search-dropdown.css
 *
 * Fully standalone styles for the Classic Search ES autocomplete dropdown.
 * All classes are prefixed with `csd-` to avoid any collision with global styles.
 * Zero dependency on global-search-modal__* or any other component's CSS.
 */

/* ============================================================
   SHIMMER ANIMATION
   ============================================================ */
@keyframes csd-shimmer {
  0% {
    background-position: -468px 0;
  }
  100% {
    background-position: 468px 0;
  }
}

/* ============================================================
   INPUT — sits inside the classic search bar pill
   Styles kept here so the external file is the single source of
   truth for all CSD-related visual rules.
   ============================================================ */
.csd-input {
  font-family: "Neue", sans-serif;
  font-weight: 400;
  font-size: 18px;
  line-height: normal;
  letter-spacing: -0.4395px;
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #757575;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.csd-input:focus,
.csd-input:not(:placeholder-shown) {
  color: #ffffff;
  cursor: text;
}

.csd-input::placeholder {
  color: #757575;
}

@media (max-width: 1027px) {
  .csd-input {
    font-size: 16px;
  }
}

/* ============================================================
   DROPDOWN CONTAINER
   Position is relative to the `.search-bar-glow-wrapper` which
   has `position: relative` already set in the page styles.
   ============================================================ */
.csd-dropdown {
  display: none;
  flex-direction: column;
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: 866px;
  max-width: calc(100vw - 32px);
  max-height: 480px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  z-index: 99999;
  overflow: hidden;
  padding-right: 8px !important;
}

.csd-dropdown--visible {
  display: flex !important;
}

/* ============================================================
   SCROLLABLE BODY
   ============================================================ */
.csd-dropdown__body {
  flex: 1;
  overflow-y: auto;
  min-height: 0; /* critical for flex + overflow-y to work */
  padding-bottom: 12px;
}

/* Custom scrollbar — subtle, matches the white card */
.csd-dropdown__body::-webkit-scrollbar {
  width: 8px;
}

.csd-dropdown__body::-webkit-scrollbar-track {
  background: transparent;
  padding: 6px 0;
}

.csd-dropdown__body::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 4px;
}

/* ============================================================
   RESULTS LIST
   ============================================================ */
.csd-dropdown__results {
  display: flex;
  flex-direction: column;
  padding: 8px 0 0;
}

/* ============================================================
   CATEGORY HEADER
   ============================================================ */
.csd-category {
  padding: 20px 24px 8px;
  font-family: "Neue", sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af;
}

/* ============================================================
   RESULT ITEM — shared base for venues, terms, locations
   ============================================================ */
.csd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.1s ease;
  /* Prevent text selection on rapid keyboard nav */
  user-select: none;
}

.csd-item:hover,
.csd-item--active {
  background-color: #f9fafb;
}

.csd-item:focus {
  outline: none;
  background-color: #f9fafb;
}

/* ============================================================
   ITEM — ICON (search / location SVG)
   ============================================================ */
.csd-item__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d1d5db;
}

.csd-item__icon svg {
  width: 20px;
  height: 20px;
}

/* ============================================================
   ITEM — THUMBNAIL (venue image)
   ============================================================ */
.csd-item__thumb {
  flex-shrink: 0;
  width: 72px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  background-color: #f3f4f6;
  display: block;
}

/* ============================================================
   ITEM — AVATAR (letter fallback when no thumbnail)
   ============================================================ */
.csd-item__avatar {
  flex-shrink: 0;
  width: 72px;
  height: 52px;
  border-radius: 6px;
  background-color: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Neue", sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
}

/* ============================================================
   ITEM — TEXT CONTENT WRAPPER
   ============================================================ */
.csd-item__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.csd-item__title-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
  overflow: hidden;
}

/* ============================================================
   ITEM — TITLE
   ============================================================ */
.csd-item__title {
  font-family: "Neue", sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

/* ============================================================
   ITEM — LOCATION (city, country subtitle on venue rows)
   ============================================================ */
.csd-item__location {
  font-family: "Neue", sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  max-width: 200px;
}

/* ============================================================
   ITEM — TAG (property type / hotel stars)
   ============================================================ */
.csd-item__tag {
  font-family: "Neue", sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   ITEM — COUNT BADGE (number of venues in a term / location)
   ============================================================ */
.csd-item__count {
  flex-shrink: 0;
  margin-left: auto;
  padding: 2px 8px;
  background-color: #f3f4f6;
  border-radius: 999px;
  font-family: "Neue", sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
  white-space: nowrap;
}

.csd-item:hover .csd-item__count,
.csd-item--active .csd-item__count {
  background-color: #c8d200;
  color: #1a1a1a;
}

/* ============================================================
   HIGHLIGHT — matching vs non-matching text spans
   ============================================================ */
.csd-match {
  font-weight: 600;
  color: #111827;
}

.csd-suggest {
  font-weight: 400;
  color: #9ca3af;
}

/* ============================================================
   NO RESULTS STATE
   ============================================================ */
.csd-no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 8px;
  color: #6b7280;
  font-family: "Neue", sans-serif;
}

.csd-no-results__icon {
  width: 40px;
  height: 40px;
  color: #d1d5db;
  margin-bottom: 4px;
}

.csd-no-results__text {
  font-size: 15px;
  font-weight: 500;
  color: #374151;
  margin: 0;
}

.csd-no-results__hint {
  font-size: 13px;
  color: #9ca3af;
  margin: 0;
  text-align: center;
}

/* ============================================================
   SKELETON / LOADING STATE
   ============================================================ */
.csd-skeleton {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  animation: csd-shimmer 1.4s linear infinite;
  background: linear-gradient(to right, #f3f4f6 8%, #e9eaeb 18%, #f3f4f6 33%);
  background-size: 936px 100%;
}

.csd-skeleton--thumb {
  flex-shrink: 0;
  width: 72px;
  height: 52px;
  border-radius: 6px;
  background-color: rgba(0, 0, 0, 0.06);
}

.csd-skeleton--icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.06);
}

.csd-skeleton__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.csd-skeleton__line {
  height: 12px;
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.06);
}

.csd-skeleton__line--short {
  width: 55%;
}

.csd-skeleton__line--shorter {
  width: 35%;
}

/* ============================================================
   FOOTER — pinned at bottom of dropdown
   ============================================================ */
.csd-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background-color: #ffffff;
  border-top: 1px solid #E8E8E8;
}

.csd-footer__content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

/* ============================================================
   FOOTER — OVERLAPPING AVATAR GROUP
   ============================================================ */
.csd-footer__avatars {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.csd-footer__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  object-fit: cover;
  display: block;
}

.csd-footer__avatar + .csd-footer__avatar {
  margin-left: -8px;
}

/* ============================================================
   FOOTER — HELP TEXT
   ============================================================ */
.csd-footer__help {
  font-family: "Neue", sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #595959;
  margin: 0;
  margin-left: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   FOOTER — ADVISOR CTA BUTTON
   ============================================================ */
.csd-footer__btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border: 1.5px solid #D9D9D9;
  border-radius: 6px;
  font-family: "Neue", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}

.csd-footer__btn:hover {
  border-color: #B3B3B3;
  color: #111827;
}

/* ============================================================
   RESPONSIVE — small screens
   ============================================================ */
@media (max-width: 640px) {
  .csd-dropdown {
    /* max-height is set dynamically by JS using visualViewport so the
       dropdown never extends behind the software keyboard */
    border-radius: 16px 16px 0 0 !important;
  }

  .csd-footer {
    display: none;
  }

  .csd-item__location {
    max-width: 140px;
  }
}
