/* AMOLED Pure Black Theme Variables (Default Dark Mode) */
:root {
    --color-bg-light: #000000;       /* Pure AMOLED Black */
    --color-surface: #0a0c0a;        /* Extreme dark panel surface */
    --color-forest: #e2f5e7;         /* High contrast sage green */
    --color-forest-medium: #a3e0b8;  /* Vivid soft sage accents */
    --color-sage: #3da05e;           /* Green accents */
    --color-sage-light: #061208;     /* Very dark green background highlights */
    --color-amber: #d2a45a;          /* Soft gold badges */
    --color-amber-light: #16120b;    /* Dark warm nested badges */
    --color-charcoal: #f0f4f1;       /* Clean near-white text */
    --color-slate-gray: #a1b0a6;     /* Light slate captions */
    --color-border: #141a16;         /* Very dark border */
    --color-accent: #d2a45a;         /* Gold accents */
    
    --color-hero-bg-start: #040d06;
    --color-hero-bg-end: #000000;
    --color-hero-text: #f0f4f1;
    --color-hero-text-sub: #a1b0a6;
    --color-stat-bg: rgba(255, 255, 255, 0.02);
    --color-stat-border: rgba(255, 255, 255, 0.05);
    --color-stat-label: #a1b0a6;
    
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    
    --font-heading: 'Playfair Display', serif;
    --font-sans: 'Inter', sans-serif;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

body {
    background-color: var(--color-bg-light);
    color: var(--color-charcoal);
    font-family: var(--font-sans);
    line-height: 1.6;
    font-size: 15px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 24px;
}

/* Custom scrollbar for webkit browsers to match dark theme */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* App Wrapper */
.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header Styles */
.main-header {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
}

.bg-green-light {
    background-color: var(--color-sage-light);
}

.color-green {
    color: var(--color-forest);
    stroke-width: 2.5;
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-forest);
    line-height: 1.1;
}

.logo-text .subtitle {
    font-size: 0.75rem;
    color: var(--color-slate-gray);
    font-weight: 500;
    letter-spacing: 0.2px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-outline {
    border: 1px solid var(--color-border);
    color: var(--color-forest);
    background: transparent;
}

.indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
}

.indicator-dot.active {
    background-color: #22c55e;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--color-hero-bg-start) 0%, var(--color-hero-bg-end) 100%);
    border-radius: var(--radius-lg);
    padding: 48px;
    color: var(--color-hero-text);
    display: block;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.hero-section::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(79, 138, 101, 0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    pointer-events: none;
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.meta-tag {
    font-size: 0.8rem;
    color: var(--color-accent);
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.hero-content h2 {
    font-family: var(--font-heading);
    font-size: 2.15rem;
    font-weight: 700;
    line-height: 1.22;
}

.hero-content p {
    font-size: 0.95rem;
    color: var(--color-hero-text-sub);
    max-width: 620px;
    font-weight: 400;
}

.hero-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stat-card {
    background: var(--color-stat-bg);
    border: 1px solid var(--color-stat-border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-accent);
    font-family: var(--font-heading);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--color-stat-label);
    font-weight: 500;
}

/* Main Workspace Core */
.workspace-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
    align-items: start;
}

/* Sidebar Filter Panel */
.control-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 14px;
}

.panel-icon {
    width: 18px;
    height: 18px;
    color: var(--color-sage);
}

.panel-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-forest);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-forest);
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-icon {
    width: 15px;
    height: 15px;
    color: var(--color-sage);
}

.custom-select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: var(--color-bg-light);
    color: var(--color-charcoal);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-select:focus {
    border-color: var(--color-sage);
    box-shadow: 0 0 0 3px rgba(79, 138, 101, 0.1);
}

.field-desc {
    font-size: 0.72rem;
    color: var(--color-slate-gray);
    line-height: 1.3;
}

/* Custom Sunlight Radio buttons */
.sunlight-options {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-rows: 1fr;
    width: 100%;
    gap: 10px;
}

.sun-option-label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

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

.custom-radio {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    height: 100%;
    width: 100%;
    min-height: 84px;
    flex: 1 1 auto;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    transition: all 0.2s ease;
}

.option-icon {
    width: 20px;
    height: 20px;
    color: var(--color-slate-gray);
    flex-shrink: 0;
}

.option-content {
    display: flex;
    flex-direction: column;
}

.option-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-charcoal);
}

.option-desc {
    font-size: 0.7rem;
    color: var(--color-slate-gray);
    margin-top: 2px;
}

