/* File: assets/css/silvagrid.css */

/* =========================================
   1. Typography & Variables
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-main: #F4F5F7;
  --bg-sidebar: #F8F7F2;
  --card-surface: #FFFFFF;
  
  --text-main: #1F2937;
  --text-muted: #6B7280;
  
  --brand-900: #063C38;
  --brand-800: #0A4A45;
  --brand-accent: #1FB6AD;
  --accent-action: #C75252; 

  --climate-tropical: #1B7A43; /* Rich Jungle Green */
  --climate-subtropical: #5A9334; /* Warm Mid-Green */
  --climate-temperate: #B9770E; /* Autumnal Golden-Brown */
  --climate-arid: #C75B30; /* Terracotta / Desert Red */
  --climate-cold: #2874A6; /* Crisp Winter Blue */

  --border-subtle: #E5E7EB;
  --border-focus: rgba(31, 182, 173, 0.4);
  
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.02), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 10px 25px rgba(0,0,0,0.05), 0 4px 10px rgba(0,0,0,0.03);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: var(--text-main);
  background: var(--bg-main);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =========================================
   2. 2-Tier Navbar
   ========================================= */
/* Changed background to match the sidebar/app feel rather than harsh white */
.sg-navbar-top { background: var(--bg-sidebar); border-bottom: 1px solid var(--border-subtle); }
.sg-navbar-top-inner { max-width: 1240px; margin: 0 auto; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sg-brand { display: flex; align-items: center; gap: 16px; }
.sg-logo { width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; background: transparent;}
.sg-logo img { width: 100%; height: 100%; object-fit: contain; }
.sg-wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.sg-wordmark a { color: var(--brand-900); text-decoration: none; }
.sg-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.sg-subtitle { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.sg-top-links { display: flex; gap: 24px; font-size: 14px; font-weight: 600; }
.sg-top-links a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.sg-top-links a:hover { color: var(--brand-900); }

/* Added the 4px teal border to match the footer and frame the app */
.sg-navbar-bottom { background: var(--brand-900); color: #fff; box-shadow: 0 4px 12px rgba(6, 60, 56, 0.15); position: sticky; top: 0; z-index: 2000; border-bottom: 4px solid var(--brand-accent); }
.sg-navbar-bottom-inner { max-width: 1240px; margin: 0 auto; padding: 0 18px; display: flex; align-items: center; }
.sg-bottom-links { display: flex; align-items: center; list-style: none; margin: 0; padding: 0;}
.sg-bottom-links > li > a, .sg-bottom-links > li > button { display: block; padding: 16px 20px; color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; font-family: inherit; background: transparent; border: none; cursor: pointer; transition: background 0.2s; }
.sg-bottom-links > li > a:hover, .sg-bottom-links > li > button:hover { background: rgba(255,255,255,0.1); }

/* FIXED: CTA Button styling instead of an active tab */
.sg-bottom-links > li > a.sg-nav-btn {
    background: var(--accent-action);
    border-radius: 30px;
    padding: 8px 24px;
    margin-left: 10px;
    border: 2px solid var(--accent-action);
    box-shadow: 0 2px 4px rgba(199, 82, 82, 0.3);
}
.sg-bottom-links > li > a.sg-nav-btn:hover {
    background: #A94343; border-color: #A94343; box-shadow: 0 4px 8px rgba(199, 82, 82, 0.4);
}

/* =========================================
   3. Dynamic Layouts
   ========================================= */
/* Update the top padding to 50px for more breathing room under the navbar */
.sg-container { max-width: 1240px; margin: 0 auto; padding: 50px 18px 40px; width: 100%; flex-grow: 1; }

.sg-card { background: var(--card-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 24px; }
.search-panel { background: var(--bg-sidebar); border: 1px solid rgba(0,0,0,0.03); }

.layout-sidebar { display: flex; gap: 30px; align-items: flex-start; }

/* FIX: Independent scrolling for the sidebar */
.layout-sidebar .search-panel { 
    width: 360px; /* Widened slightly for better input breathing room */
    flex-shrink: 0; 
    position: sticky; 
    top: 90px; 
    max-height: calc(100vh - 110px); /* Fits exactly in the window */
    overflow-y: auto; /* Adds the independent scrollbar */
    scrollbar-width: thin; 
    scrollbar-color: var(--border-subtle) transparent;
}
/* Custom webkit scrollbar to keep the sidebar looking clean */
.layout-sidebar .search-panel::-webkit-scrollbar { width: 6px; }
.layout-sidebar .search-panel::-webkit-scrollbar-thumb { background-color: var(--border-subtle); border-radius: 4px; }

/* NEW: Ensure the results panel remains hidden on the initial landing page */
.results-panel { display: none; }

.layout-sidebar .results-panel { 
    flex-grow: 1;
    display: block; 
    min-height: 100vh; 
    min-width: 0; /* CRITICAL: Prevents Flexbox Blowout */
}
.layout-sidebar .hero-seo-panel { display: none; }

/* REVERTED: Let the columns flow naturally to prevent massive whitespace gaps */
.layout-hero { display: grid; grid-template-columns: 1.65fr 1fr; gap: 40px; align-items: start; margin-bottom: 60px; }

/* Keep the generous 45px padding, but remove the flex-stretching */
.layout-hero .search-panel { 
    width: 100%; 
    padding: 45px; 
    display: block; 
    /* NEW: Sticky Behavior */
    position: sticky; 
    top: 90px; /* Parks it perfectly below your navbar */
    max-height: calc(100vh - 110px); /* Ensures it fits on smaller laptop screens */
    overflow-y: auto; /* Allows internal scrolling just in case the form is taller than the screen */
    scrollbar-width: thin;
    scrollbar-color: var(--border-subtle) transparent;
}
.layout-hero .search-panel form { display: block; }

/* Clean scrollbar styling for the sticky hero panel */
.layout-hero .search-panel::-webkit-scrollbar { width: 6px; }
.layout-hero .search-panel::-webkit-scrollbar-thumb { background-color: var(--border-subtle); border-radius: 4px; }

/* (The previous margin-top: auto magic trick has been intentionally removed) */

/* Expanded gaps and margins to stretch the form height to match the right column */
.layout-hero .text-search-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.layout-hero .sg-section-title { margin-bottom: 22px; }
.layout-hero .hr { margin: 30px 0; }

/* Hero Layout uses 5 columns to perfectly align all square buttons vertically */
.layout-hero .icon-grid, 
.layout-hero .climate-grid, 
.layout-hero .role-grid { 
    grid-template-columns: repeat(5, 1fr); 
    gap: 15px; 
    margin-bottom: 30px;
}

/* Note: By using a 5-column track, the 3 Role items will perfectly match the width 
   of the Plant Type items above them, leaving 2 blank column spaces on the right. */
.layout-hero .wgsrpd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.hero-seo-panel { padding: 20px 0; }
.seo-h1 { font-size: 3rem; font-weight: 800; color: var(--brand-900); line-height: 1.1; margin-top: 0; margin-bottom: 20px; }
.seo-lead { font-size: 1.25rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 40px; }

/* SEO Text Feature Cards */
.seo-feature-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

.seo-feature-card { 
    display: grid;
    grid-template-columns: 48px 1fr;
    grid-template-rows: auto 1fr;
    column-gap: 16px;
    row-gap: 4px;
    background: #fff; padding: 20px; border-radius: var(--radius-md); 
    border: 1px solid var(--border-subtle); box-shadow: var(--shadow-sm); 
    transition: all 0.2s ease;
}
.seo-feature-card:hover { border-color: var(--brand-accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }

.seo-icon-wrapper { 
    grid-column: 1;
    grid-row: 1 / span 2;
    display: inline-flex; align-items: center; justify-content: center; 
    width: 48px; height: 48px; background: #F0FBFA; color: var(--brand-accent); 
    border-radius: 12px; margin-bottom: 0; 
}
.seo-icon-wrapper svg { width: 24px; height: 24px; stroke-width: 2px; }

.seo-feature-card h3 { 
    grid-column: 2; grid-row: 1; 
    margin: 0; color: var(--brand-900); font-size: 1.1rem; font-weight: 800; align-self: end; 
}
.seo-feature-card p { 
    grid-column: 2; grid-row: 2; 
    margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; align-self: start; 
}

/* Featured Hubs Grid */
.featured-hubs-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 10px; }
.hub-card { 
    position: relative; display: flex; align-items: center; padding: 16px; 
    background: #fff; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); 
    text-decoration: none; color: var(--text-main); overflow: hidden; 
    box-shadow: var(--shadow-sm); transition: all 0.2s ease; 
}
.hub-card:hover { 
    border-color: var(--brand-accent); box-shadow: var(--shadow-md); transform: translateY(-2px); 
}
.hub-card-bg { 
    position: absolute; left: 0; top: 0; bottom: 0; width: 6px; opacity: 0.8; transition: width 0.2s ease;
}
.hub-card:hover .hub-card-bg { width: 10px; }
.hub-card-content { margin-left: 12px; flex-grow: 1; }
.hub-card-content h4 { margin: 0 0 4px; color: var(--brand-900); font-size: 0.95rem; font-weight: 700; }
.hub-card-content p { margin: 0; color: var(--text-muted); font-size: 0.8rem; line-height: 1.35; }
.hub-card-arrow { color: var(--brand-accent); font-weight: bold; font-size: 1.2rem; transition: transform 0.2s ease; }
.hub-card:hover .hub-card-arrow { transform: translateX(4px); }

/* 1. Hero Layout: Stacks earlier because of the wide 5-column grid */
@media (max-width: 1024px) {
    /* ADD THIS LINE: Shrink the sidebar from 360px to 280px on medium screens */
    .layout-sidebar .search-panel { width: 280px; }

    .layout-hero { grid-template-columns: 1fr; }
    .layout-hero .search-panel { 
        padding: 30px; 
        position: static; 
        max-height: none; 
    }
    .layout-hero .icon-grid, .layout-hero .climate-grid, .layout-hero .role-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }
}

/* 2. Sidebar Layout: Narrower, so it can safely stay side-by-side until tablet-portrait */
@media (max-width: 768px) {
    .layout-sidebar { flex-direction: column; }
    .layout-sidebar .search-panel { width: 100%; position: static; max-height: none; }
    
    .seo-feature-grid { grid-template-columns: repeat(2, 1fr); }
    
    .icon-grid, .climate-grid, .role-grid { 
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 12px;
    }

    .text-search-row, .layout-hero .text-search-row { 
        display: grid; grid-template-columns: 1fr 1fr; gap: 16px; 
    }
    
    .wgsrpd-grid, .layout-hero .wgsrpd-grid { 
        display: grid; grid-template-columns: 1fr 1fr; gap: 16px; 
    }
    .wgsrpd-grid > .sg-field:nth-child(3),
    .layout-hero .wgsrpd-grid > .sg-field:nth-child(3) {
        grid-column: 1 / -1;
    }

    /* NEW: Centers the hub image only on narrow mobile screens */
    .layout-sidebar .hub-hero-image {
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

@media (max-width: 500px) {
    .seo-feature-grid { grid-template-columns: 1fr; }

    /* FIX: Smaller minimum size for mobile so they don't stack completely vertically */
    .icon-grid, .climate-grid, .role-grid,
    .layout-hero .icon-grid, .layout-hero .climate-grid, .layout-hero .role-grid { 
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); 
    }

    .text-search-row, .layout-hero .text-search-row,
    .wgsrpd-grid, .layout-hero .wgsrpd-grid { 
        display: flex; 
        flex-direction: column; 
        gap: 12px;
    }
}

/* =========================================
   4. Form Elements & Grids
   ========================================= */
.sg-section-title { 
    font-size: 14px; /* Increased from 13px */
    font-weight: 800; /* Increased for maximum structural weight */
    color: var(--brand-900); /* Darkened to brand color for high contrast */
    letter-spacing: 0.08em; 
    text-transform: uppercase; 
    margin: 0 0 16px; 
}
.sg-field { margin-bottom: 16px; width: 100%; }
.sg-label { display: block; font-size: 13px; color: var(--text-main); margin-bottom: 6px; font-weight: 600; }
.sg-input, .sg-select { width: 100%; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); background: #fff; outline: none; font-size: 14px; font-family: inherit; transition: all 0.2s ease; box-shadow: inset 0 1px 2px rgba(0,0,0,0.02); }
.sg-input::placeholder { color: #9CA3AF; font-weight: 400; }
.sg-input:focus, .sg-select:focus { border-color: var(--brand-accent); box-shadow: 0 0 0 3px var(--border-focus); }
.sg-help { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.4; }
.hr { height: 1px; background: rgba(0,0,0,0.06); margin: 20px 0; }
.sg-help { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.4; }

/* Premium Form Inline Help (Expandable) */
.form-help-details { margin: -5px 0 25px 0; background: transparent; padding: 0; border: none; }
.form-help-details summary { 
    font-size: 12px; font-weight: 600; color: var(--brand-accent); 
    display: inline-flex; align-items: center; gap: 4px; 
    transition: color 0.2s; list-style: none; cursor: pointer;
}
.form-help-details summary::-webkit-details-marker { display: none; }
.form-help-details summary:hover { color: var(--brand-900); }
.form-help-content { 
    background: #F0FBFA; border-left: 3px solid var(--brand-accent); 
    padding: 12px 16px; border-radius: 0 var(--radius-md) var(--radius-md) 0; 
    margin-top: 10px; font-size: 12.5px; color: var(--text-muted); line-height: 1.6; 
}
.form-help-content ul { margin: 8px 0 0; padding-left: 20px; }
.form-help-content li { margin-bottom: 6px; }
.form-help-content strong { color: var(--text-main); font-weight: 700; }

.hr { height: 1px; background: rgba(0,0,0,0.06); margin: 20px 0; }
.simple-checkbox-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }

/* BASE GRID for Native Range (Stacked in the narrow sidebar) */
.wgsrpd-grid { display: flex; flex-direction: column; gap: 16px; }

.ms { position: relative; width: 100%; }
.ms-btn { width: 100%; text-align: left; padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: #fff; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-family: inherit; color: var(--text-main); box-shadow: inset 0 1px 2px rgba(0,0,0,0.02); transition: all 0.2s ease; }
.ms-btn:hover { border-color: #ccc; }
.ms.open .ms-btn { border-color: var(--brand-accent); box-shadow: 0 0 0 3px var(--border-focus); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ms-panel { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--border-subtle); border-top: none; border-bottom-left-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); box-shadow: var(--shadow-md); z-index: 1000; max-height: 280px; overflow-y: auto; }
.ms.open .ms-panel { display: block; }
.ms-search { width: calc(100% - 16px); margin: 8px; padding: 10px 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; outline: none; background: var(--bg-main); }
.ms-search:focus { border-color: var(--brand-accent); background: #fff;}
.ms-item { display: flex; align-items: center; padding: 10px 12px; cursor: pointer; font-size: 13px; gap: 10px; transition: background 0.1s; border-bottom: 1px solid #f5f5f5; }
.ms-item:last-child { border-bottom: none; }
.ms-item:hover { background: var(--bg-sidebar); }
.ms-item.zero-count { opacity: 0.4; }
.ms-item input[type="checkbox"] { accent-color: var(--brand-900); width: 16px; height: 16px; cursor: pointer; }
.ms-count { margin-left: auto; font-size: 11px; color: var(--text-muted); background: var(--bg-main); padding: 2px 8px; border-radius: 12px; font-weight: 600; }

/* BASE GRIDS (Used for the narrow Sidebar / Results view) */
.icon-grid, .climate-grid, .role-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 10px; 
    margin-bottom: 20px; 
}
.climate-btn { 
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; 
  padding: 8px; 
  border-radius: var(--radius-md); border: none; font-size: 13px; font-weight: 600; font-family: inherit; 
  cursor: pointer; color: #fff; text-align: center; line-height: 1.2;
  transition: all 0.2s ease; opacity: 0.7; 
  /* INCREASED MASSIVELY: A heavy 18% shadow to pierce through the 0.7 element opacity */
  box-shadow: 0 4px 12px rgba(0,0,0,0.18); 
  min-height: 105px; 
  padding: 12px 8px; 
  width: 100%; box-sizing: border-box;
}
.climate-btn svg { width: 22px; height: 22px; stroke-width: 2px; }

/* MATCHED: Spread reduced to 8px 20px and opacity dialed back to 15% to sync with white cards */
.climate-btn:hover { 
    opacity: 0.9; 
    transform: translateY(-2px); 
    box-shadow: 0 8px 20px rgba(0,0,0,0.15); 
}

/* MATCHED: Drop shadow reduced to 4px 12px and 25% opacity to sync with white cards */
.climate-btn.active { 
  opacity: 1; 
  transform: scale(1.02) translateY(-1px); 
  box-shadow: 0 0 0 2px var(--bg-sidebar), 0 0 0 5px var(--brand-900), 0 4px 12px rgba(6, 60, 56, 0.25); 
}
.climate-btn[data-key="tropical"] { background-color: var(--climate-tropical); }
.climate-btn[data-key="subtropical"] { background-color: var(--climate-subtropical); }
.climate-btn[data-key="temperate"] { background-color: var(--climate-temperate); }
.climate-btn[data-key="arid"] { background-color: var(--climate-arid); color: #fff; }
.climate-btn[data-key="cold"] { background-color: var(--climate-cold); }

.icon-label { 
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; 
  border: 1px solid var(--border-subtle); padding: 8px 4px; /* Reduced padding */
  border-radius: var(--radius-sm); cursor: pointer; text-align: center; line-height: 1.2;
  transition: all 0.2s ease; background: #fff; font-size: 12px; font-weight: 500; color: var(--text-muted); 
  /* INCREASED: From 2% to 6% opacity for a visible resting footprint */
  box-shadow: 0 2px 5px rgba(0,0,0,0.06); 
  min-height: 105px;
  padding: 12px 6px;
  width: 100%; box-sizing: border-box;
}

/* Update the default SVG size to 32px (KEPT INTACT) */
.icon-label svg { 
    width: 32px; 
    height: 32px; 
    stroke-width: 1.5px; 
    transition: all 0.2s ease; 
}

/* 1. Add soft elevation and vertical lift on hover */
.icon-label:hover { 
    border-color: var(--brand-accent); 
    background: #F0FBFA; 
    color: var(--text-main); 
    transform: translateY(-2px); 
    /* INCREASED: Custom 10% shadow instead of --shadow-md */
    box-shadow: 0 8px 20px rgba(0,0,0,0.10); 
}

.icon-label input[type="checkbox"] { display: none; }

/* 2. Enhance the selected state to feel anchored but prominent */
.icon-label:has(input[type="checkbox"]:checked) { 
    border-color: var(--brand-900); 
    background: #fff; 
    border-width: 2px; 
    color: var(--brand-900); 
    font-weight: 700; 
    transform: translateY(-1px); /* Slightly lower than hover to signify a 'pressed/locked' state */
    /* INCREASED: From 15% to 25% opacity on the branded green shadow */
    box-shadow: 0 4px 12px rgba(6, 60, 56, 0.25); 
}

/* Update the checked state stroke-width so it remains crisp at the larger size (KEPT INTACT) */
.icon-label:has(input[type="checkbox"]:checked) svg { 
    stroke-width: 2px; 
    transform: scale(1.05); 
}

/* NEW: Subtle Taxa Count Badges (KEPT INTACT) */
.icon-count { display: block; font-size: 10.5px; opacity: 0.6; font-weight: 600; margin-top: 3px; }
.climate-btn .icon-count { color: rgba(255,255,255,0.85); }
.icon-label:hover .icon-count { color: var(--brand-accent); opacity: 1; }
.icon-label:has(input[type="checkbox"]:checked) .icon-count { color: var(--brand-900); opacity: 0.8; }

.sg-btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; transition: all 0.2s ease; border: none; text-decoration: none; }
.sg-btn-primary { background: var(--accent-action); color: #fff; box-shadow: 0 4px 6px rgba(199, 82, 82, 0.2); }
.sg-btn-primary:hover { background: #A94343; transform: translateY(-1px); }
.sg-btn-secondary { background: #fff; color: var(--text-main); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-sm); }
.sg-btn-secondary:hover { background: var(--bg-main); border-color: #ccc; transform: translateY(-1px); }
.sg-btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.3); }
.sg-btn-ghost:hover { background: rgba(255,255,255,0.1); border-color: #fff; }
.sg-link { background: none; border: none; color: var(--brand-accent); font-size: 13px; cursor: pointer; text-decoration: underline; padding: 0; font-weight: 500; font-family: inherit; }
.sg-link:hover { color: var(--brand-900); }

.scale-chips-container {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-subtle); /* Updated to use your subtle border variable */
    animation: fadeIn 0.3s ease-in-out;
}

.chip-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.chip-label {
    cursor: pointer;
}

.chip-label input[type="radio"] {
    display: none;
}

.chip-button {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

/* Uses your brand-900 for the selected state to match the "Dual-Label" logic */
.chip-label input[type="radio"]:checked + .chip-button {
    background: var(--brand-900); 
    color: #fff;
    border-color: var(--brand-900);
}

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

/* =========================================
   5. List & Details Elements
   ========================================= */
.fieldpair { display: flex; border-bottom: 1px solid var(--border-subtle); padding: 14px 0; font-size: 14px; }
.fieldpair:last-child { border-bottom: none; }
.fieldpair .sg-label { width: 35%; color: var(--text-muted); margin-bottom: 0; font-weight: 600; }
.fieldpair .val { width: 65%; font-weight: 600; color: var(--text-main); line-height: 1.5; }
details { margin-top: 16px; background: var(--bg-main); padding: 16px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); }
summary { font-size: 14px; font-weight: 700; cursor: pointer; color: var(--brand-900); }
.small-muted { font-size: 13px; color: var(--text-muted); }

/* =========================================
   6. Results List Styling
   ========================================= */
.results-head { 
    display: flex; 
    justify-content: space-between;
    align-items: baseline; 
    margin-bottom: 20px; 
    border-bottom: 1px solid var(--border-subtle); 
    padding-bottom: 12px; 
    flex-wrap: wrap; /* Allows the sort dropdown to drop below the title if squeezed */
    gap: 16px; 
}
.results-total { font-weight: 700; font-size: 1.1rem; color: var(--brand-900); }
.results-meta { font-size: 0.85rem; color: var(--text-muted); }

/* Premium A-Z Filter Bar */
.az-filter {
    display: flex; flex-wrap: wrap; gap: 4px; 
    margin-bottom: 24px; padding-bottom: 20px; 
    border-bottom: 1px solid var(--border-subtle);
}
.az-btn {
    width: 28px; height: 28px; 
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 700; color: var(--text-muted);
    background: transparent; border: 1px solid transparent; 
    border-radius: 4px; cursor: pointer; transition: all 0.15s ease;
}
.az-btn:hover { background: var(--bg-sidebar); color: var(--brand-900); }
.az-btn.active {
    background: var(--brand-accent); color: #fff; 
    border-color: var(--brand-accent); box-shadow: var(--shadow-sm);
}
.az-btn-clear { width: auto; padding: 0 10px; font-size: 0.8rem; }

.species-row { 
    padding: 16px; 
    border: 1px solid var(--border-subtle); 
    border-radius: var(--radius-md);
    margin-bottom: 12px; 
    transition: all 0.2s ease; 
    background: #fff; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    /* NEW: Subtle resting shadow to defend against ad bleed */
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.species-row:hover { border-color: var(--brand-accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.species-row a { text-decoration: none; }
.species-main-title { font-weight: 700; font-size: 1.25rem; color: var(--brand-900); margin-bottom: 4px; display: flex; align-items: center; gap: 12px; }
.species-sub { font-size: 0.95rem; color: var(--text-muted); font-weight: 500; }
.badge-family { background: var(--bg-sidebar); color: var(--brand-800); padding: 4px 10px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; border-radius: 20px; border: 1px solid rgba(0,0,0,0.05); display: inline-block; }

.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 35px; flex-wrap: wrap; }
.pager button { padding: 8px 14px; font-size: 0.9rem; cursor: pointer; border: 1px solid var(--border-subtle); background: white; border-radius: var(--radius-sm); transition: all 0.2s ease; font-family: inherit; font-weight: 600; color: var(--text-muted);}
.pager button:hover:not(:disabled) { border-color: var(--brand-900); color: var(--brand-900); }
.pager button:disabled { opacity: 0.5; cursor: not-allowed; }
.pager .active-page { background: var(--brand-accent) !important; color: white !important; border-color: var(--brand-accent); }
.dropdown:hover .dropdown-content { display: grid !important; }

.hub-hero { 
    background: #f4f9ff; 
    padding: 35px;
    border-radius: var(--radius-lg); 
    margin-bottom: 25px; 
    display: flex; 
    align-items: center; 
    gap: 25px; 
    border: 1px solid #e0eeff;
    flex-wrap: nowrap; /* CRITICAL: Stops the random jumping */
}
.hub-hero-text { 
    flex-grow: 1;
    min-width: 0; 
    /* Removed flex-basis so it naturally fills space without leaving empty voids */
}

@media (max-width: 768px) {
    .hub-hero-text { 
        flex-basis: auto; /* Releases the height lock on mobile */
    }
}

.hub-hero-title { margin: 0 0 10px 0; color: var(--brand-900); font-size: 2.2rem; font-weight: 800; }
.hub-hero-desc { margin: 0; color: var(--text-muted); line-height: 1.6; font-size: 1.05rem; }
.hub-hero-image { 
    width: 30%; 
    min-width: 160px; 
    max-width: 250px; 
    height: auto; /* CRITICAL: Overrides flexbox stretching */
    aspect-ratio: 1 / 1; /* Locks in the perfect square for your AI images */
    background: #fff; 
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center; 
    color: var(--text-muted); 
    flex-shrink: 0; 
    overflow: hidden; 
    border: 1px solid var(--border-subtle);
}
/* Ensure the inner image still covers the new dynamic square */
.hub-hero-image img { width: 100%; height: 100%; object-fit: cover; }

/* --- Premium Skeleton Loading UI --- */
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.skeleton-row {
    background: #fdfdfd;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.skeleton-block {
    background: #e0e0e0;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

/* The sweeping light effect */
.skeleton-block::after {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background-image: linear-gradient(90deg, rgba(255,255,255, 0) 0, rgba(255,255,255, 0.4) 20%, rgba(255,255,255, 0.5) 60%, rgba(255,255,255, 0));
    animation: shimmer 1.5s infinite;
}

/* =========================================
   7. Species Details View 
   ========================================= */
.details-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 30px; align-items: start; }
@media (max-width: 900px) { .details-layout { grid-template-columns: 1fr; } }

/* NEW: Sticky Sidebar for the right column */
.details-sidebar { 
    position: sticky; 
    top: 110px; 
}

.sg-breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 24px; font-weight: 500; }
.sg-breadcrumb a { color: var(--brand-accent); text-decoration: none; transition: color 0.2s; }
.sg-breadcrumb a:hover { color: var(--brand-900); }
.sg-breadcrumb span.sep { margin: 0 8px; color: #ccc; }
.hero-title { font-size: 2.5rem; font-weight: 800; color: var(--brand-900); margin: 0 0 8px; line-height: 1.2; }
.hero-subtitle { font-size: 1.25rem; color: var(--text-muted); font-weight: 500; margin-bottom: 24px; }
.chip-container { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 30px; }
.chip { padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; text-decoration: none; transition: all 0.2s; }

/* Plant Types: High Contrast Botanical Anchor */
.chip-type {
    background: var(--brand-900);
    color: #fff;
}
.chip-type:hover {
    background: var(--brand-800);
    box-shadow: var(--shadow-sm);
}

/* Landscape Layers: Visually Subordinated Context */
.chip-role {
    background: var(--bg-main);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
}
.chip-role:hover {
    border-color: var(--brand-accent);
    color: var(--brand-800);
}

/* UPDATED: Premium Summary Box */
.nlg-summary { font-size: 1.1rem; line-height: 1.7; color: var(--text-main); padding: 24px; background: var(--bg-sidebar); border-left: 4px solid var(--brand-900); border-radius: 0 var(--radius-md) var(--radius-md) 0; margin-bottom: 30px; }

/* NEW: Premium Editorial Gallery Component */
.btn-editorial-gallery {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 16px 20px;
    margin-bottom: 24px;
    background: #fff;
    border: 2px solid var(--brand-900);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}
.btn-editorial-gallery:hover {
    background: var(--bg-sidebar);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.gallery-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: var(--brand-900);
    flex-shrink: 0;
}
.gallery-icon-wrapper svg { width: 100%; height: 100%; stroke-width: 1.5px; }
.gallery-text-wrapper {
    display: flex; flex-direction: column; justify-content: center; gap: 4px; text-align: left;
}
.gallery-title { color: var(--brand-900); font-size: 1.15rem; font-weight: 800; line-height: 1.1; }
.gallery-sub { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; line-height: 1.2; }

.details-icon-banner { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 30px; }
.details-icon-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; width: 90px; height: 90px; background: #fff; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.details-icon-item svg { width: 32px; height: 32px; color: var(--brand-accent); stroke-width: 1.5px; }
.details-icon-item span { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; text-align: center; }

/* =========================================
   NEW: Structural Dashboard Grid (Zone 2)
   ========================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 30px;
    align-items: start; /* Prevents columns from stretching to match the tallest one */
}

/* NEW: Wrapper to vertically stack multiple cards in the same category */
.metric-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    width: 100%;
}

.metric-card:hover {
    border-color: var(--brand-accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.metric-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--bg-sidebar);
    border-radius: 12px;
    flex-shrink: 0;
}

.metric-icon svg {
    width: 28px;
    height: 28px;
    stroke-width: 1.5px;
}

.metric-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--brand-900);
    line-height: 1.2;
}

/* Stack the dashboard on mobile devices */
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* Changed to a Premium SaaS Utility Button */
.btn-giant-search { 
    display: flex; align-items: center; justify-content: center; gap: 10px; 
    width: 100%; padding: 16px; margin-bottom: 30px; 
    background: #fff; color: var(--brand-900); 
    border: 2px solid var(--brand-accent); border-radius: var(--radius-md); 
    font-size: 1.05rem; font-weight: 700; font-family: inherit; 
    cursor: pointer; transition: all 0.2s ease; 
    box-shadow: var(--shadow-sm); 
}
.btn-giant-search:hover { 
    background: #F0FBFA; border-color: var(--brand-800); 
    transform: translateY(-2px); box-shadow: var(--shadow-md); 
}
.btn-giant-search svg { width: 22px; height: 22px; stroke-width: 2px; color: var(--brand-accent); transition: color 0.2s; }
.btn-giant-search:hover svg { color: var(--brand-800); }

.related-list { list-style: none; padding: 0; margin: 0; }
.related-list li { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border-subtle); }
.related-list li:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.related-list a { display: block; text-decoration: none; color: var(--brand-900); font-weight: 700; font-size: 1rem; transition: color 0.2s; }
.related-list a:hover { color: var(--brand-accent); }
.related-list .sub { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* =========================================
   8. Global Footer 
   ========================================= */
.site-footer { background: var(--brand-900); color: #fff; padding: 60px 18px 40px; margin-top: auto; border-top: 4px solid var(--brand-accent); }
.footer-inner { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; }
.footer-logo { font-size: 24px; font-weight: 800; margin-bottom: 16px; }
.footer-desc { color: rgba(255,255,255,0.7); font-size: 0.95rem; line-height: 1.6; margin-bottom: 24px; max-width: 80%; }
.footer-copy { font-size: 0.8rem; color: rgba(255,255,255,0.5); }
.footer-heading { font-size: 1rem; font-weight: 700; margin: 0 0 20px; color: var(--brand-accent); letter-spacing: 0.05em; text-transform: uppercase; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 12px; }
.footer-links a { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.95rem; transition: color 0.2s; }
.footer-links a:hover { color: #fff; text-decoration: underline; }

@media (max-width: 900px) {
    .footer-inner { grid-template-columns: 1fr 1fr; }
    .brand-col { grid-column: span 2; }
}
@media (max-width: 500px) {
    .footer-inner { grid-template-columns: 1fr; }
    .brand-col { grid-column: span 1; }
}

/* Form Validation Styles */
.input-error { border-color: var(--accent-action) !important; box-shadow: 0 0 0 3px rgba(199, 82, 82, 0.2) !important; }
.error-text { color: var(--accent-action); font-size: 0.8rem; font-weight: 600; margin-top: 6px; }

/* =========================================
   9. Responsive Mega Menu
   ========================================= */
.sg-mega-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-radius: 0 0 12px 12px;
    padding: 30px;
    z-index: 1000;
    
    /* NEW: Shrink-wrap the container around the 2 remaining columns */
    width: max-content;
    min-width: 550px;
    max-width: calc(100vw - 36px);
    
    /* UPDATED: Balances the remaining Climate and Plant Type columns */
    /* The Plant Type column gets 1.5fr because it holds two internal columns */
    grid-template-columns: 1fr 1.5fr;
    gap: 40px;
    
    text-align: left;
    border: 1px solid var(--border-subtle);
    border-top: none;
}

.mega-plant-types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
    list-style: none;
    padding: 0;
    margin: 0;
    line-height: 2;
}

/* Tablet Layout (< 950px) */
@media (max-width: 950px) {
    .sg-mega-menu {
        grid-template-columns: 1fr 1fr;
        width: 650px;
        gap: 30px;
    }
    /* Push the "By Role" column to a new row spanning both columns */
    .sg-mega-menu > div:nth-child(3) {
        grid-column: span 2;
    }
}

/* Mobile Layout (< 700px) */
@media (max-width: 700px) {
    .sg-mega-menu {
        grid-template-columns: 1fr;
        width: calc(100vw - 36px); 
        padding: 20px;
        max-height: 70vh; 
        overflow-y: auto;
    }
    .sg-mega-menu > div:nth-child(3) {
        grid-column: span 1;
    }
    .mega-plant-types {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   10. About Page / Bio Component
   ========================================= */
.founder-bio-wrap {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-top: 20px;
}

.founder-portrait {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-subtle);
    flex-shrink: 0;
}

/* On screens smaller than 768px (tablets and phones), stack the bio */
@media (max-width: 768px) {
    .founder-bio-wrap {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* =========================================
   11. SEO Accordions (Common Names & Synonyms)
   ========================================= */
.seo-accordion {
    margin-top: 0;
    background: transparent;
    border: none;
    padding: 0;
}
.seo-accordion.primary-margin { margin-bottom: 28px; }
.seo-accordion.secondary-margin { margin-bottom: 12px; }

.seo-accordion summary {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    outline: none;
    transition: color 0.2s;
    cursor: pointer;
    padding: 4px 0;
    display: flex;
    align-items: center;
    list-style: none; /* Removes default triangle in Firefox/Safari */
}
.seo-accordion summary::-webkit-details-marker {
    display: none; /* Removes default triangle in Chrome/Edge */
}
.seo-accordion summary:hover {
    color: var(--brand-900);
}

.seo-highlight {
    font-weight: 500;
    color: var(--text-main);
    margin-left: 4px;
}
.seo-highlight.botanical { font-style: italic; }

.seo-badge {
    font-size: 0.75rem;
    background: var(--bg-main);
    border: 1px solid var(--border-subtle);
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 6px;
    color: var(--text-main);
}

.seo-list {
    margin-top: 12px;
    border: 1px solid var(--border-subtle);
    background: #fdfdfd;
    border-radius: var(--radius-sm);
    padding: 12px;
    max-height: 250px;
    overflow-y: auto;
    list-style: none;
}
.seo-list li {
    font-size: 0.95rem;
    color: var(--text-main);
    padding: 6px 0;
    border-bottom: 1px solid #f5f5f5;
}
.seo-list li:last-child { border-bottom: none; }
.seo-list.botanical li { font-style: italic; }
.seo-list.standard li { font-style: normal; font-weight: 500; }
/* SilvaGrid privacy choices */
.sg-privacy-banner[hidden] {
    display: none;
}

.sg-privacy-banner {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    background: var(--brand-900);
    color: #fff;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.18);
}

.sg-privacy-banner-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 24px;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
}

.sg-privacy-copy h2 {
    margin: 0 0 5px;
    color: #fff;
    font-size: 1rem;
    line-height: 1.3;
}

.sg-privacy-copy p {
    max-width: 760px;
    margin: 0;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.9rem;
    line-height: 1.5;
}

.sg-privacy-copy a {
    color: #fff;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sg-privacy-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.sg-privacy-button {
    min-height: 44px;
    padding: 9px 16px;
    border: 2px solid #fff;
    border-radius: 6px;
    background: #fff;
    color: var(--brand-900);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 750;
    cursor: pointer;
}

.sg-privacy-button + .sg-privacy-button {
    background: transparent;
    color: #fff;
}

.sg-privacy-button:hover,
.sg-privacy-button:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.35);
    outline-offset: 2px;
}

.sg-privacy-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.sg-privacy-status {
    grid-column: 1 / -1;
    min-height: 0;
    margin: 0;
    color: #fff;
    font-size: 0.85rem;
}

.sg-privacy-status:empty {
    display: none;
}

.sg-footer-link-button {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
}

.sg-footer-link-button:hover,
.sg-footer-link-button:focus-visible {
    text-decoration: underline;
}

@media (max-width: 760px) {
    .sg-privacy-banner-inner {
        grid-template-columns: 1fr;
        padding: 14px 16px;
    }

    .sg-privacy-actions {
        justify-content: stretch;
    }

    .sg-privacy-button {
        flex: 1 1 180px;
    }
}
