/* ============================================================
   AN SuperSearch Booster v1.0 — booster.css
   Adaptive layer on top of AN SuperSearch Pro v3
   agriculturenovel.co
   ============================================================ */

/* ── CRITICAL FIX: Ensure backdrop never swallows pill clicks ─ */
/* The parent plugin puts backdrop at z-index 999990 and pill at 999999.
   This rule makes absolutely sure pill & overlay always sit on top,
   and the backdrop does NOT intercept pointer events on them. */
#anss-pill,
#anss-overlay {
  z-index: 1000001 !important;
  pointer-events: all !important;
}
#anss-backdrop {
  z-index: 1000000 !important;
}
/* When search is NOT open the backdrop must be fully inert */
#anss-backdrop:not(.active) {
  pointer-events: none !important;
  opacity: 0 !important;
}
/* Guarantee body children blur doesn't affect pill/overlay */
body.anss-open > #anss-pill,
body.anss-open > #anss-overlay,
body.anss-open > #anss-backdrop {
  filter: none !important;
}

/* ── PILL CLOSE BUTTON ─────────────────────────────────────── */
#anss-pill-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.08);
  cursor: pointer;
  flex-shrink: 0;
  color: #7a8a94;
  padding: 0;
  margin-left: -2px;
  transition: background 0.18s, color 0.18s, transform 0.2s;
  font-size: 13px;
  line-height: 1;
}
#anss-pill-close:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  transform: scale(1.15) rotate(90deg);
}
#anss-pill-close svg {
  width: 10px;
  height: 10px;
  pointer-events: none;
}

/* ── DRAG HINT BADGE on pill ───────────────────────────────── */
#anss-drag-badge {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 35, 28, 0.82);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 5px 13px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-family: 'DM Sans', -apple-system, sans-serif;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}
#anss-drag-badge::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: rgba(20, 35, 28, 0.82);
}
#anss-drag-badge.visible {
  opacity: 1;
}
.anss-drag-badge-icon {
  animation: anssb-drag-wiggle 0.6s ease infinite alternate;
  display: inline-block;
}
@keyframes anssb-drag-wiggle {
  0%  { transform: translateX(-2px) rotate(-8deg); }
  100%{ transform: translateX(2px)  rotate( 8deg); }
}

/* ── ONBOARDING TOOLTIP (first visit) ─────────────────────── */
#anssb-onboard {
  position: fixed;
  z-index: 1000005;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 28, 22, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(90, 158, 111, 0.3);
  border-radius: 20px;
  padding: 20px 24px;
  max-width: 320px;
  width: calc(100vw - 32px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(90,158,111,0.15);
  color: #fff;
  font-family: 'DM Sans', -apple-system, sans-serif;
  animation: anssb-onboard-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}
@keyframes anssb-onboard-in {
  to { opacity: 1; }
}
#anssb-onboard.hide {
  animation: anssb-onboard-out 0.3s ease forwards;
}
@keyframes anssb-onboard-out {
  to { opacity: 0; transform: translateX(-50%) scale(0.95); }
}
.anssb-ob-emoji { font-size: 28px; margin-bottom: 8px; display: block; }
.anssb-ob-title {
  font-size: 15px; font-weight: 700; margin-bottom: 6px; color: #fff;
}
.anssb-ob-body {
  font-size: 12.5px; color: rgba(255,255,255,0.72); line-height: 1.55; margin-bottom: 14px;
}
.anssb-ob-steps {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px;
}
.anssb-ob-step {
  display: flex; align-items: center; gap: 10px;
  background: rgba(90, 158, 111, 0.12);
  border: 1px solid rgba(90, 158, 111, 0.2);
  border-radius: 10px; padding: 8px 12px;
  font-size: 12px; color: rgba(255,255,255,0.88);
}
.anssb-ob-step-icon {
  font-size: 16px; flex-shrink: 0;
}
.anssb-ob-actions {
  display: flex; gap: 8px;
}
.anssb-ob-cta {
  flex: 1; padding: 10px 16px; border-radius: 100px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  border: none; font-family: 'DM Sans', -apple-system, sans-serif;
  transition: all 0.2s;
}
.anssb-ob-cta.primary {
  background: #5a9e6f; color: #fff;
}
.anssb-ob-cta.primary:hover { filter: brightness(1.1); }
.anssb-ob-cta.secondary {
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.7);
}
.anssb-ob-cta.secondary:hover { background: rgba(255,255,255,0.14); }
.anssb-ob-close {
  position: absolute; top: 12px; right: 12px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: none;
  cursor: pointer; color: rgba(255,255,255,0.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all 0.15s;
}
.anssb-ob-close:hover { background: rgba(239,68,68,0.2); color: #ef4444; }

/* ── ECOSYSTEM HUB ─────────────────────────────────────────── */
#anssb-hub {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 1000002;
  font-family: 'DM Sans', -apple-system, sans-serif;
}

/* Hub trigger button */
#anssb-hub-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5a9e6f, #3d7a52);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(90, 158, 111, 0.45), 0 2px 8px rgba(0,0,0,0.15);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 2;
  color: #fff;
  font-size: 20px;
}
#anssb-hub-btn:hover {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: 0 8px 28px rgba(90, 158, 111, 0.55);
}
#anssb-hub-btn.open {
  transform: scale(1.05) rotate(45deg);
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 8px 28px rgba(239, 68, 68, 0.45);
}
#anssb-hub-btn .hub-icon { transition: transform 0.3s; display: flex; align-items: center; justify-content: center; }
.hub-pulse-ring {
  position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid rgba(90, 158, 111, 0.5);
  animation: anssb-pulse-ring 2s ease infinite;
  pointer-events: none;
}
@keyframes anssb-pulse-ring {
  0%   { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.5); opacity: 0; }
}
#anssb-hub-btn.open .hub-pulse-ring { display: none; }