/* Sunlight Selection Toggle States */
.sun-option-label input[type="radio"]:checked + .custom-radio {
    border-color: var(--color-sage);
    background-color: var(--color-sage-light);
}

.sun-option-label input[type="radio"]:checked + .custom-radio .option-title {
    color: var(--color-forest);
}

.sun-option-label input[type="radio"]:checked + .custom-radio .option-icon {
    color: var(--color-sage);
}

/* Light Query input */
.bg-accent-light {
    background-color: var(--color-sage-light);
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(79, 138, 101, 0.25);
    margin-top: 6px;
}

.custom-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-family: var(--font-sans);
    outline: none;
    transition: all 0.2s ease;
}

.custom-input:focus {
    border-color: var(--color-sage);
    box-shadow: 0 0 0 2px rgba(79, 138, 101, 0.15);
}

/* Results Content styling */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 12px;
}

.results-count {
    display: flex;
    align-items: center;
    gap: 10px;
}

.count-badge {
    background: var(--color-forest);
    color: var(--color-surface);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.results-header h4 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: var(--color-forest);
}

.legend-badges {
    display: flex;
    gap: 8px;
}

.bg-bee {
    background-color: var(--color-amber-light);
    color: #a47600;
}

.bg-butterfly {
    background-color: #fdebf2;
    color: #cf2c6d;
}

.bg-wildflower {
    background-color: #f1ecfc;
    color: #6d28d9;
}

.bg-shrub {
    background-color: var(--color-sage-light);
    color: var(--color-forest-medium);
}

/* Dynamic Plants Grid (Bento Style) */
.plants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

/* Dynamic Plant Card */
.plant-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.plant-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--color-sage);
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Hover micro-interactions */
.plant-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(79, 138, 101, 0.3);
}

.plant-card:hover::before {
    opacity: 1;
}

.card-top {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.card-badge-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.plant-card h4 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-forest);
    line-height: 1.2;
}

.plant-card .scientific-name {
    font-size: 0.72rem;
    font-style: italic;
    color: var(--color-slate-gray);
    font-family: var(--font-sans);
}

.plant-card .short-desc {
    font-size: 0.78rem;
    color: var(--color-charcoal);
    line-height: 1.4;
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-bottom {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    border-top: 1px solid var(--color-border);
    padding-top: 12px;
}

.pollinator-caps {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.pill-capsule {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 9px;
    font-weight: 500;
    background-color: var(--color-bg-light);
    color: var(--color-slate-gray);
}

.card-action-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--color-sage);
    font-weight: 600;
}

.card-action-hint i {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

.plant-card:hover .card-action-hint i {
    transform: translateX(3px);
}

/* Empty State Styles */
.empty-state {
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 48px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.empty-state.hidden {
    display: none !important;
}

.empty-icon {
    width: 36px;
    height: 36px;
    color: var(--color-slate-gray);
}

.empty-state h5 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-forest);
}

.empty-state p {
    font-size: 0.78rem;
    color: var(--color-slate-gray);
    max-width: 320px;
}

/* DRAWER / MODAL STYLES */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 31, 19, 0.45);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
    opacity: 1;
    transition: opacity 0.25s linear;
}

.drawer-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.drawer-content {
    background: var(--color-surface);
    width: 100%;
    max-width: 460px;
    height: 100%;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.15);
    padding: 32px;
    display: flex;
    flex-direction: column;
    position: relative;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-overlay.hidden .drawer-content {
    transform: translateX(100%);
}

.close-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    background: var(--color-bg-light);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-slate-gray);
    transition: all 0.2s ease;
}

.close-btn:hover {
    background-color: var(--color-sage-light);
    color: var(--color-forest);
}

.close-btn i {
    width: 16px;
    height: 16px;
}

.drawer-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 16px;
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    padding-bottom: 32px;
}

.plant-category {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-sage);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.plant-title {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    color: var(--color-forest);
    line-height: 1.15;
}

.plant-sci {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--color-slate-gray);
    margin-top: -12px;
}

.drawer-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: var(--color-bg-light);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.spec-item {
    display: flex;
    flex-direction: column;
}

.spec-lbl {
    font-size: 0.65rem;
    color: var(--color-slate-gray);
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.spec-val {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-forest);
}

.drawer-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.drawer-section h4 {
    font-size: 0.75rem;
    color: var(--color-forest);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 6px;
}

.drawer-text {
    font-size: 0.82rem;
    color: var(--color-charcoal);
    line-height: 1.5;
}

.card-tip {
    border-radius: var(--radius-md);
    padding: 16px;
}

.card-tip h5 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-forest-medium);
    margin-bottom: 4px;
}

