/* FDN Report Form — Styles */

:root {
    --fdn-green: #00915B;
    --fdn-green-dark: #007A4D;
    --fdn-navy: #2C3E50;
    --fdn-gray-light: #F5F5F5;
    --fdn-gray: #E0E0E0;
    --fdn-text: #333;
    --fdn-text-light: #666;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #fff;
    color: var(--fdn-text);
    line-height: 1.6;
}

[x-cloak] { display: none !important; }

/* ---------- Header ---------- */

.site-header {
    background: transparent;
    padding: 0;
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

/* Green tree-ring logo box, matching forestdatanetwork.com exactly:
   brand-green fill + tree-ring texture, white FDN mark centered on top. */
.fdn-logo {
    display: block;
    flex-shrink: 0;
    width: 192px;
    height: 128px;
    background-color: var(--fdn-green);
    background-image: url("../images/fdn-logo-white.svg"), url("../images/tree-ring-bg.png");
    background-size: 140px auto, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
}

.header-return {
    color: var(--fdn-navy);
    font-size: 18px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
    margin-top: 36px;
    white-space: nowrap;
}

.header-return:hover {
    color: var(--fdn-green);
}

@media (max-width: 600px) {
    .header-inner {
        flex-direction: column;
        gap: 12px;
    }
    .header-return {
        margin-top: 0;
    }
}

/* ---------- Footer ---------- */

.site-footer {
    max-width: 1100px;
    margin: 0 auto;
    text-align: left;
    padding: 24px;
    font-size: 13px;
    color: var(--fdn-text-light);
}

/* ---------- Main Layout ---------- */

.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 24px 40px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* ---------- Form Container ---------- */

.form-container {
    background: white;
    border-radius: 8px;
    padding: 52px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.form-container h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--fdn-navy);
    margin-bottom: 8px;
}

.form-intro {
    color: var(--fdn-text-light);
    margin-bottom: 28px;
    font-size: 15px;
}

/* Timber Pulse lockup: logo on the left, short description on the right,
   sitting above the form inside the card. */
.tp-intro {
    display: flex;
    align-items: center;
    gap: 28px;
    margin-bottom: 36px;
}

.tp-logo {
    flex-shrink: 0;
    width: 200px;
    height: auto;
}

.tp-desc {
    font-size: 16px;
    line-height: 1.5;
    color: var(--fdn-text);
    margin: 0;
}

@media (max-width: 560px) {
    .tp-intro {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .tp-logo {
        width: 170px;
    }
}

/* ---------- Form Groups ---------- */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--fdn-navy);
}

.label-hint {
    font-weight: 400;
    color: var(--fdn-text-light);
    font-size: 13px;
}

select,
input[type="email"] {
    width: 100%;
    padding: 14px 12px;
    border: 1px solid var(--fdn-gray);
    border-radius: 6px;
    font-size: 16px;
    background: white;
    color: var(--fdn-text);
    transition: border-color 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    min-height: 48px;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--fdn-green);
    box-shadow: 0 0 0 3px rgba(43, 138, 127, 0.12);
}

select:disabled {
    background: var(--fdn-gray-light);
    color: #999;
}

/* ---------- Species Row ---------- */

.species-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.species-select {
    flex: 1;
}

.subspecies-select {
    flex: 1;
}

.btn-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: #F0F0F0;
    color: #999;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: #E74C3C;
    color: white;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--fdn-green);
    color: white;
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 8px;
}

.btn-primary:hover {
    background: var(--fdn-green-dark);
}

.btn-primary:disabled {
    background: #AAA;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--fdn-navy);
    color: white;
}

.btn-secondary:hover {
    background: #1a2836;
}

.btn-add {
    background: none;
    color: var(--fdn-green);
    padding: 6px 0;
    font-size: 18px;
    border: none;
}

.btn-add:hover {
    text-decoration: underline;
}

.btn-add:disabled {
    color: #CCC;
    cursor: not-allowed;
}

/* ---------- Messages ---------- */

.success-message {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--fdn-green);
    color: white;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.success-message h2 {
    font-size: 20px;
    color: var(--fdn-navy);
    margin-bottom: 8px;
}

.success-message p {
    color: var(--fdn-text-light);
    margin-bottom: 20px;
}

.error-message {
    background: #FEF2F2;
    color: #DC2626;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 12px;
}

/* ---------- Sidebar ---------- */

.sidebar {
    padding: 24px;
    background: var(--fdn-gray-light);
    border-radius: 8px;
    height: fit-content;
}

.sidebar h3 {
    font-size: 16px;
    color: var(--fdn-navy);
    margin-bottom: 12px;
}

.sidebar p {
    font-size: 13px;
    color: var(--fdn-text-light);
    margin-bottom: 12px;
    line-height: 1.6;
}

/* ---------- Report Results ---------- */

.report-results {
    padding: 10px 0;
}

