/**
 * DGBay Global Header Search
 *
 * Styles for: search icon toggle, expand/collapse animation, dropdown footer,
 * fullscreen overlay, and mobile behaviour. The search bar itself reuses the
 * omni-searchbar-* classes defined in dgbay-omni.css (duplicated here so
 * non-/omni pages also get the styles).
 *
 * @package DGBay
 * @since   1.3.0
 */

/* ================================================================
   Omni-style search bar (copied from dgbay-omni.css so every page
   gets these styles — on /omni both files load, which is harmless)
   ================================================================ */

.omni-searchbar {
  width: 100%;
  position: relative;
}

.omni-searchbar-input::-webkit-search-cancel-button,
.omni-searchbar-input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.omni-searchbar-input[type="search"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.omni-searchbar-form {
  display: flex;
  align-items: stretch;
  background: #fff;
  border: none;
  border-radius: 6px;
  overflow: hidden;
  height: 40px;
  transition: box-shadow 0.1s ease;
}

.omni-searchbar-form:focus-within {
  box-shadow: 0 0 0 2px #0787ea, 0 0 0 3px rgba(7, 135, 234, 0.5);
}

.omni-searchbar-category {
  flex: 0 0 auto;
  max-width: 140px;
  padding: 0 26px 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  background-color: #f3f3f3;
  border: none;
  border-right: 1px solid #cdcdcd;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 6px 0 0 6px;
  font-family: inherit;
}

.omni-searchbar-category:hover {
  background-color: #dadada;
  color: #111;
}

.omni-searchbar-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 12px;
  font-size: 15px;
  outline: none;
  color: #0f1111;
  background: transparent;
  font-family: inherit;
  box-shadow: none !important;
}

.omni-searchbar-input:focus {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

.omni-searchbar-input::placeholder {
  color: #999;
  font-weight: 400;
}

.omni-searchbar-reset {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0 10px;
  cursor: pointer;
  color: #bbb;
  transition: color 0.15s;
}

.omni-searchbar-reset:hover {
  color: #cc0c39;
}

.omni-searchbar-reset svg {
  width: 14px;
  height: 14px;
}

.omni-searchbar-submit {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #febd69;
  border: none;
  padding: 0 16px;
  cursor: pointer;
  color: #333;
  transition: background 0.15s;
}

.omni-searchbar .omni-searchbar-form .omni-searchbar-submit {
  border-radius: 0 !important;
}

.omni-searchbar-submit:hover {
  background: #f3a847;
}

.omni-searchbar-submit svg {
  width: 20px;
  height: 20px;
}

/* Dropdown */
.omni-searchbar-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 10001;
  max-height: 420px;
  overflow-y: auto;
  padding: 6px 0;
}

.omni-searchbar-dropdown.omni-searchbar-dropdown--open {
  display: block;
}

/* Dropdown items */
.omni-dropdown-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s;
  gap: 10px;
}

.omni-dropdown-item:hover {
  background: #f0f6ff;
}

.omni-dropdown-icon {
  flex: 0 0 auto;
  color: #888;
  display: flex;
  align-items: center;
}

.omni-dropdown-text {
  flex: 1;
  font-size: 14px;
  color: #0f1111;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.omni-dropdown-section-label {
  padding: 6px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  border-top: 1px solid #eee;
  margin-top: 2px;
}

.omni-dropdown-section-label:first-child {
  border-top: none;
  margin-top: 0;
}

.omni-dropdown-item--active,
.omni-dropdown-item--active:hover {
  background: #f0f6ff;
}

.omni-dropdown-item--suggestion {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.1s;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.omni-dropdown-item--suggestion:hover {
  background: #f0f6ff;
  text-decoration: none;
  color: inherit;
}

.omni-dropdown-item-image {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  background: #f5f5f5;
}

.omni-dropdown-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.omni-dropdown-item-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.omni-dropdown-item-title {
  font-size: 14px;
  font-weight: 500;
  color: #0f1111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.omni-dropdown-item-title mark {
  background: transparent;
  font-weight: 700;
  color: #0f1111;
}

.omni-dropdown-item-meta {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  margin-top: 1px;
}

.omni-dropdown-item-price {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 600;
  color: #0f1111;
  white-space: nowrap;
}

/* Dropdown footer (search all + expand button) */
.omni-dropdown-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-top: 1px solid #eee;
  gap: 8px;
}

