/* Match SPA Layout.tsx header (signed-out). Loaded after page <style>; CTA/wine-gear need exceptions. */
html,
body {
  color-scheme: light;
}

.app-header-bar {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 20px !important;
  background: linear-gradient(135deg, var(--bg1, #667eea) 0%, var(--bg2, #764ba2) 100%) !important;
  border-bottom: 1px solid #d1d5db !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  flex-wrap: nowrap !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
  font-family: system-ui, Avenir, Helvetica, Arial, sans-serif !important;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-header-brand {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 700 !important;
  font-size: 18px !important;
  flex-shrink: 0 !important;
  font-family: inherit !important;
}

.app-header-brand img {
  width: 48px !important;
  height: 48px !important;
}

.app-header-menu-toggle {
  display: none;
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  padding: 0 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  height: 40px;
  min-height: 40px;
  min-width: 48px;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  box-sizing: border-box;
}

.app-header-menu {
  display: flex !important;
  flex: 1 1 auto !important;
  align-items: center !important;
  min-width: 0 !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
}

.app-header-nav {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  align-items: center !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  justify-content: flex-start !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.app-header-right {
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
  margin-left: auto !important;
  align-self: center !important;
  height: 48px !important;
  flex-shrink: 0 !important;
}

.app-header-bar .app-header-nav .header-btn,
.app-header-bar .app-header-nav a.header-btn {
  align-self: center !important;
}

/* Default nav buttons only — do not reset CTA or Wine Gear */
.app-header-bar .header-btn:not(.header-cta):not(.header-wine-gear),
.app-header-bar .app-help-toggle {
  margin: 0 !important;
  font: 500 14px/1.5 system-ui, Avenir, Helvetica, Arial, sans-serif !important;
  color: #fff !important;
  background: transparent !important;
  border: none !important;
  padding: 0 14px !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  letter-spacing: normal !important;
  text-decoration: none !important;
  transition: background 0.2s !important;
  box-sizing: border-box !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  font-synthesis: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  vertical-align: middle !important;
}

.app-header-bar .header-btn:not(.header-cta):not(.header-wine-gear):hover,
.app-header-bar .app-help-toggle:hover {
  background: rgba(255, 255, 255, 0.15) !important;
}

/* SPA NavLink Wine Gear (Layout.tsx emphasize + badge) */
.app-header-bar a.header-btn.header-wine-gear,
.app-header-bar button.header-btn.header-wine-gear {
  color: #fff !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  line-height: normal !important;
  font-family: inherit !important;
  background: rgba(250, 204, 21, 0.14) !important;
  border: 1px solid rgba(250, 204, 21, 0.55) !important;
  border-radius: 6px !important;
  padding: 8px 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  text-decoration: none !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  min-height: 48px !important;
}

.app-header-bar a.header-btn.header-wine-gear:hover,
.app-header-bar button.header-btn.header-wine-gear:hover {
  background: rgba(250, 204, 21, 0.2) !important;
}

.app-header-bar .header-badge-new {
  font-size: 9px !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  color: #111827 !important;
  background: #fef08a !important;
  border: 1px solid #facc15 !important;
  border-radius: 999px !important;
  padding: 1px 6px !important;
  line-height: 1.2 !important;
}

/* SPA create-account Link (Layout.tsx) — <a>, not <button> */
.app-header-bar a.header-btn.header-cta {
  color: #8b4513 !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  line-height: normal !important;
  font-family: inherit !important;
  background: linear-gradient(135deg, #ffd700, #ffed4e) !important;
  border: 2px solid rgba(255, 255, 255, 0.9) !important;
  border-radius: 8px !important;
  padding: 8px 14px !important;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4) !important;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3) !important;
  display: inline-flex !important;
  align-items: center !important;
  margin-right: 8px !important;
  text-decoration: none !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  min-height: 48px !important;
}

.app-header-bar a.header-btn.header-cta:hover {
  background: linear-gradient(135deg, #ffed4e, #ffd700) !important;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.6) !important;
}

.app-help-menu {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  height: 48px !important;
}

.app-header-bar .app-help-toggle {
  color: #fff !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  padding: 0 14px !important;
  height: 48px !important;
  border-radius: 6px !important;
  transition: background 0.2s !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
}

.app-help-dropdown {
  display: none !important;
  position: absolute !important;
  top: calc(100% + 4px) !important;
  right: 0 !important;
  min-width: 210px !important;
  background: #fff !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
  z-index: 1002 !important;
  overflow: hidden !important;
  font-family: system-ui, Avenir, Helvetica, Arial, sans-serif !important;
  text-align: left !important;
}

.app-help-menu.open .app-help-dropdown {
  display: block !important;
}

@media (max-width: 1100px) {
  .app-header-menu {
    display: none !important;
    flex-direction: column !important;
    align-items: stretch !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    padding: 12px !important;
    gap: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    margin-left: 0 !important;
    z-index: 1001 !important;
    max-height: min(80vh, calc(100vh - 72px)) !important;
    overflow: auto !important;
  }

  .app-header-menu.mobile-open {
    display: flex !important;
  }

  .app-header-right {
    margin-left: 0 !important;
    height: auto !important;
    flex-wrap: wrap !important;
  }

  .app-header-menu-toggle {
    display: inline-flex !important;
  }
}

html.dw-header-compact .app-header-menu {
  display: none !important;
  flex-direction: column !important;
  align-items: stretch !important;
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: 0 !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  padding: 12px !important;
  gap: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  margin-left: 0 !important;
  z-index: 1001 !important;
  max-height: min(80vh, calc(100vh - 72px)) !important;
  overflow: auto !important;
}

html.dw-header-compact .app-header-menu.mobile-open {
  display: flex !important;
}

html.dw-header-compact .app-header-right {
  margin-left: 0 !important;
  height: auto !important;
  flex-wrap: wrap !important;
}

html.dw-header-compact .app-header-menu-toggle {
  display: inline-flex !important;
}

.app-help-dropdown a,
.app-help-dropdown button {
  display: block !important;
  margin: 0 !important;
  font: 500 14px/1.5 system-ui, Avenir, Helvetica, Arial, sans-serif !important;
  color: #1f2937 !important;
  background: transparent !important;
  border: none !important;
  padding: 10px 16px !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  text-align: left !important;
  width: 100% !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

.app-help-dropdown a:hover,
.app-help-dropdown button:hover {
  background: #f3f4f6 !important;
}

.dw-help-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
  box-sizing: border-box;
}

.dw-help-dialog-panel {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
}

.dw-help-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.dw-help-dialog-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
}

.dw-help-dialog-subtitle {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: #64748b;
}

.dw-help-dialog-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #64748b;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
}

.dw-help-dialog-close:hover {
  color: #0f172a;
}

.dw-help-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dw-help-dialog-empty {
  text-align: center;
  padding: 40px 16px;
  color: #64748b;
}

.dw-help-dialog-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  border-left: 4px solid #3b82f6;
}

.dw-help-dialog-item--instructions {
  background: #fef3c7;
  border-color: #f59e0b;
  border-left-color: #d97706;
}

.dw-help-dialog-item-num {
  background: #3b82f6;
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 2px;
}

.dw-help-dialog-item--instructions .dw-help-dialog-item-num {
  background: #d97706;
}

.dw-help-dialog-item-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
  color: #374151;
}

.dw-help-dialog-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

.dw-help-dialog-got-it {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
}

html { scroll-padding-top: 88px; }
