/**
 * @file
 * Styles for search popup.
 */

/* Hide elements with x-cloak attribute until Alpine.js is loaded */
[x-cloak] {
  display: none !important;
}


/* Hide search submit buttons by default in search region */
.search-region .search-submit-hidden,
.search-region .form-submit,
.search-region .form-actions {
  display: none !important;
}

/* Base styles for search container in search region */
.search-region .search-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-container {
  position: relative;
}

/* Style for search toggle button */
.search-toggle {
  position: relative;
  z-index: 51;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: white;
  border: 1px solid var(--color-border, #e5e7eb);
  color: var(--color-primary, #111827);
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Force centering of Font Awesome icons */
.search-popup button i,
.search-toggle i {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100%;
  height: 100%;
}

.search-popup button i::before,
.search-toggle i::before {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.search-toggle:hover {
  background-color: var(--color-muted, #f3f4f6);
}

/* Style for search popup */
.search-popup {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: start;
  gap: 1rem;
  max-width: 100%;
  /* box-shadow: 0 8px 16px -2px rgba(0, 0, 0, 0.1), 0 4px 8px -2px rgba(0, 0, 0, 0.05); */
  padding-top: 1.6rem;
  padding-bottom: 1.6rem;
  z-index: 80 !important;
  position: fixed !important;
}


/* Make sure the popup is positioned correctly in the header */
.header-right .search-popup,
.search-region .search-popup {
  right: 0;
}

/* Add animation for the search popup */
.search-popup[x-transition\:enter] {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.search-popup[x-transition\:leave] {
  transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}

/* Style for search results */
.search-results-container {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.search-result-item {
  transition: all 0.2s ease;
}

/* .search-result-item:hover {
  transform: translateY(-2px);
} */

/* Style for empty search results */
.search-empty-container {
  padding: 4rem 1rem;
}


/* Style for search overlay */
#search-overlay {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background-color: rgba(0, 0, 0, 0.5) !important;
  z-index: 60 !important;
  opacity: 0;
  margin: 0 !important;
  padding: 0 !important;
}


/* Responsive adjustments */
@media (max-width: 640px) {
  .search-popup {
    position: fixed;
    top: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
  }
  #edit-search-api-fulltext {
    width: 95% !important;
  }
}