/* Hub tooltip label */
#anssb-hub-label {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 28, 22, 0.88);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  border: 1px solid rgba(90,158,111,0.2);
}
#anssb-hub-btn:hover #anssb-hub-label { opacity: 1; }

/* Hub panel */
#anssb-hub-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 280px;
  background: rgba(10, 22, 16, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(90, 158, 111, 0.25);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  opacity: 0;
  transform: scale(0.9) translateY(10px);
  transform-origin: bottom right;
  transition: opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
#anssb-hub-panel.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

.hub-panel-header {
  padding: 16px 18px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex; align-items: center; gap: 10px;
}
.hub-panel-logo { font-size: 20px; }
.hub-panel-title { font-size: 13px; font-weight: 700; color: #fff; }
.hub-panel-sub   { font-size: 10.5px; color: rgba(255,255,255,0.45); margin-top: 1px; }

.hub-section-title {
  font-size: 9.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: rgba(255,255,255,0.35);
  padding: 12px 18px 5px;
}

/* Category grid */
.hub-cats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; padding: 0 14px 10px;
}
.hub-cat-link {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  text-decoration: none; color: rgba(255,255,255,0.82);
  font-size: 11.5px; font-weight: 500;
  transition: all 0.18s; cursor: pointer;
}
.hub-cat-link:hover {
  background: rgba(90,158,111,0.15);
  border-color: rgba(90,158,111,0.3);
  color: #fff;
  transform: translateY(-1px);
}
.hub-cat-count {
  margin-left: auto; font-size: 9.5px;
  color: rgba(255,255,255,0.3); font-weight: 600;
}

/* Search inside hub */
.hub-search-row {
  padding: 0 14px 10px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.04);
  margin: 0 14px 10px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  cursor: pointer; transition: all 0.18s;
}
.hub-search-row:hover {
  background: rgba(90,158,111,0.12);
  border-color: rgba(90,158,111,0.25);
}
.hub-search-row { padding: 10px 14px; margin: 0 14px 10px; }
.hub-search-icon { color: rgba(255,255,255,0.4); flex-shrink: 0; font-size: 14px; }
.hub-search-text { font-size: 12px; color: rgba(255,255,255,0.5); }
.hub-search-kbd  { margin-left: auto; font-size: 10px; color: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.15); padding: 2px 6px; border-radius: 5px; }

/* Quick ecosystem links */
.hub-links {
  display: flex; flex-direction: column; gap: 1px;
  padding: 0 14px 14px;
}
.hub-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  text-decoration: none; color: rgba(255,255,255,0.75);
  font-size: 12.5px; font-weight: 500;
  transition: all 0.15s;
}
.hub-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.hub-link-icon { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }
.hub-link-arrow { margin-left: auto; color: rgba(255,255,255,0.2); font-size: 11px; }

/* Stats row */
.hub-stats {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 1px; background: rgba(255,255,255,0.06);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.hub-stat {
  padding: 10px 8px; text-align: center;
  background: rgba(10, 22, 16, 0.95);
}
.hub-stat-num { font-size: 14px; font-weight: 700; color: #5a9e6f; }
.hub-stat-lbl { font-size: 9.5px; color: rgba(255,255,255,0.35); margin-top: 1px; }

/* ── ADAPTIVE POSITION INDICATOR ──────────────────────────── */
/* Shows which screen zone the pill is currently in */
#anssb-zone-flash {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(90,158,111,0.9);
  color: #fff;
  font-family: 'DM Sans', -apple-system, sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 30px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 1000010;
  letter-spacing: 0.04em;
}
#anssb-zone-flash.show { opacity: 1; }

/* ── MOBILE: hub moves to bottom-left on narrow screens ─────── */
@media (max-width: 480px) {
  #anssb-hub {
    bottom: 20px;
    right: 16px;
  }
  #anssb-hub-panel {
    width: calc(100vw - 32px);
    right: auto;
    left: 50%;
    transform: translateX(-50%) scale(0.9) translateY(10px);
    transform-origin: bottom center;
  }
  #anssb-hub-panel.open {
    transform: translateX(-50%) scale(1) translateY(0);
  }
  #anssb-onboard {
    bottom: 20px;
    left: 16px;
    right: 16px;
    transform: none;
    max-width: none;
  }
  #anssb-onboard.hide {
    transform: scale(0.95);
  }
}
