/* ═══════════════════════════════════════════════════════════
   DESKTOP LAYOUT — Spray Hub
   Loads ON TOP of styles.css + components.css
   Only adds/overrides what's needed for desktop sidebar layout
   ═══════════════════════════════════════════════════════════ */

/* ── HIDE MOBILE ELEMENTS ON DESKTOP ─────────────────────── */
.mobile-only-nav,
.mobile-only-header {
  display: none !important;
}

.app-header {
  display: none !important;
}

/* ── FIXED LEFT SIDEBAR (starts below topbar) ───────────── */
.desktop-sidebar {
  position: fixed;
  top: 44px;
  left: 0;
  width: 240px;
  height: calc(100vh - 44px);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border, #e2e8f0);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] .desktop-sidebar {
  background: rgba(15, 23, 42, 0.95);
  border-right-color: #334155;
}

.sidebar-header {
  padding: 0;
  flex-shrink: 0;
}

[data-theme="dark"] .sidebar-header {
  border-bottom-color: #334155;
}

.sidebar-version {
  display: none;
}

/* ── SIDEBAR NAVIGATION ──────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.sidebar-group-label {
  padding: 16px 16px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-sub, #94a3b8);
  text-transform: uppercase;
}

.sidebar-group-label:first-child {
  padding-top: 8px;
}

/* Collapsible sidebar groups */
.sidebar-collapsible {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: color 0.15s ease;
}
.sidebar-collapsible:hover {
  color: #10b981;
}
.sidebar-chevron {
  font-size: 0.6rem;
  transition: transform 0.2s ease;
  line-height: 1;
}
.sidebar-collapsible.open .sidebar-chevron {
  transform: rotate(90deg);
}
.sidebar-group-items {
  overflow: hidden;
}

.sidebar-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-main, #1e293b);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  gap: 10px;
  border-left: 3px solid transparent;
  font-family: inherit;
  white-space: nowrap;
}

[data-theme="dark"] .sidebar-item {
  color: #e2e8f0;
}

.sidebar-item:hover {
  background: rgba(16, 185, 129, 0.08);
  color: #10b981;
}

[data-theme="dark"] .sidebar-item:hover {
  background: rgba(16, 185, 129, 0.15);
}

.sidebar-item.active {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  font-weight: 600;
  border-left-color: #10b981;
}

