/*
 * DROPDOWN ARCHITECTURE
 * ====================
 * 
 * CSS Classes (Styling only):
 * - .hotellist-filter-select: Main dropdown styling
 * - .hotellist-filter-select__label: Label/button styling  
 * - .hotellist-filter-select__icon: Arrow icon styling
 * - .hotellist-filter-select__dropdown: Dropdown menu styling
 * - .hotellist-filter-select__dropdown-option: Option item styling
 * 
 * JavaScript Classes (Functionality only):
 * - .js-dropdown-widget: Target for JS event listeners
 * - .js-dropdown-label: Target for JS label updates
 * - .js-dropdown-icon: Target for JS icon animations
 * - .js-dropdown-menu: Target for JS show/hide
 * - .js-dropdown-option: Target for JS option clicks
 * 
 * State Classes (Applied by JS, styled by CSS):
 * - .js-dropdown-widget.open: When dropdown is open
 * - .js-dropdown-option.selected: When option is selected
 */


.hotellist-filters {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  border-radius: 8px;
  border: 1px solid var(--Grey-300, #C9CBCC);
  background: var(--Grey-0, #FFF);
  margin: 0 auto;
  
  /* hotelbox shadow */
  box-shadow: 0px 0px 16px 2px rgba(3, 18, 14, 0.30);
}

.hotellist-filter-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}

.hotellist-filter {
    display: flex;
    padding: 48px;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
}

.hotellist-filter-separator {
  width: 1px;
  height: 90px;
  background: var(--Grey-300, #C9CBCC);
}

.hotellist-filter-select {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  cursor: pointer;
  user-select: none;
  /* Width will be set to exact size by JavaScript based on default text */
}

.hotellist-filter-select__label {
  color: var(--Primary-900, #0C0F12);
  font-family: "GT Eesti Pro Text - medium", sans-serif;
  font-size: 22px;
  font-style: normal;
  line-height: 135%; /* 29.7px */
  /* Prevent text from wrapping and hug content tightly */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Remove flex: 1 to prevent expanding and creating whitespace */
}

.hotellist-filter-select__icon {
  width: 32px;
  height: 32px;
  display: flex;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: rotate(0deg);
}

.hotellist-filter-select__dropdown {
    position: absolute;
    left: 0;
    top: 100%; 
    background: #fff;
    border: 1px solid var(--Grey-300, #C9CBCC);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    z-index: 10;
    /* Wider dropdown to show full option text */
    width: 240px;
    margin-top: 8px;
    /* Animation ready state */
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.hotellist-filter-select__dropdown-option {
    padding: 12px 20px 12px 36px; /* leave space for indicator */
    cursor: pointer;
    font-size: 16px;
    color: #0C0F12;
    position: relative;
    transition: background-color 0.15s ease-in-out;
    /* Allow full text display without cutting off */
    white-space: nowrap;
}

/* Indicator for selected option - now handled by .js-dropdown-option.selected above */

/* Hover and selected states - now handled by .js-dropdown-option above */

.hotellist-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.hotellist-toolbar {
  display: flex;
  width: 100%;
  max-width: 1280px;
  padding: 24px 0px 16px;
  justify-content: space-between;
  align-items: flex-end;
}

.hotellist-toolbar__sorting {
  display: flex;
  align-items: center;
  gap: 32px;
}

.hotellist-toolbar__filter {
  position: relative;
  display: flex;
  padding: 8px 7px 8px 12px;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  border: 1px solid rgba(204, 212, 225, 0.93);
  background: #FFF;
  cursor: pointer;
  /* Fixed width to prevent UI jumping when content changes */
  width: 250px;
}

.hotellist-toolbar__filter-icon {
  width: 24px;
  height: 24px;
  display: flex;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: rotate(0deg);
}

/* Toolbar filter label styling for fixed width behavior */
.hotellist-toolbar__filter .js-dropdown-label {
  /* Prevent text from wrapping and ensure consistent width */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Toolbar filter dropdown - wider to accommodate longer text */
.hotellist-toolbar__filter .hotellist-filter-select__dropdown {
    /* Wider dropdown for toolbar filter with longer text */
    width: 280px;
}

.hotellist-toolbar__search {
  display: flex;
  width: 420px;
  padding: 20px 16px;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px;
  border: 1px solid var(--Grey-300, #C9CBCC);
  background: var(--Grey-0, #FFF);
  color: var(--Primary-700, #46555F);
}

/* JavaScript state classes for dropdown functionality */
/* These classes are added/removed by JavaScript and only affect behavior */

/* Smooth icon rotation animations for dropdown open/close */
.js-dropdown-widget.open .hotellist-filter-select__icon {
  transform: rotate(180deg);
}

.js-dropdown-widget.open .hotellist-toolbar__filter-icon {
  transform: rotate(180deg);
}

/* Dropdown menu slide-in animation */
.js-dropdown-widget.open .hotellist-filter-select__dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.js-dropdown-option.selected::before {
  content: '✔';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--Primary-900, #0C0F12);
  pointer-events: none;
}

.js-dropdown-option.selected,
.js-dropdown-option:hover {
    background: #F3F5F7;
}

/* ========== DYNAMIC FILTER WIDTHS ========== */
/* Widths are calculated dynamically by JavaScript based on content */

/* Keep dropdown menus wider than buttons for full text display */
.hotellist-filter-select__dropdown {
  /* Default minimum width, will be overridden by JS */
  min-width: 180px;
}

@media only screen and (max-width: 1280px) {
  .hotellist-filters {
    justify-content: flex-start;
  }

  .hotellist-filter-row {
    width: 100%;
  }

  .hotellist-filter {
    padding: 32px;
    flex-basis: 49%;
  }

  .tt-hotel-item.tt-fine-hotel {
    gap: 48px;
  }
}

@media only screen and (max-width: 1024px) {
  .bodycopy-1 {
    font-size: 18px;
  }

  .bodycopy-2 {
    font-size: 16px;
  }

  .wrapper {
    padding-left: 5%;
    padding-right: 5%;
  }

  .hotellist-filter-select__label {
    font-size: 20px;
  }

  .hotellist-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .hotellist-toolbar__search {
    width: 100%;
    max-width: 393px;
  }
}



@media only screen and (max-width: 768px) {

  .wrapper {
    padding-left: 5%;
    padding-right: 5%;
  }
    
  .hotellist-filter {
    padding: 12px 24px;
    flex-basis: 100%;
    gap: 8px;
  }

  .hotellist-filter-separator {
    height: 1px;
    width: 100%;
    margin: 0 16px;
  }

  .hotellist-filter:first-child {
    padding-top: 24px;
  }

  .hotellist-filter:last-child {
    padding-bottom: 24px;
  }

  .hotellist-toolbar__sorting {
    width: 100%;
    justify-content: space-between;
  }
  
  .hotellist-toolbar__search {
    padding: 12px 16px;
    max-width: none  ;
  }
  
  .tt-hotel-item {
    flex-direction: column;
  }

  .tt-hotel-item.tt-fine-hotel {
    gap: 32px;
  }

  .tt-hotel-item__name h4 {
    font-size: 24px;
  }

  .tt-hotel-item__location svg {
    width: 18px;
    height: 20px;
  }
 
  .tt-hotel-item__location span {
    font-size: 18px;
    line-height: 20px;
  }

  .tt-hotel-item__descr {
    height: auto;
    margin-bottom: 0;
  }

  .tt-hotel-item__arrow {
    display: none;
  }

  /* Fix dropdown overflow on mobile */
  .hotellist-filter-select__dropdown {
    width: 100vw;
    max-width: calc(100vw - 32px); /* Account for body padding */
    left: auto;
    right: 0;
    margin-top: 8px;
  }

  .hotellist-filter-select__dropdown-option {
    white-space: normal;
    word-wrap: break-word;
  }

}

@media only screen and (max-device-width: 640px) {
  .tt-hotel-item__name h4 {
      font-size: 22px;
  }
}
