/**
 * @file
 * ERC Search Modal styles.
 *
 * Styling for the search button trigger and modal dialog.
 */

.block-erc-search-modal {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Container */
.erc-search-modal {
  margin-left: 2rem;
}

/* ============================================
   Trigger Button
   ============================================ */
.erc-search-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.erc-search-trigger:hover {
  transform: scale(1.05);
}

.erc-search-trigger:focus {
  outline: 2px solid #010612;
  outline-offset: 2px;
}

.erc-search-trigger__icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.erc-search-trigger__icon-default,
.erc-search-trigger__icon-hover {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
}

.erc-search-trigger__icon-default {
  opacity: 1;
}

.erc-search-trigger__icon-hover {
  opacity: 0;
}

/* Show hover icon on hover or when modal is open */
.erc-search-trigger:hover .erc-search-trigger__icon-default,
.erc-search-modal.is-open .erc-search-trigger__icon-default {
  opacity: 0;
}

.erc-search-trigger:hover .erc-search-trigger__icon-hover,
.erc-search-modal.is-open .erc-search-trigger__icon-hover {
  opacity: 1;
}

.erc-search-trigger__icon svg {
  display: block;
}

/* ============================================
   Modal Overlay
   ============================================ */
.erc-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 1rem 1rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.erc-search-modal.is-open .erc-search-overlay {
  opacity: 1;
  visibility: visible;
}

/* ============================================
   Modal Dialog
   ============================================ */
.erc-search-dialog {
  position: relative;
  width: 100%;
  max-width: 600px;
  padding: 2rem;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transform: translateY(-1rem);
  transition: transform 0.2s ease;
}

.erc-search-modal.is-open .erc-search-dialog {
  transform: translateY(0);
}

/* Close button */
.erc-search-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #666;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.erc-search-close:hover {
  background: #f0f0f0;
  color: #333;
}

.erc-search-close:focus {
  outline: 2px solid #010612;
  outline-offset: 2px;
}

/* ============================================
   Search Form
   ============================================ */
.erc-search-form {
  margin-top: 0.5rem;
}

.erc-search-form__wrapper {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
}

.erc-search-input {
  flex: 1;
  height: 52px;
  padding: 0 1.25rem;
  font-size: 1rem;
  font-family: inherit;
  color: #333;
  background: #f5f5f5;
  border: 2px solid transparent;
  border-radius: 26px;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.erc-search-input::placeholder {
  color: #888;
}

.erc-search-input:focus {
  border-color: #010612;
  background: #fff;
}

.erc-search-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: #010612;
  border: none;
  border-radius: 26px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.erc-search-submit:hover {
  background: #333;
}

.erc-search-submit:focus {
  outline: 2px solid #010612;
  outline-offset: 2px;
}

.erc-search-submit:active {
  transform: scale(0.98);
}

.erc-search-submit__icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hide text on small screens, show icon only */
@media (max-width: 480px) {
  .erc-search-submit__text {
    position: absolute;
    clip: rect(1px, 1px, 1px, 1px);
    overflow: hidden;
    height: 1px;
    width: 1px;
  }

  .erc-search-submit {
    width: 52px;
    padding: 0;
  }
}

/* ============================================
   Accessibility
   ============================================ */
.visually-hidden {
  position: absolute !important;
  clip: rect(1px, 1px, 1px, 1px);
  overflow: hidden;
  height: 1px !important;
  width: 1px !important;
  word-wrap: normal;
}

/* Prevent body scroll when modal is open */
body.erc-search-modal-open {
  overflow: hidden;
}