/* Accordion Styles */
.drawer-accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    border-top: 1px solid var(--color-border);
    padding-top: 16px;
}

.accordion-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-light);
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-forest);
    transition: background 0.2s ease;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.acc-icon {
    width: 16px;
    height: 16px;
    color: var(--color-sage);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.accordion-item.active .acc-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--color-surface);
}

.accordion-item.active .accordion-content {
    max-height: 1000px; /* Increased to accommodate long toxicology reports */
}

.accordion-content .drawer-text {
    padding: 12px 14px;
    margin: 0;
}

/* Utility Classes (Tailwind-inspired for toxicology badges and layout) */
.flex { display: flex; }
.inline-block { display: inline-block; }
.items-center { align-items: center; }
.gap-1 { gap: 0.25rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.rounded-full { border-radius: 9999px; }
.font-semibold { font-weight: 600; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.mb-3 { margin-bottom: 0.75rem; }
.leading-relaxed { line-height: 1.625; }

/* Toxicology Badge Styles - Semantic and Self-Contained */
.tox-badge {
    display: inline-block;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid transparent;
}

.tox-badge-safe {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #6ee7b7;
}

.tox-badge-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.tox-badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #f87171;
}

/* Dark Mode Overrides for Toxicology Badges */
.dark .tox-badge-safe {
    background-color: rgba(6, 78, 59, 0.4);
    color: #6ee7b7;
    border-color: #065f46;
}

.dark .tox-badge-warning {
    background-color: rgba(69, 26, 3, 0.4);
    color: #fcd34d;
    border-color: #92400e;
}

.dark .tox-badge-danger {
    background-color: rgba(69, 10, 10, 0.4);
    color: #fca5a5;
    border-color: #991b1b;
}

/* Accordion Specific spacing for toxicology */
#acc-toxic .drawer-text {
    padding: 16px;
}

#drawerToxicity {
    line-height: 1.6;
    font-size: 0.875rem;
}

/* Footer styling */
.app-footer {
    text-align: center;
    border-top: 1px solid var(--color-border);
    padding-top: 20px;
}

.app-footer p {
    font-size: 0.72rem;
    color: var(--color-slate-gray);
    max-width: 600px;
    margin: 0 auto;
}

/* Responsive breakdowns */
@media (max-width: 860px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body {
        padding: 12px;
    }
    
    .hero-section {
        padding: 24px;
    }
    
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .header-badges {
        width: auto;
    }
}

/* --- Theme Variable Overrides --- */

body.theme-light {
    --color-bg-light: #ffffff;       /* Pure White background */
    --color-surface: #f8fafc;        /* Soft white panel surface */
    --color-forest: #0f172a;         /* High-contrast slate charcoal */
    --color-forest-medium: #1e293b;  /* Legible medium slate */
    --color-sage: #16a34a;           /* Strong nature green theme */
    --color-sage-light: #f0fdf4;     /* Light botanical green background tint */
    --color-amber: #b45309;          /* High contrast warm gold for light mode */
    --color-amber-light: #fef3c7;    /* Warm gold background */
    --color-charcoal: #0f172a;       /* Clean darkest slate for high readability */
    --color-slate-gray: #475569;     /* Slate gray helper captions */
    --color-border: #e2e8f0;         /* Clear light borders */
    --color-accent: #b45309;         /* Warm amber accent */
    
    --color-hero-bg-start: #f1f5f9;
    --color-hero-bg-end: #e2e8f0;
    --color-hero-text: #0f172a;
    --color-hero-text-sub: #475569;
    --color-stat-bg: rgba(0, 0, 0, 0.03);
    --color-stat-border: rgba(0, 0, 0, 0.06);
    --color-stat-label: #16a34a;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
}

body.theme-night {
    --color-bg-light: #0b1120;       /* Midnight Blue background */
    --color-surface: #10192e;        /* Dark blue-slate panel cards */
    --color-forest: #e2e8f0;         /* Accessible light slate text */
    --color-forest-medium: #60a5fa;  /* Clean vibrant blue elements */
    --color-sage: #38bdf8;           /* Sky blue theme highlights */
    --color-sage-light: #1e293b;     /* Slate-light background highlights */
    --color-amber: #fbbf24;          /* Soft gold badges */
    --color-amber-light: #1e1b1b;    /* Dark warm background */
    --color-charcoal: #f8fafc;       /* Extreme clean near-white text */
    --color-slate-gray: #94a3b8;     /* Cool gray captions */
    --color-border: #1e293b;         /* Dark blue-slate borders */
    --color-accent: #fbbf24;         /* Gold accent */
    
    --color-hero-bg-start: #1e293b;
    --color-hero-bg-end: #0b1120;
    --color-hero-text: #f8fafc;
    --color-hero-text-sub: #cbd5e1;
    --color-stat-bg: rgba(255, 255, 255, 0.02);
    --color-stat-border: rgba(255, 255, 255, 0.04);
    --color-stat-label: #cbd5e1;

    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
}

