/* ==========================================================================
   DGBay Header & Omni Search — M3 Flow Theme
   Material Design 3 Redesigned Top App Bar
   ========================================================================== */

/* ── Override default header ────────────────────────────────────────────── */
.m3-top-app-bar {
  background-color: var(--md-sys-color-surface);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 72px;
  display: flex;
  align-items: center;
  transition: background-color var(--md-sys-motion-normal), border-color var(--md-sys-motion-normal);
}

.m3-top-app-bar .m3-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1400px;
}

/* ── Header Left: Logo + Search ─────────────────────────────────────────── */
.m3-header-left {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
  max-width: 900px;
}

/* ── Logo ───────────────────────────────────────────────────────────────── */
.m3-site-logo a {
  display: inline-flex;
  align-items: center;
  font-family: var(--md-sys-typescale-display-font);
  font-size: 22px;
  font-weight: 800;
  color: var(--md-sys-color-primary);
  letter-spacing: -0.02em;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
}

.m3-site-logo a:hover {
  text-decoration: none;
}

.m3-site-logo .custom-logo {
  max-height: 36px;
  width: auto;
}

/* ── Omni Search Bar ────────────────────────────────────────────────────── */
.m3-omni-search-wrap {
  flex: 1;
  max-width: 680px;
  position: relative;
}

.m3-omni-searchbar-form {
  display: flex;
  align-items: center;
  background-color: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-full);
  padding: 3px;
  height: 46px;
  width: 100%;
  transition: background-color var(--md-sys-motion-fast), border-color var(--md-sys-motion-fast), box-shadow var(--md-sys-motion-fast);
}

.m3-omni-searchbar-form:focus-within {
  background-color: var(--md-sys-color-surface);
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

.m3-omni-search-icon {
  color: var(--md-sys-color-on-surface-variant);
  padding-left: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

/* Category Selector */
.m3-omni-category-select {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  background-color: transparent;
  border: none;
  outline: none;
  height: 38px;
  padding: 0 24px 0 10px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2374777f'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  max-width: 110px;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-right: 1px solid var(--md-sys-color-outline-variant);
  transition: color var(--md-sys-motion-fast);
}

.m3-omni-category-select:hover {
  color: var(--md-sys-color-primary);
}

/* Search Input */
.m3-omni-search-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  padding: 0 14px;
  font-size: 14px;
  color: var(--md-sys-color-on-surface);
  width: 100%;
  height: 100%;
  box-shadow: none !important;
}

.m3-omni-search-input::placeholder {
  color: var(--md-sys-color-on-surface-variant);
  opacity: 0.65;
}

/* Search Submit Button */
.m3-omni-search-submit {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--md-sys-motion-fast), transform var(--md-sys-motion-fast);
  margin-right: 2px;
  flex-shrink: 0;
}

.m3-omni-search-submit:hover {
  transform: scale(1.04);
}

.m3-omni-search-submit i {
  font-size: 14px;
}

/* ── Search Suggestions Dropdown ────────────────────────────────────────── */
.m3-omni-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background-color: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: var(--md-sys-elevation-3);
  z-index: 2000;
  max-height: 420px;
  overflow-y: auto;
  padding: 12px 0;
}

.m3-omni-dropdown.open {
  display: block;
  animation: m3OmniDropdownIn var(--md-sys-motion-fast) both;
}

@keyframes m3OmniDropdownIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.m3-omni-dropdown-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--md-sys-color-on-surface-variant);
  padding: 8px 18px 4px;
  opacity: 0.8;
}

.m3-omni-dropdown-item {
  display: flex;
  align-items: center;
  padding: 10px 18px;
  cursor: pointer;
  gap: 12px;
  transition: background-color var(--md-sys-motion-fast);
}

.m3-omni-dropdown-item:hover {
  background-color: var(--md-sys-color-surface-container);
}

.m3-omni-dropdown-icon {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 14px;
  display: flex;
  align-items: center;
  width: 18px;
  flex-shrink: 0;
}

.m3-omni-dropdown-text {
  flex: 1;
  font-size: 14px;
  color: var(--md-sys-color-on-surface);
  font-weight: 500;
}

/* ── Header Actions ─────────────────────────────────────────────────────── */
.m3-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.m3-header-action-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--md-sys-shape-corner-full);
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 18px;
  transition: background-color var(--md-sys-motion-fast), color var(--md-sys-motion-fast);
  position: relative;
  text-decoration: none;
}

.m3-header-action-btn:hover {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
}

/* Cart count badge */
.m3-cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: var(--md-sys-shape-corner-full);
  min-width: 16px;
  text-align: center;
}

/* ── Mobile Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .m3-top-app-bar { height: 56px; }

  .m3-top-app-bar .m3-container {
    gap: 12px;
  }

  .m3-site-logo a { font-size: 18px; }

  .m3-omni-category-select { display: none; }

  .m3-omni-searchbar-form { height: 40px; }

  .m3-omni-search-submit { width: 34px; height: 34px; }

  /* Hide nav links on mobile */
  .m3-primary-nav { display: none; }
}
