/* ═════════════════════════════════════════════════════════════════════ */
/* HydroDose — Masterblend 3-Part Hydroponic Dosing Engine            */
/* Theme: Dark Botanical Emerald & Neon Leaf Green                      */
/* ═════════════════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #07150e;
    --bg-surface: #0f261b;
    --bg-card: #143324;
    --bg-hover: #1c4731;
    --border: #23573c;
    --border-focus: #22c55e;
    --text-primary: #ecfdf5;
    --text-secondary: #a7f3d0;
    --text-muted: #5eead4;
    --accent: #22c55e;
    --accent-emerald: #10b981;
    --accent-glow: rgba(34, 197, 94, 0.25);
    --accent-amber: #f59e0b;
    --accent-danger: #ef4444;
    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.35);
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.app-header {
    background: linear-gradient(180deg, rgba(15, 38, 27, 0.95) 0%, rgba(7, 21, 14, 0.9) 100%);
    border-bottom: 1px solid var(--border);
    padding: 2.5rem 1rem 2rem;
    text-align: center;
}

.header-container {
    max-width: 900px;
    margin: 0 auto;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid var(--border);
    color: var(--accent);
    font-size: 0.825rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
}

.app-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.75rem;
    font-weight: 800;
    margin: 0 0 0.5rem;
    background: linear-gradient(135deg, #ffffff 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.app-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin: 0;
    font-weight: 400;
}

.app-main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

/* Ad Space Placeholders */
.ad-placeholder {
    background: rgba(15, 38, 27, 0.6);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem auto 1.5rem;
}

.ad-desktop {
    width: 728px;
    height: 90px;
}

.ad-mobile {
    width: 320px;
    height: 50px;
    display: none;
}

@media (max-width: 768px) {
    .ad-desktop { display: none; }
    .ad-mobile { display: flex; }
}

/* Calculator Container Card */
.calculator-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-subtle);
    margin-bottom: 2rem;
}

/* Presets Section */
.preset-section {
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.85rem;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.preset-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.preset-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.preset-btn.active {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.preset-btn .preset-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.preset-btn .preset-spec {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent);
}

/* Calculator Grid */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
    margin-bottom: 1.75rem;
}

@media (max-width: 900px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }
}

.controls-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Input Groups */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.label-row label {
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--text-primary);
}

.unit-toggle-group, .scale-toggle-group {
    display: flex;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.unit-btn, .scale-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.775rem;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.unit-btn.active, .scale-btn.active {
    background: var(--accent);
    color: #04120a;
    font-weight: 700;
}

.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-suffix input[type="number"] {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.15rem;
    padding: 0.75rem 3.5rem 0.75rem 1rem;
    transition: border-color 0.2s ease;
}

.input-with-suffix input[type="number"]:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-suffix, .input-unit {
    position: absolute;
    right: 1rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    pointer-events: none;
}

/* Slider Controls */
.slider-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--bg-card);
    border-radius: 4px;
    outline: none;
    border: 1px solid var(--border);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
    border: 2px solid var(--bg-primary);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
    border: 2px solid var(--bg-primary);
}

.slider-val-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    text-align: right;
}

.slider-limits {
    display: flex;
    justify-content: space-between;
    font-size: 0.725rem;
    color: var(--text-muted);
}

/* Ratio Sliders Box */
.ratio-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.ratio-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.775rem;
    color: var(--text-secondary);
    background: rgba(34, 197, 94, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.ratio-sliders {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.ratio-item {
    display: grid;
    grid-template-columns: 1.5fr 2fr 50px;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.ratio-pct {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
}

/* Mixing Sequence Checklist */
.checklist-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
}

.checklist-header {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.checklist-icon {
    font-size: 1.5rem;
}

.checklist-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    margin: 0;
    color: var(--text-primary);
}

.checklist-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0;
}

.checklist-steps {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.step-item {
    background: rgba(7, 21, 14, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    transition: all 0.2s ease;
}

.step-item.locked {
    opacity: 0.6;
    border-style: dashed;
    background: rgba(7, 21, 14, 0.3);
}

.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    height: 22px;
    width: 22px;
    min-width: 22px;
    background-color: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: 4px;
    margin-top: 2px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent);
    border-color: var(--accent);
}

.checkbox-container input:checked ~ .checkmark::after {
    content: "✓";
    color: #04120a;
    font-weight: 900;
    font-size: 14px;
}

.step-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.step-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.step-dose {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
}

.step-desc {
    font-size: 0.775rem;
    color: var(--text-muted);
}

.precipitation-alert {
    display: flex;
    gap: 0.65rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-size: 0.775rem;
    color: #fca5a5;
    line-height: 1.4;
}

.alert-icon {
    font-size: 1.1rem;
}

/* Results Grid Cards */
.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.75rem;
}