/* Support clean high contrast outline of controls when focused */
button:focus-visible, 
input:focus-visible, 
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-sage);
    outline-offset: 2px;
}

/* --- Preferences Panel Layout & Interactions --- */

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

@media (max-width: 640px) {
    .header-right {
        width: 100%;
        justify-content: space-between;
        margin-top: 4px;
    }
}

.settings-container {
    position: relative;
}

.settings-trigger-btn,
.home-link-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-forest);
    border-radius: var(--radius-sm);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.home-link-btn:link,
.home-link-btn:visited {
    color: var(--color-forest);
}

.settings-trigger-btn:hover,
.settings-trigger-btn:focus,
.home-link-btn:hover,
.home-link-btn:focus {
    background: var(--color-sage-light);
    border-color: var(--color-sage);
    outline: none;
}

.settings-trigger-btn i,
.home-link-btn i {
    width: 18px;
    height: 18px;
}

.settings-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 295px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-menu.hidden {
    display: none !important;
}

.settings-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-forest);
    letter-spacing: 0.2px;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid var(--color-border);
    padding-top: 14px;
}

.settings-group:first-of-type {
    border-top: none;
    padding-top: 0;
}

.group-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-slate-gray);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.theme-btn {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    color: var(--color-slate-gray);
    padding: 8px 4px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.theme-btn:hover {
    color: var(--color-forest);
    border-color: var(--color-sage);
}

.theme-btn.active {
    background: var(--color-sage-light);
    border-color: var(--color-sage);
    color: var(--color-forest);
}

/* Accessibility Toggles */
.toggle-control-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toggle-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.toggle-label-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 80%;
}

.toggle-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-charcoal);
}

.toggle-desc {
    font-size: 0.68rem;
    color: var(--color-slate-gray);
    line-height: 1.25;
}

.toggle-switch-container {
    position: relative;
    width: 38px;
    height: 22px;
}

.toggle-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-border);
    transition: .28s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 20px;
    border: 1px solid var(--color-border);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--color-slate-gray);
    transition: .28s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
}

.toggle-checkbox:checked + .toggle-slider {
    background-color: var(--color-sage);
    border-color: var(--color-sage);
}

.toggle-checkbox:checked + .toggle-slider:before {
    transform: translateX(16px);
    background-color: var(--color-surface);
}

/* Custom indicator-dot styling should sync with light theme seamlessly */
body.theme-light .indicator-dot.active {
    background-color: #15803d;
}

/* App Header title sync in Light mode */
body.theme-light .logo-text h1 {
    color: var(--color-forest-medium);
}

/* --- Accessibility Mode Definitions --- */

/* Dyslexia Friendly font layout rules */
body.font-dyslexic {
    --font-heading: 'Lexend', 'Comic Sans MS', cursive, sans-serif !important;
    --font-sans: 'Lexend', 'Comic Sans MS', sans-serif !important;
    font-weight: 500 !important;
}

body.font-dyslexic p,
body.font-dyslexic span,
body.font-dyslexic div,
body.font-dyslexic label,
body.font-dyslexic button,
body.font-dyslexic h1,
body.font-dyslexic h2,
body.font-dyslexic h3,
body.font-dyslexic h4,
body.font-dyslexic h5,
body.font-dyslexic select,
body.font-dyslexic input {
    font-family: var(--font-sans) !important;
}

/* Reduced Motion specifications */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

body.reduced-motion * {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}

body.reduced-motion .plant-card:hover {
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
}

body.reduced-motion .plant-card::before {
    display: none !important;
}

body.reduced-motion .plant-card:hover .card-action-hint i {
    transform: none !important;
}

body.reduced-motion .hero-section::after {
    opacity: 0 !important;
    display: none !important;
}

body.reduced-motion .accordion-header,
body.reduced-motion .accordion-content,
body.reduced-motion .acc-icon,
body.reduced-motion .settings-trigger-btn,
body.reduced-motion .home-link-btn,
body.reduced-motion .theme-btn,
body.reduced-motion .toggle-slider,
body.reduced-motion .toggle-slider:before {
    transition: none !important;
}
