/**
 * Search Page Styles
 * XenServer HCL - Unified Search & Filter
 */

/* ===== Global ===== */
.search-page button {
  font-family: inherit;
}

/* ===== Layout Overrides ===== */
.search-page-wrapper .app-card.app-main {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
}

.search-page-wrapper .app-body {
  padding: 0;
}

.search-page-wrapper .app-container {
  max-width: 100%;
  width: 100%;
  padding: 0;
}

.search-page {
  display: flex;
  min-height: calc(100vh - 60px);
}

.filters-overlay {
  display: none;
}

.filters-toggle-btn {
  display: none;
}

.mobile-filters-row {
  display: none;
}

.mobile-filters-btn {
  display: none;
}

.filters-drawer-header {
  display: none;
}

/* ===== Filter Bar (Left Sidebar) ===== */
.filter-bar {
  background: #fff;
  border-right: 1px solid #e1e1e1;
  width: 380px;
  min-width: 380px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.filter-bar-top {
  padding: 24px;
  border-bottom: 1px solid #a4abb1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-bar-top.no-border {
  border-bottom: none;
  padding-bottom: 0;
}

.filter-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f1f1f1;
  border-radius: 40px;
  padding: 8px 16px;
  height: 32px;
}

.filter-search img {
  width: 16px;
  height: 16px;
  cursor: pointer;
  opacity: 0.8;
}

.filter-search img:hover {
  opacity: 1;
}

.filter-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: #121213;
}

.filter-search input::placeholder {
  color: #767676;
}

.filter-search-clear {
  width: 16px;
  height: 16px;
  cursor: pointer;
  color: #767676;
  flex-shrink: 0;
  transition: color 0.15s;
}

.filter-search-clear:hover {
  color: #121213;
}

.filter-search-clear.hidden {
  display: none;
}

/* Clear All Filters Button */
.filter-clear-all-btn {
  position: fixed;
  bottom: 16px;
  left: 24px;
  width: calc(380px - 48px);
  z-index: 100;
  border: none;
  border-radius: 4px;
  background: #005dd0;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 12px;
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0px 1px 8px rgba(0, 0, 0, 0.24);
}

.filter-clear-all-btn:hover {
  background: #0050b3;
}

/* Component Type Section */
.component-type-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.component-type-title {
  font-size: 14px;
  font-weight: 700;
  color: #121213;
  margin: 0;
}

.component-type-list {
  display: flex;
  flex-direction: column;
}

.component-type-item {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: #005dd0;
  transition: background 0.2s;
}

.component-type-item:hover,
.component-type-item.active {
  background: #f1f1f1;
  text-decoration: none;
  color: #005dd0;
}

.filter-bar-filters {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  padding-bottom: 68px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ===== Search Content (Main Area) ===== */
.search-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ===== Results Header ===== */
.results-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 24px 24px 40px;
  background: #fff;
  border-bottom: 1px solid #e1e1e1;
  position: sticky;
  top: 0;
  z-index: 10;
}

.results-header-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-header-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: #121213;
  margin: 0;
}

.results-header-title .results-count {
  font-size: 16px;
  font-weight: 400;
  color: #686c7c;
}

/* Custom Dropdown */
.custom-dropdown {
  position: relative;
}

.custom-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 24px;
  background: #f1f1f1;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 16px;
  height: 40px;
  cursor: pointer;
  font-size: 14px;
  color: #121213;
  transition: border-color 0.2s;
}

.custom-dropdown-trigger:hover {
  background: #e8e8e8;
}

.custom-dropdown.open .custom-dropdown-trigger {
  border-color: #005dd0;
}

.custom-dropdown-value {
  white-space: nowrap;
}

.custom-dropdown-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
}

.custom-dropdown.open .custom-dropdown-icon {
  transform: rotate(180deg);
}

.custom-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0px 1px 16px rgba(0, 0, 0, 0.24);
  padding: 8px 0;
  z-index: 100;
  overflow: hidden;
}

.custom-dropdown.open .custom-dropdown-menu {
  display: block;
}

.custom-dropdown-item {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 400;
  color: #121213;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.custom-dropdown-item:hover {
  background: #f5f5f5;
}

.custom-dropdown-item.selected {
  background: #f1f1f1;
  font-weight: 600;
}

/* Pagination */
.results-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s;
}

.page-btn:hover { background: #f1f1f1; }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.page-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #121213;
}

.page-input {
  width: 60px;
  height: 40px;
  background: #f1f1f1;
  border: none;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  color: #121213;
}

/* ===== Results Note Banner ===== */
.results-note {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: rgba(0, 93, 208, 0.1);
  border-radius: 8px;
  padding: 8px 16px;
  margin: 24px 40px 0;
}

.results-note-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 4px;
}

.results-note p {
  font-size: 14px;
  font-weight: 400;
  line-height: 24px;
  color: #222;
  margin: 0;
}