[data-theme="dark"] .sidebar-item.active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.sidebar-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-count {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--border, #e2e8f0);
  color: var(--text-sub, #64748b);
  padding: 2px 8px;
  border-radius: 10px;
}

[data-theme="dark"] .sidebar-count {
  background: #334155;
  color: #94a3b8;
}

.sidebar-tool {
  color: var(--text-sub, #64748b);
  font-size: 0.82rem;
}

.sidebar-tool:hover {
  color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
}

/* ── SIDEBAR FOOTER ──────────────────────────────────────── */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
}

[data-theme="dark"] .sidebar-footer {
  border-top-color: #334155;
}

.sidebar-theme-toggle {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: var(--card-bg, #fff);
  color: var(--text-main, #1e293b);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  transition: all 0.15s ease;
  font-family: inherit;
}

[data-theme="dark"] .sidebar-theme-toggle {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

.sidebar-theme-toggle:hover {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.05);
}

.sidebar-stats {
  font-size: 0.68rem;
  color: var(--text-sub, #94a3b8);
  margin-top: 8px;
  text-align: center;
}

/* ── WEBSITE HEADER ──────────────────────────────────────── */
/* ── DESKTOP TOPBAR — full-width header above everything ── */
.desktop-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  background: #16a34a;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1002;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] .desktop-topbar {
  background: #0f172a;
  border-bottom-color: #334155;
}

/* Left: Brand */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo {
  font-size: 1.15rem;
  line-height: 1;
}

.topbar-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
}

.topbar-tagline {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 400;
  margin-left: 6px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
}

/* Right: Stats + theme toggle */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-stats {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.topbar-stat strong {
  color: #fff;
  font-weight: 700;
}

[data-theme="dark"] .topbar-stat strong {
  color: #e2e8f0;
}

[data-theme="dark"] .topbar-stats {
  color: #64748b;
}

.topbar-stat-sep {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.55rem;
  margin: 0 1px;
}

[data-theme="dark"] .topbar-stat-sep {
  color: #475569;
}

.topbar-theme-btn {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

[data-theme="dark"] .topbar-theme-btn {
  background: #1e293b;
  border-color: #334155;
}

.topbar-theme-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

[data-theme="dark"] .topbar-theme-btn:hover {
  background: #334155;
}

/* ── WEBSITE FOOTER — fixed full-width bar ──────────────── */
.desktop-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 38px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border, #e2e8f0);
  z-index: 1001;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] .desktop-footer {
  background: rgba(15, 23, 42, 0.94);
  border-top-color: #334155;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 24px;
  gap: 20px;
}

/* Left: Brand strip */
.footer-brand-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.footer-logo {
  font-size: 0.9rem;
  line-height: 1;
}

.footer-brand-name {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-main, #1e293b);
  white-space: nowrap;
}

[data-theme="dark"] .footer-brand-name {
  color: #f1f5f9;
}

/* Centre: Navigation links */
.footer-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

.footer-nav a {
  font-size: 0.72rem;
  color: var(--text-sub, #64748b);
  text-decoration: none;
  white-space: nowrap;
  padding: 3px 6px;
  border-radius: 4px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.footer-nav a:hover {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
}

[data-theme="dark"] .footer-nav a:hover {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
}

.footer-nav a[target="_blank"] {
  color: var(--text-sub, #94a3b8);
  font-style: italic;
}

.footer-nav a[target="_blank"]:hover {
  color: #0284c7;
  background: rgba(2, 132, 199, 0.08);
}

[data-theme="dark"] .footer-nav a[target="_blank"]:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}

.footer-nav-sep {
  width: 1px;
  height: 14px;
  background: var(--border, #e2e8f0);
  flex-shrink: 0;
  margin: 0 2px;
}

[data-theme="dark"] .footer-nav-sep {
  background: #334155;
}

/* Right: Version & legal */
.footer-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.footer-sep {
  color: var(--text-sub, #94a3b8);
  font-size: 0.68rem;
  opacity: 0.5;
}

.footer-version {
  font-size: 0.68rem;
  color: var(--text-sub, #94a3b8);
  font-weight: 600;
  white-space: nowrap;
}

.footer-copyright {
  font-size: 0.68rem;
  color: var(--text-sub, #94a3b8);
  white-space: nowrap;
}

/* ── FOOTER PAGE PANEL STYLING ──────────────────────────── */
.footer-page-panel {
  max-width: 680px;
  margin: 0 auto;
}

.footer-page-body {
  padding: 8px 0 16px;
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.footer-page-body h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main, #1e293b);
  margin: 20px 0 8px;
}

.footer-page-body h3:first-child {
  margin-top: 4px;
}

[data-theme="dark"] .footer-page-body h3 {
  color: #f1f5f9;
}

.footer-page-body p {
  font-size: 0.85rem;
  color: var(--text-sub, #475569);
  line-height: 1.7;
  margin: 0 0 10px;
}

[data-theme="dark"] .footer-page-body p {
  color: #94a3b8;
}

.footer-page-body a {
  color: #16a34a;
  text-decoration: none;
}

.footer-page-body a:hover {
  text-decoration: underline;
}

.footer-page-body strong {
  color: var(--text-main, #1e293b);
}

[data-theme="dark"] .footer-page-body strong {
  color: #e2e8f0;
}

.contact-info-block {
  background: rgba(22, 163, 74, 0.06);
  border: 1px solid rgba(22, 163, 74, 0.15);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 12px 0 16px;
}

[data-theme="dark"] .contact-info-block {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.2);
}

.contact-info-block p {
  margin: 0 0 6px;
}

.contact-info-block p:last-child {
  margin-bottom: 0;
}

.footer-page-version {
  font-size: 0.78rem !important;
  color: var(--text-sub, #94a3b8) !important;
  font-style: italic;
  margin-top: 20px !important;
  padding-top: 12px;
  border-top: 1px solid var(--border, #e2e8f0);
}

/* ── MAIN CONTENT AREA ───────────────────────────────────── */
.desktop-main {
  margin-left: 240px;
  padding-top: 44px;
  padding-bottom: 44px;
  min-height: 100vh;
}

.desktop-main .main-container {
  max-width: 100%;
  padding: 0;
  margin: 0;
}

.desktop-main .agri-content-area {
  padding: 24px 32px;
}

/* ── DESKTOP SEARCH BAR — side-by-side layout ──────────── */

/* Full-width container with side-by-side panels */
.desktop-search-bar {
  max-width: 100% !important;
  width: 100% !important;
  padding: 16px 20px !important;
  margin: 0 0 10px 0 !important;
  border-radius: 12px;
  display: flex !important;
  flex-wrap: wrap;
  gap: 0;
  align-items: stretch;
}

/* Left panel: search + pills + scope */
.desktop-search-left {
  flex: 1 1 52%;
  min-width: 300px;
  padding-right: 20px;
  display: flex;
  flex-direction: column;
}

/* Right panel: 4 filter fields */
.desktop-search-right {
  flex: 1 1 40%;
  min-width: 320px;
  border-left: 1.5px solid var(--border, #e2e8f0);
  padding-left: 20px;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .desktop-search-right {
  border-left-color: #334155;
}

/* Section labels for both panels */
.desktop-filter-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-sub, #94a3b8);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.desktop-filter-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border, #e2e8f0);
}
.desktop-filter-label span {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-style: italic;
  flex-shrink: 0;
}

/* 2x2 filter grid — vertically centred in right panel */
.desktop-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  flex: 1;
  align-content: center;
}

/* Main search input */
.desktop-search-bar .search-input.premium-search-input {
  padding: 10px 16px 10px 36px !important;
  font-size: 0.9rem;
  border-radius: 8px;
  border-width: 1.5px;
}
.desktop-search-bar .search-input-wrap {
  margin-bottom: 8px;
}
.desktop-search-bar .search-icon-prefix {
  font-size: 0.85rem;
  left: 11px;
}
.desktop-search-bar .search-icon-suffix {
  font-size: 0.72rem;
}
.desktop-search-bar .search-tips-icon svg {
  width: 14px;
  height: 14px;
}

/* Category pills */
.desktop-search-bar .category-pills-row {
  gap: 5px;
  margin-bottom: 6px;
}
.desktop-search-bar .category-pill {
  padding: 3px 10px;
  font-size: 0.72rem;
  border-radius: 12px;
  border-width: 1.5px;
}

/* Scope toggles */
.desktop-search-bar .search-scope-row {
  padding: 4px 0 0;
  gap: 6px;
  font-size: 0.72rem;
  margin-top: auto;
}
.desktop-search-bar .scope-pill {
  font-size: 0.72rem;
  padding: 2px 7px;
}

/* Filter mini inputs */
.desktop-search-bar .premium-search-input--mini {
  padding: 9px 26px 9px 32px !important;
  font-size: 0.84rem !important;
  border-radius: 8px !important;
  border-width: 1.5px;
}
.desktop-search-bar .search-icon-prefix--mini {
  font-size: 0.8rem;
  left: 9px;
}
.desktop-search-bar .search-input-wrap--mini {
  margin-bottom: 0;
}
.desktop-search-bar .filter-clear-btn {
  font-size: 0.68rem;
  right: 3px;
  padding: 1px 3px;
}

/* Active filter bar: spans full width below both panels */
.desktop-search-bar .filter-active-bar {
  flex-basis: 100%;
  padding: 4px 10px;
  font-size: 0.73rem;
  margin-top: 0;
}

/* Search tips popup */
.desktop-search-bar .search-tips-popup {
  font-size: 0.8rem;
}

/* Results header: tighter */
.desktop-main .search-results-header {
  margin-bottom: 8px;
  padding: 0;
}

/* Hide old section labels on desktop */
.desktop-search-bar .filter-section-label {
  display: none !important;
}
.desktop-search-bar .filter-fields-grid {
  display: none !important;
}

/* ── COMPACT ALL OTHER SEARCH CONTAINERS (non-label tabs) ── */

/* All tab search containers: integrated toolbar style */
.desktop-main .premium-search-container:not(.desktop-search-bar) {
  max-width: 100% !important;
  padding: 0 !important;
  margin-bottom: 8px;
  border-radius: 10px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Hide the big title blocks — section name is already in the sidebar */
.desktop-main .premium-search-container:not(.desktop-search-bar) .search-title-block {
  display: none;
}

/* Search input: constrained width, clean look */
.desktop-main .premium-search-container:not(.desktop-search-bar) .search-input-wrap {
  max-width: 520px;
  margin-bottom: 8px;
}
.desktop-main .premium-search-container:not(.desktop-search-bar) .search-input.premium-search-input {
  padding: 8px 16px 8px 36px !important;
  font-size: 0.88rem;
  border-radius: 8px;
  border: 1.5px solid var(--border, #e2e8f0);
  background: var(--card-bg, #fff);
}
[data-theme="dark"] .desktop-main .premium-search-container:not(.desktop-search-bar) .search-input.premium-search-input {
  background: rgba(30, 41, 59, 0.6);
  border-color: #334155;
}
.desktop-main .premium-search-container:not(.desktop-search-bar) .search-icon-prefix {
  font-size: 0.85rem;
  left: 11px;
}
.desktop-main .premium-search-container:not(.desktop-search-bar) .search-icon-suffix {
  font-size: 0.72rem;
}

/* ── Filter sections: single-row toolbar with inline groups ── */
/* Each filter group becomes an inline label + pill row, separated by subtle dividers */
.desktop-main .weed-filter-section,
.desktop-main .pest-filter-section {
  display: inline-flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 6px 0;
  padding-right: 14px;
  margin-right: 10px;
  border-right: 1.5px solid var(--border, #e2e8f0);
  vertical-align: top;
}
/* Remove divider from last filter section */
.desktop-main .weed-filter-section:last-of-type,
.desktop-main .pest-filter-section:last-of-type {
  border-right: none;
  padding-right: 0;
  margin-right: 0;
}
[data-theme="dark"] .desktop-main .weed-filter-section,
[data-theme="dark"] .desktop-main .pest-filter-section {
  border-right-color: #334155;
}

/* Filter labels: inline, compact, act as group headers */
.desktop-main .weed-filter-label,
.desktop-main .pest-filter-label {
  font-size: 0.65rem !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-sub, #94a3b8);
  margin: 0 2px 0 0;
  padding: 0;
  border: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

/* Pill rows: inline flow */
.desktop-main .weed-pill-row,
.desktop-main .pest-pill-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* Pills: small, clean Material-style chips */
.desktop-main .weed-pill,
.desktop-main .pest-pill {
  padding: 3px 10px !important;
  font-size: 0.7rem !important;
  border-radius: 20px;
  border-width: 1.5px;
  font-weight: 500;
  line-height: 1.3;
  transition: all 0.12s ease;
}

/* Result count row: tighter */
.desktop-main .search-meta-row {
  margin-top: 2px !important;
}
.desktop-main .result-count {
  font-size: 0.78rem;
}

/* ── WIKIPEDIA THUMBNAIL IMAGES ─────────────────────────── */
/* Card body: flex row with thumbnail left, details right */
.weed-card-body,
.pest-card-body,
.disease-card-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  overflow: visible;
}

/* Thumbnail wrapper */
.wiki-thumb-wrap {
  flex-shrink: 0;
  width: 90px;
  height: 90px;
  border-radius: 8px;
  overflow: visible;
  background: #f1f5f9;
  border: 1px solid var(--border, #e2e8f0);
  position: relative;
  z-index: 1;
}
[data-theme="dark"] .wiki-thumb-wrap {
  background: #1e293b;
  border-color: #334155;
}

/* The actual image */
.wiki-thumb {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.wiki-thumb:hover {
  transform: scale(2.5);
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  border-radius: 8px;
}

/* Details column takes remaining space */
.weed-card-details,
.pest-card-details,
.disease-card-details {
  flex: 1;
  min-width: 0;
}

/* ── 3-COLUMN RESULT GRIDS ───────────────────────────────── */
.search-results-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 20px !important;
}

.weeds-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 20px !important;
}

.pests-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 20px !important;
}

.diseases-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 20px !important;
}

.apvma-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 20px !important;
}

/* ── SEARCH FILTER LAYOUT ────────────────────────────────── */

.category-pills-row {
  flex-wrap: wrap !important;
  overflow-x: visible !important;
}

/* ── CALCULATOR LAYOUTS ──────────────────────────────────── */
#agri-container,
#agri-cost {
  max-width: 900px;
}

#agri-tank {
  max-width: 900px;
}

#agri-nozzle {
  max-width: 700px;
}

.chem-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
}

/* ── SCROLLBAR STYLING ───────────────────────────────────── */
.desktop-sidebar::-webkit-scrollbar {
  width: 4px;
}

.desktop-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.desktop-sidebar::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 4px;
}

.desktop-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

/* ── ACCESSIBILITY ───────────────────────────────────────── */
.sidebar-item:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: -2px;
}

.sidebar-theme-toggle:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-item,
  .sidebar-theme-toggle {
    transition: none;
  }
}

/* ── RESPONSIVE BREAKPOINTS ──────────────────────────────── */

/* Medium desktop: 2 columns instead of 3 */
@media (max-width: 1400px) and (min-width: 1025px) {
  .search-results-grid,
  .weeds-grid,
  .pests-grid,
  .diseases-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Tablet/small desktop: narrow sidebar */
@media (max-width: 1024px) and (min-width: 769px) {
  .desktop-sidebar {
    width: 200px;
  }

  .desktop-main {
    margin-left: 200px;
  }

  .sidebar-item {
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  .topbar-stats {
    display: none;
  }

  .topbar-tagline {
    display: none;
  }

  .search-results-grid,
  .weeds-grid,
  .pests-grid,
  .diseases-grid,
  .apvma-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .footer-nav a[target="_blank"] {
    display: none;
  }

  .footer-nav-sep:last-of-type {
    display: none;
  }

  .footer-right {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE BOTTOM NAV BAR — Hidden on desktop
   ═══════════════════════════════════════════════════════════ */
.mobile-bottom-nav,
.mobile-footer {
  display: none !important;
}
/* Submenu overlays: hidden via inline style="display:none" in HTML.
   No !important here — JS needs to toggle display with inline styles. */
.mob-submenu-overlay {
  display: none;
}

/* Mobile: hide desktop layout, show mobile nav */
@media (max-width: 768px) {
  .desktop-sidebar,
  .desktop-topbar,
  .desktop-footer {
    display: none !important;
  }

  .desktop-main {
    margin-left: 0;
    padding-top: 0;
    padding-bottom: 80px; /* space for bottom nav */
  }

  /* Hide the old horizontal top nav — bottom nav replaces it */
  .mobile-only-nav {
    display: none !important;
  }

  .mobile-only-header {
    display: block !important;
  }

  .app-header {
    display: block !important;
  }

  .search-results-grid,
  .weeds-grid,
  .pests-grid,
  .diseases-grid,
  .apvma-grid {
    grid-template-columns: 1fr !important;
  }

  /* ══ Search panel: MUST use .desktop-main prefix to beat desktop specificity ══ */
  .desktop-main .premium-search-container,
  .desktop-main .premium-search-container:not(.desktop-search-bar) {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 10px !important;
    padding: 12px 8px !important;
    margin-bottom: 10px !important;
    background: var(--card-bg, #fff) !important;
    border: 1px solid var(--border, #e2e8f0) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06) !important;
    box-sizing: border-box !important;
  }

  .desktop-main .premium-search-container--compact {
    padding: 10px 12px !important;
    margin-bottom: 10px !important;
  }

  /* ══ CRITICAL: Override desktop split-panel layout for mobile ══ */
  .desktop-search-bar {
    flex-direction: column !important;
    padding: 12px 8px !important;
    gap: 8px !important;
  }

  .desktop-search-left {
    flex: 1 1 100% !important;
    min-width: 0 !important;
    width: 100% !important;
    padding-right: 0 !important;
  }

  .desktop-search-right {
    flex: 1 1 100% !important;
    min-width: 0 !important;
    width: 100% !important;
    padding-left: 0 !important;
    border-left: none !important;
  }

  .desktop-filter-label {
    font-size: 0.68rem !important;
    margin-bottom: 4px !important;
  }

  .desktop-filter-grid {
    width: 100% !important;
    gap: 4px !important;
    box-sizing: border-box !important;
  }

  .desktop-filter-grid .search-input-wrap--mini {
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .desktop-search-bar .premium-search-input--mini {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 8px 26px 8px 32px !important;
    font-size: 0.82rem !important;
  }

  /* Tighter search input — beat desktop specificity */
  .desktop-main .premium-search-container .search-input.premium-search-input,
  .desktop-main .premium-search-input {
    font-size: 0.9rem !important;
    padding: 10px 12px 10px 36px !important;
  }

  /* Category pills: smaller on mobile */
  .category-pills-wrap .cat-pill,
  .category-pills-wrap button {
    padding: 6px 10px !important;
    font-size: 0.75rem !important;
  }

  /* Also-search checkboxes: compact */
  .also-search-row {
    gap: 6px !important;
    flex-wrap: wrap;
  }

  /* Filter section labels: tighter */
  .filter-section-label {
    margin-top: 6px !important;
    margin-bottom: 4px !important;
    font-size: 0.68rem !important;
  }

  /* Filter grid: tighter gap, full width */
  .filter-fields-grid {
    gap: 4px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .filter-fields-grid .search-input-wrap--mini {
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .premium-search-input--mini {
    font-size: 0.82rem !important;
    padding: 8px 26px 8px 32px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .search-input-wrap {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .search-input-wrap input,
  .search-input.premium-search-input {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .category-pills-wrap {
    justify-content: center !important;
  }

  .search-scope-row {
    justify-content: center !important;
  }

  /* ── Product cards: full-width, proper padding ── */
  .product-summary-card {
    border-radius: 10px !important;
    padding: 10px 8px !important;
    border-left-width: 4px !important;
  }

  .search-result-card {
    border-radius: 10px !important;
    padding: 12px 8px !important;
  }

  /* ── All cards: prevent text overflow ── */
  .product-summary-card,
  .search-result-card {
    overflow: hidden !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
  }

  /* Identify cards: allow overflow for thumbnail zoom */
  .weed-card,
  .pest-card,
  .disease-card {
    overflow: visible !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
  }

  /* ── Main container: minimal side padding for max card width ── */
  .desktop-main .main-container,
  .main-container {
    padding: 0 2px !important;
    margin: 6px auto !important;
  }

  /* ── Prevent horizontal overflow + tighten side padding ── */
  .desktop-main,
  .agri-content-area {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  .desktop-main .agri-content-area {
    padding: 10px 4px !important;
  }

  /* ── Results count text ── */
  .search-results-count {
    font-size: 0.85rem;
    text-align: center;
    margin: 6px 0;
  }

  /* ── Card grids: proper spacing ── */
  .search-results-grid,
  .weeds-grid,
  .pests-grid,
  .diseases-grid {
    gap: 10px !important;
  }

  /* ── Identify tab card widths ── */
  .weed-card,
  .pest-card,
  .disease-card {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* ── Mobile footer ── */
  .mobile-footer {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 14px 16px 20px;
    font-size: 0.75rem;
    color: var(--text-sub, #64748b);
    text-align: center;
    border-top: 1px solid var(--border, #e2e8f0);
    background: var(--card-bg, #fff);
  }

  [data-theme="dark"] .mobile-footer {
    background: #0f172a;
    border-top-color: #334155;
    color: #94a3b8;
  }

  .mob-footer-sep {
    opacity: 0.5;
  }

  /* ── Mobile bottom nav bar ── */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border, #e2e8f0);
    z-index: 9999;
    justify-content: space-around;
    align-items: center;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
  }

  [data-theme="dark"] .mobile-bottom-nav {
    background: rgba(15, 23, 42, 0.96);
    border-top-color: #334155;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
  }

  .mob-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 10px;
    transition: all 0.15s ease;
    position: relative;
    min-width: 56px;
    -webkit-tap-highlight-color: transparent;
  }

  .mob-nav-icon {
    font-size: 1.3rem;
    line-height: 1;
  }

  .mob-nav-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-sub, #64748b);
    letter-spacing: 0.01em;
  }

  .mob-nav-btn.active .mob-nav-label {
    color: #16a34a;
  }

  .mob-nav-btn.active {
    background: rgba(22, 163, 74, 0.08);
  }

  [data-theme="dark"] .mob-nav-btn.active {
    background: rgba(22, 163, 74, 0.15);
  }

  [data-theme="dark"] .mob-nav-label {
    color: #94a3b8;
  }

  [data-theme="dark"] .mob-nav-btn.active .mob-nav-label {
    color: #4ade80;
  }

  /* ── Submenu overlays (Identify & More) ── */
  .mob-submenu-overlay {
    /* display controlled by JS inline style; default is none */
    position: fixed;
    bottom: 68px;
    left: 12px;
    right: 12px;
    flex-direction: column;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 16px;
    padding: 8px 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  [data-theme="dark"] .mob-submenu-overlay {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
  }

  .mob-submenu-overlay button,
  .mob-submenu-overlay a {
    display: block;
    width: 100%;
    text-align: left;
    padding: 14px 20px;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main, #1e293b);
    cursor: pointer;
    transition: background 0.1s;
    box-sizing: border-box;
  }

  .mob-submenu-overlay button:active,
  .mob-submenu-overlay a:active {
    background: rgba(22, 163, 74, 0.1);
  }

  [data-theme="dark"] .mob-submenu-overlay button,
  [data-theme="dark"] .mob-submenu-overlay a {
    color: #e2e8f0;
  }

  .mob-sub-sep {
    height: 1px;
    background: var(--border, #e2e8f0);
    margin: 4px 16px;
  }

  [data-theme="dark"] .mob-sub-sep {
    background: #334155;
  }

  /* ── Floating compare button: raise above bottom nav ── */
  .fab-compare {
    bottom: 80px !important;
  }

  /* ── Header: compact on mobile ── */
  .app-header {
    padding: 12px 6px !important;
  }

  .app-header .header-content {
    padding: 0;
  }

  .app-header .logo-text p {
    font-size: 0.65rem;
  }

  .app-header .logo-text h1 {
    font-size: 1.2rem;
  }

  .app-header .logo-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    border-radius: 10px;
  }
}