@media (max-width: 900px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 550px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.result-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.card-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.card-main-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.val-unit {
    font-size: 1rem;
    font-weight: 500;
    color: var(--accent);
}

.card-sub-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.card-note {
    font-size: 0.725rem;
    color: var(--text-muted);
    margin-top: auto;
}

/* Visualizer Section */
.visualizer-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    overflow: hidden;
}

.visualizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.visualizer-header .header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.visualizer-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    margin: 0;
    color: var(--text-primary);
}

.vis-toggle-buttons {
    display: flex;
    gap: 0.35rem;
    background: var(--bg-primary);
    padding: 2px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.vis-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.775rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.vis-btn.active {
    background: var(--accent);
    color: #04120a;
}

.canvas-container {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

.hidden {
    display: none !important;
}

/* PPM Breakdown Bars */
.ppm-breakdown-container {
    padding: 0.5rem;
}

.ppm-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 700px) {
    .ppm-grid {
        grid-template-columns: 1fr;
    }
}

.ppm-bar-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ppm-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.elem-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.elem-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    color: #04120a;
}

.n-badge { background: #38bdf8; }
.p-badge { background: #f43f5e; }
.k-badge { background: #a855f7; }
.ca-badge { background: #fbbf24; }
.mg-badge { background: #34d399; }
.s-badge { background: #fb923c; }

.elem-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--accent);
}

.ppm-bar-track {
    width: 100%;
    height: 10px;
    background: var(--bg-surface);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.ppm-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.n-fill { background: #38bdf8; }
.p-fill { background: #f43f5e; }
.k-fill { background: #a855f7; }
.ca-fill { background: #fbbf24; }
.mg-fill { background: #34d399; }
.s-fill { background: #fb923c; }

.ppm-target-range {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Deep Content Section */
.content-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    line-height: 1.7;
}

.content-section h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.85rem;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 1rem;
}

.content-section h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    color: var(--text-primary);
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
}

.content-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.info-callout {
    background: rgba(16, 185, 129, 0.08);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}

.info-callout h4 {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
}

.info-callout p {
    margin: 0;
    font-size: 0.925rem;
}

.mixing-rule-box {
    background: rgba(34, 197, 94, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin: 1.5rem 0;
}

.mixing-rule-box h4 {
    font-family: 'Outfit', sans-serif;
    color: var(--accent);
    margin: 0 0 0.75rem;
}

.mixing-rule-box ol {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--text-secondary);
}

.mixing-rule-box li {
    margin-bottom: 0.5rem;
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.spec-table th, .spec-table td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    text-align: left;
}

.spec-table th {
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
}

.spec-table td {
    background: rgba(7, 21, 14, 0.4);
    color: var(--text-secondary);
}

.crop-guide-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

@media (max-width: 700px) {
    .crop-guide-grid {
        grid-template-columns: 1fr;
    }
}

.crop-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.crop-card h4 {
    margin: 0 0 0.25rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
}

.crop-target {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.crop-card p {
    font-size: 0.85rem;
    margin: 0;
    color: var(--text-muted);
}

/* FAQ Accordion */
.faq-section {
    margin-top: 2rem;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    background: var(--bg-card);
    border: none;
    padding: 1rem;
    text-align: left;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-question::after {
    content: "+";
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    color: var(--accent);
}

.faq-item.active .faq-question::after {
    content: "−";
}

.faq-answer {
    padding: 0 1rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: rgba(7, 21, 14, 0.4);
}

.faq-item.active .faq-answer {
    padding: 1rem;
    max-height: 300px;
}

.faq-answer p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