.results-header {
    background: var(--fdn-green);
    color: white;
    padding: 24px 28px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.results-header .state-svg {
    width: 80px;
    height: auto;
    flex-shrink: 0;
    opacity: 0.3;
    filter: brightness(0) invert(1);
}

.results-header-text {
    flex: 1;
}

.results-header h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.results-meta {
    font-size: 16px;
    opacity: 0.95;
    margin-bottom: 4px;
}

.results-region {
    font-size: 13px;
    opacity: 0.8;
    line-height: 1.5;
}

.results-date {
    font-size: 13px;
    opacity: 0.7;
    margin-top: 6px;
    font-style: italic;
}

.region-value {
    color: var(--fdn-text);
    line-height: 1.5;
}

/* Price Cards */

.price-card {
    border: 1px solid var(--fdn-gray);
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 16px;
    background: white;
}

.price-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.price-card-header h3 {
    font-size: 18px;
    color: var(--fdn-navy);
    margin: 0;
    font-weight: 700;
}

.price-unit {
    font-size: 13px;
    color: var(--fdn-text-light);
}

.source-badge {
    background: #FFF8E1;
    color: #B8860B;
    padding: 6px 10px 11px;
    border-radius: 6px;
    width: 220px !important;
    min-width: 220px;
    max-width: 220px;
    flex-shrink: 0;
    align-self: flex-start;
}

.source-badge-title {
    font-size: 13px;
    font-weight: 600;
}

.source-badge-desc {
    font-size: 10px;
    color: #B8860B;
    margin-top: 0px;
    line-height: 1.3;
}

.price-card-body {
    margin-top: 16px;
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.price-annual {
    flex: 1;
}

.annual-heading {
    font-size: 12px;
    color: var(--fdn-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    font-weight: 600;
}

.annual-grid {
    display: flex;
    gap: 32px;
}

.annual-item .annual-value {
    font-size: 22px;
    font-weight: 600;
    color: var(--fdn-navy);
}

.annual-item .annual-label {
    font-size: 11px;
    color: var(--fdn-text-light);
    margin-top: 2px;
}

.price-quarterly {
    border-right: 2px solid var(--fdn-gray);
    padding-right: 24px;
    min-width: 140px;
}

.quarterly-heading {
    font-size: 12px;
    color: var(--fdn-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0px;
}

.quarterly-label {
    font-size: 12px;
    color: var(--fdn-text-light);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.quarterly-value {
    font-size: 22px;
    font-weight: 600;
    color: var(--fdn-navy);
    margin-top: -2px;
}

.quarterly-value sup, .annual-value sup {
    font-size: 0.6em;
    vertical-align: super;
    margin-right: 1px;
}

.quarterly-sublabel {
    font-size: 11px;
    color: var(--fdn-text-light);
    margin-top: 2px;
    padding-bottom: 10px;
}

.price-no-data {
    color: #999;
    font-style: italic;
    padding: 12px 0;
    font-size: 14px;
}

/* Results Footer */

.results-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--fdn-gray);
    margin-bottom: 20px;
}

.results-disclaimer {
    font-size: 12px;
    color: var(--fdn-text-light);
    line-height: 1.6;
}

/* ---------- Debug/Audit Styles ---------- */

.debug-section {
    border-top: 1px dashed var(--fdn-gray);
    padding-top: 8px;
}

.debug-toggle {
    background: none;
    border: none;
    color: var(--fdn-text-light);
    font-family: monospace;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 0;
    width: 100%;
    text-align: left;
}

.debug-toggle:hover {
    color: var(--fdn-green);
}

.debug-content {
    background: #f7f8f9;
    border: 1px solid #e2e4e8;
    border-radius: 4px;
    padding: 16px;
    margin-top: 8px;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
}

.debug-source-info {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e4e8;
}

.debug-badge {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
}

.debug-label {
    color: #888;
    font-size: 11px;
}

.debug-heading {
    font-size: 12px;
    font-weight: 700;
    margin: 14px 0 6px;
    color: var(--fdn-text);
    font-family: monospace;
}

.debug-table-wrap {
    overflow-x: auto;
}

.debug-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.debug-table th {
    background: #ebedf0;
    text-align: left;
    padding: 4px 8px;
    font-weight: 600;
    white-space: nowrap;
}

.debug-table td {
    padding: 3px 8px;
    border-bottom: 1px solid #ebedf0;
    white-space: nowrap;
}

.debug-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.debug-table .data-types {
    font-size: 11px;
    color: #555;
    letter-spacing: 0.02em;
}

.debug-legend {
    font-size: 11px;
    color: #777;
    margin: 4px 0 12px;
    line-height: 1.5;
}

.debug-table tr.row-most-recent td {
    background: #e8f5e9;
}

.debug-table tr.row-rolling td {
    background: #fffde7;
}

.debug-agg {
    margin: 6px 0;
    padding: 6px 8px;
    border-radius: 3px;
    background: #fff;
    border: 1px solid #ebedf0;
}

.debug-agg-selected {
    border-left: 3px solid var(--fdn-green);
    background: #f0faf4;
}

.debug-agg-year {
    margin-bottom: 4px;
}

.debug-selected-tag {
    display: inline-block;
    background: var(--fdn-green);
    color: #fff;
    padding: 0 5px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
}

.debug-formula {
    color: #555;
    margin: 2px 0;
    word-break: break-all;
}

.debug-formula strong {
    color: var(--fdn-text);
}


@media (max-width: 768px) {
    .price-card-body {
        flex-direction: column;
        gap: 16px;
    }

    .price-quarterly {
        border-right: none;
        border-bottom: 1px solid var(--fdn-gray);
        padding-right: 0;
        padding-bottom: 16px;
    }

    .annual-grid {
        gap: 20px;
    }
}