.omni-dropdown-footer-link {
  font-size: 13px;
  color: #0066c0;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.omni-dropdown-footer-link:hover {
  text-decoration: underline;
  color: #c45500;
}

.omni-dropdown-expand-btn {
  margin-left: auto;
  color: #555;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.omni-dropdown-expand-btn:hover {
  background: #f0f0f0;
  color: #0f1111;
  text-decoration: none;
}

/* ================================================================
   Wrapper — sits inline next to the logo
   ================================================================ */

.dgbay-header-search-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
  margin-left: 12px;
  vertical-align: middle;
  z-index: 10000;
}

/* ================================================================
   Search icon (toggle)
   ================================================================ */

.dgbay-header-search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
  flex-shrink: 0;
  color: inherit;
}

.dgbay-header-search-icon:hover {
  background: rgba(0, 0, 0, 0.08);
}

.dgbay-header-search-icon .icon-salient-search {
  font-size: 18px;
  line-height: 1;
  color: inherit;
}

/* Inherit header text colour so icon matches nav links */
header#top .dgbay-header-search-icon {
  color: inherit;
}

/* ================================================================
   Expanding bar animation
   ================================================================ */

.dgbay-header-search-bar {
  width: 0;
  opacity: 0;
  overflow: hidden;
  transition: width 0.3s ease, opacity 0.2s ease;
  white-space: nowrap;
}

.dgbay-hs-open .dgbay-header-search-bar {
  width: 420px;
  opacity: 1;
  overflow: visible;
}

/* ================================================================
   /omni page overrides — always expanded, icon hidden
   ================================================================ */

.dgbay-hs-omni-page .dgbay-header-search-icon {
  display: none;
}

.dgbay-hs-omni-page .dgbay-header-search-bar {
  width: 420px;
  opacity: 1;
  overflow: visible;
}

body.dgbay-omni-active .dgbay-header-search-wrap {
  flex: 1;
  margin: 5px 24px;
}

body.dgbay-omni-active .dgbay-hs-open .dgbay-header-search-bar,
body.dgbay-omni-active .dgbay-hs-omni-page .dgbay-header-search-bar {
  width: 100%;
  max-width: 900px;
}

/* ================================================================
   Fullscreen overlay
   ================================================================ */

.dgbay-hs-fullscreen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0, 0, 0, 0.65);
  justify-content: center;
  align-items: flex-start;
  padding-top: 10vh;
}

.dgbay-hs-fs-visible {
  display: flex;
}

.dgbay-hs-fullscreen-inner {
  width: 90%;
  max-width: 620px;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  position: relative;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.dgbay-hs-fullscreen-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #666;
  line-height: 1;
  padding: 0;
  z-index: 1;
}

.dgbay-hs-fullscreen-close:hover {
  color: #222;
}

/* In fullscreen the searchbar form gets a bigger height */
.dgbay-hs-fs-searchbar .omni-searchbar-form {
  height: 48px;
  border-radius: 8px;
}

.dgbay-hs-fs-searchbar .omni-searchbar-input {
  font-size: 18px;
}

/* Fullscreen dropdown is relative, not absolute */
.dgbay-hs-fs-searchbar .omni-searchbar-dropdown {
  position: relative;
  top: auto;
  border-radius: 0 0 8px 8px;
  margin-top: 0;
  border-top: none;
}

body.dgbay-hs-no-scroll {
  overflow: hidden;
}

/* ================================================================
   Mobile (< 900px)
   ================================================================ */

@media (max-width: 899px) {

  /* Hide expanding inline bar on mobile — icon opens fullscreen */
  .dgbay-header-search-bar {
    display: none !important;
  }

  /* On /omni mobile, show icon so user can open fullscreen */
  .dgbay-hs-omni-page .dgbay-header-search-icon {
    display: inline-flex;
  }

  .dgbay-hs-fullscreen-inner {
    width: 95%;
    max-width: none;
    border-radius: 0 0 12px 12px;
  }

  .dgbay-hs-fullscreen {
    padding-top: 2vh;
  }

  .omni-searchbar-category {
    display: none;
  }
}