/* ===== Results Views ===== */
.results-list {
  display: flex;
  padding: 24px 40px;
}

/* ===== Empty State ===== */
.results-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  text-align: center;
}

.results-empty img {
  width: 220px;
  height: auto;
  margin-bottom: 48px;
}

.results-empty h3 {
  font-size: 14px;
  font-weight: 600;
  color: #171717;
}

.results-empty a {
  color: #005dd0;
  font-size: 14px;
}

/* ===== Filter Dropdowns ===== */
.filter-dropdown {
  border-bottom: 1px solid #e1e1e1;
  padding-bottom: 16px;
}

.filter-dropdown:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.filter-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 8px 0;
  user-select: none;
}

.filter-dropdown-title {
  font-size: 14px;
  font-weight: 700;
  color: #121213;
}

.filter-dropdown-icon {
  width: 12px;
  height: 12px;
  transition: transform 0.2s ease;
}

.filter-dropdown.collapsed .filter-dropdown-icon {
  transform: rotate(-90deg);
}

.filter-dropdown-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 208px;
  overflow-y: auto;
  margin-top: 8px;
  padding-right: 4px;
}

.filter-dropdown.collapsed .filter-dropdown-content {
  display: none;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
  margin: 0;
  font-weight: normal;
}

.filter-option:hover {
  background: #f1f1f1;
}

.filter-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 1.5px solid #005dd0;
  border-radius: 3px;
  background: #fff;
  flex-shrink: 0;
}

.filter-option input[type="checkbox"]:checked {
  background: #005dd0;
  background-image: url('/static/icons/check.svg');
  background-size: 10px;
  background-position: center;
  background-repeat: no-repeat;
}

.filter-option-label {
  font-size: 14px;
  color: #121213;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Scrollbar styling for filter content */
.filter-dropdown-content::-webkit-scrollbar {
  width: 6px;
}

.filter-dropdown-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.filter-dropdown-content::-webkit-scrollbar-thumb {
  background: #a4abb1;
  border-radius: 3px;
}

.filter-dropdown-content::-webkit-scrollbar-thumb:hover {
  background: #686c7c;
}

@media (max-width: 768px) {
  .mobile-filters-row {
    display: block;
    padding: 16px;
    background: #fff;
    border-bottom: 1px solid #e1e1e1;
  }

  .mobile-filters-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #005dd0;
    background: #fff;
    color: #005dd0;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
  }

  .mobile-filters-btn:hover {
    background: rgba(0, 93, 208, 0.08);
  }

  .filters-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    z-index: 200;
  }

  html.filters-open .filters-overlay {
    display: block;
  }

  .filter-bar {
    position: fixed;
    top: 60px;
    left: 0;
    height: calc(100vh - 60px);
    width: 100vw;
    min-width: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 210;
    border-right: 1px solid #e1e1e1;
    border-bottom: none;
  }

  .filters-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #e1e1e1;
  }

  .filters-drawer-title {
    font-size: 20px;
    font-weight: 700;
    color: #121213;
  }

  .filters-drawer-close {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 40px;
    cursor: pointer;
    color: #121213;
  }

  html.filters-open .filter-bar {
    transform: translateX(0);
  }

  .filter-clear-all-btn {
    position: sticky;
    bottom: 0;
    left: auto;
    width: auto;
    margin-top: 0;
  }

  .results-header {
    padding: 16px;
  }

  .results-pagination {
    display: none;
  }

  .results-note {
    margin: 16px;
  }

  .results-list {
    padding: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .version-col {
    display: none !important;
  }

  #per-page-dropdown {
    display: none !important;
  }

  .results-count {
    display: none !important;
  }

  .filter-clear-all-btn {
    display: none !important;
  }

  .mobile-filter-reset-row {
    position: sticky;
    bottom: 0;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e1e1e1;
    z-index: 5;
  }

  .mobile-filter-reset-btn {
    width: 100%;
    height: 44px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #005dd0;
    background: #005dd0;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
  }

  .mobile-bottom-pager {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #e1e1e1;
    z-index: 20;
  }

  .mobile-bottom-pager .pager-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: #f1f1f1;
    cursor: pointer;
  }

  .mobile-bottom-pager .pager-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .mobile-bottom-pager .pager-range {
    flex: 1;
    text-align: center;
    font-size: 14px;
    color: #121213;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .table-header-cell,
  .table-cell {
    min-width: 0;
  }

  .cpu-family-col {
    flex: 0 0 110px;
    max-width: 110px;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-clear-filters-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px 12px;
    background: #fff;
    border-bottom: 1px solid #e1e1e1;
  }

  .mobile-clear-filters-applied {
    font-size: 14px;
    font-weight: 700;
    color: #121213;
    white-space: nowrap;
  }

  .mobile-clear-filters-link {
    border: none;
    background: transparent;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    color: #005dd0;
    cursor: pointer;
  }
}
