/* ============================================================================
   ZONING REPORT — Scoped Overrides & Zoning-Specific Styles
   All layout (.rpt-section, .rpt-details-grid, .rpt-breakdown, etc.)
   is defined in components.css. This file covers ONLY:
   - #zoning-report-root scoped tokens
   - Loading / error states
   - SVG temperature gauge internals
   - Enforcement-specific components (risk dots, confidence bar, evidence)
   - Source comparison table
   - Use option cards / tier labels
   - Family definition / state preemption / guidance cards
   - Verified badge
   - Print overrides
   ============================================================================ */

/* ─── Scoped Tokens ─────────────────────────────────────────────────── */
#zoning-report-root {
    /* Temperature */
    --temp-hot: #10B981;
    --temp-hot-subtle: rgba(16, 185, 129, 0.12);
    --temp-warm: #EAB308;
    --temp-warm-subtle: rgba(234, 179, 8, 0.12);
    --temp-cool: #F68D2E;
    --temp-cool-subtle: rgba(246, 141, 46, 0.12);
    --temp-cold: #EF4444;
    --temp-cold-subtle: rgba(239, 68, 68, 0.12);
    --temp-frozen: #3B82F6;
    --temp-frozen-subtle: rgba(59, 130, 246, 0.12);

    /* Risk */
    --risk-low: #10B981;
    --risk-low-subtle: rgba(16, 185, 129, 0.1);
    --risk-medium: #F59E0B;
    --risk-medium-subtle: rgba(245, 158, 11, 0.1);
    --risk-high: #EF4444;
    --risk-high-subtle: rgba(239, 68, 68, 0.1);

    /* Gauge arc colors */
    --gauge-frozen: #3B82F6;
    --gauge-cold: #EF4444;
    --gauge-cool: #F68D2E;
    --gauge-warm: #EAB308;
    --gauge-hot: #10B981;

    /* Zoning accent (used by evidence, confidence, etc.) */
    --zoning-accent: #F68D2E;
    --zoning-accent-dark: #E07B1E;

    min-height: 100vh;
}

/* ─── Loading State ─────────────────────────────────────────────────── */
.zr-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.zr-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: zr-spin 1s linear infinite;
    margin-bottom: var(--s-6);
}

@keyframes zr-spin {
    to { transform: rotate(360deg); }
}

.zr-loading-text {
    font-size: 14px;
    color: var(--gray-500);
}

/* ─── Error State ───────────────────────────────────────────────────── */
.zr-error-state {
    text-align: center;
    padding: var(--s-12);
}

.zr-error-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--s-6);
    color: var(--error);
}

.zr-error-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--s-3);
}

.zr-error-text {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: var(--s-6);
}

/* ─── SVG Temperature Gauge ─────────────────────────────────────────── */
.gauge-wrapper {
    position: relative;
    width: 280px;
    height: 160px;
    margin: 0 auto;
}

.gauge-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.gauge-bg {
    fill: none;
    stroke: var(--gray-100);
    stroke-width: 24;
    stroke-linecap: round;
}

.gauge-segment {
    fill: none;
    stroke-width: 24;
    stroke-linecap: round;
    opacity: 0.25;
    transition: opacity 0.3s ease;
}
.gauge-segment.active { opacity: 1; }
.gauge-segment.frozen { stroke: var(--gauge-frozen); }
.gauge-segment.cold   { stroke: var(--gauge-cold); }
.gauge-segment.cool   { stroke: var(--gauge-cool); }
.gauge-segment.warm   { stroke: var(--gauge-warm); }
.gauge-segment.hot    { stroke: var(--gauge-hot); }

.gauge-needle {
    fill: var(--gray-800);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    transform-origin: 140px 130px;
    transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gauge-center       { fill: var(--gray-800); }
.gauge-center-inner { fill: white; }

.gauge-labels text {
    font-family: var(--font-mono);
    font-size: 11px;
    fill: var(--gray-500);
}

.gauge-wrapper {
    width: 280px;
    margin: 0 auto;
}

.gauge-svg {
    width: 100%;
    height: auto;
    display: block;
}

.gauge-score-display {
    margin-top: var(--s-3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-1);
}

.gauge-score {
    font-family: var(--font-mono);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
}

.gauge-max {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    color: var(--gray-400);
    margin-left: 2px;
}

.gauge-rating {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: var(--s-2) var(--s-5);
    border-radius: var(--r-full);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: var(--s-2);
}
.gauge-rating.hot    { background: var(--temp-hot-subtle);    color: var(--temp-hot); }
.gauge-rating.warm   { background: var(--temp-warm-subtle);   color: #B8860B; }
.gauge-rating.cool   { background: var(--temp-cool-subtle);   color: var(--temp-cool); }
.gauge-rating.cold   { background: var(--temp-cold-subtle);   color: var(--temp-cold); }
.gauge-rating.frozen { background: var(--temp-frozen-subtle); color: var(--temp-frozen); }

/* ─── Specs Footer / Confidence ─────────────────────────────────────── */
.specs-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--s-4);
    padding-top: var(--s-2);
    border-top: 1px solid var(--gray-200);
    font-size: 12px;
    color: var(--gray-400);
}

.specs-confidence {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--r-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.specs-confidence.high   { background: rgba(16,185,129,0.1);  color: #059669; }
.specs-confidence.medium { background: rgba(245,158,11,0.1);  color: #D97706; }
.specs-confidence.low    { background: rgba(239,68,68,0.1);   color: #DC2626; }

/* ─── Source Comparison Table ───────────────────────────────────────── */
#property-source-comparison {
    margin-top: var(--s-5);
    border-top: 1px solid var(--gray-200);
    padding-top: var(--s-5);
}

.source-comparison-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: var(--s-3);
}

.comparison-note {
    font-size: 12px;
    color: var(--gray-400);
    font-weight: 400;
    margin-left: auto;
}

.source-comparison-table-wrap {
    overflow-x: auto;
    border-radius: var(--r-md);
    border: 1px solid var(--gray-200);
}

.source-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.source-comparison-table th,
.source-comparison-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.source-comparison-table thead th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-500);
}

.source-comparison-table .field-col   {
    min-width: 120px;
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--gray-50);
}
.source-comparison-table .source-col  { min-width: 90px; text-align: center; }

.source-header-link {
    color: var(--gray-500);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.source-header-link:hover { color: var(--teal); }

.source-comparison-table .field-label {
    font-weight: 500;
    color: var(--gray-500);
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--white);
}
.source-comparison-table tbody tr:hover .field-label { background: var(--gray-50); }
.source-comparison-table .source-cell { text-align: center; font-variant-numeric: tabular-nums; }
.source-comparison-table .source-cell.empty { color: var(--gray-400); }
.source-comparison-table .source-cell.discrepancy {
    background: rgba(245,158,11,0.08);
    color: #b45309;
    font-weight: 600;
}
.source-comparison-table .discrepancy-row .field-label { color: #b45309; }
.source-comparison-table tbody tr:last-child td { border-bottom: none; }
.source-comparison-table tbody tr:hover { background: var(--gray-50); }

/* ─── Property Data Sources (fallback) ──────────────────────────────── */
.property-sources {
    margin-top: var(--s-5);
    padding-top: var(--s-4);
    border-top: 1px solid var(--gray-200);
}

.property-sources-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: var(--s-2);
}

.property-sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-1);
}

.property-source-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--r-md);
    font-size: 12px;
    color: var(--gray-600);
    text-decoration: none;
    transition: all 0.15s ease;
}
.property-source-item:hover {
    background: white;
    border-color: var(--teal);
    color: var(--teal);
}

.property-source-label {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Verified Badge ────────────────────────────────────────────────── */
.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(16,185,129,0.1);
    color: #10B981;
    border-radius: var(--r-full);
    font-size: 11px;
    font-weight: 600;
}

/* ─── Enforcement: Risk Indicator Dots ──────────────────────────────── */
.risk-indicator {
    display: flex;
    justify-content: center;
    gap: var(--s-4);
    padding: var(--s-5) 0;
}

.risk-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gray-200);
    transition: all 0.3s ease;
}
.risk-dot.active         { transform: scale(1.3); box-shadow: 0 0 16px currentColor; }
.risk-dot.low.active     { background: var(--risk-low);    color: var(--risk-low); }
.risk-dot.medium.active  { background: var(--risk-medium); color: var(--risk-medium); }
.risk-dot.high.active    { background: var(--risk-high);   color: var(--risk-high); }

/* ─── Enforcement: Confidence Bar ───────────────────────────────────── */
.confidence-bar-section {
    padding: var(--s-4);
    background: var(--gray-50);
    border-radius: var(--r-lg);
    margin-bottom: var(--s-5);
}

.confidence-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--s-2);
}

.confidence-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
}

.confidence-value {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--zoning-accent);
}

.confidence-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--r-full);
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--zoning-accent) 0%, #FF9A5A 100%);
    border-radius: var(--r-full);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Enforcement: Summary & Extras ─────────────────────────────────── */
.enforcement-summary {
    font-size: 14px;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: var(--s-5);
}

.enforcement-key-insight {
    display: flex;
    align-items: flex-start;
    gap: var(--s-2);
    padding: var(--s-4);
    background: rgba(246,141,46,0.06);
    border-radius: var(--r-lg);
    margin-bottom: var(--s-5);
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-800);
    line-height: 1.5;
}
.enforcement-key-insight i { color: var(--zoning-accent); flex-shrink: 0; margin-top: 2px; }

.enforcement-recommendation {
    padding: var(--s-4);
    border-radius: var(--r-lg);
    margin-bottom: var(--s-5);
}
.enforcement-recommendation.warning { background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.15); }
.enforcement-recommendation.caution { background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.15); }
.enforcement-recommendation.info    { background: rgba(59,130,246,0.06); border: 1px solid rgba(59,130,246,0.15); }

.recommendation-header {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.enforcement-recommendation.warning .recommendation-header { color: var(--risk-high); }
.enforcement-recommendation.caution .recommendation-header { color: var(--risk-medium); }
.enforcement-recommendation.info .recommendation-header    { color: #3B82F6; }

.enforcement-recommendation p {
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.6;
    margin: 0;
}

/* ─── Evidence Items ────────────────────────────────────────────────── */
.evidence-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.evidence-item {
    padding: var(--s-4);
    background: var(--gray-50);
    border-radius: var(--r-lg);
    border-left: 3px solid var(--zoning-accent);
}

.evidence-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.evidence-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
}

.evidence-quality {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--zoning-accent);
}

.evidence-detail {
    font-size: 13px;
    color: var(--gray-500);
}

.evidence-bullets {
    list-style: disc;
    padding-left: var(--s-5);
    margin: 4px 0;
}
.evidence-bullets li {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.5;
    margin-bottom: 4px;
}

.evidence-relevance {
    font-size: 13px;
    color: var(--zoning-accent);
    font-style: italic;
    margin-top: 4px;
}

/* ─── Operator Guidance Card ────────────────────────────────────────── */
.guidance-card {
    padding: var(--s-5);
    background: linear-gradient(135deg, rgba(59,130,246,0.06) 0%, rgba(59,130,246,0.02) 100%);
    border: 1px solid rgba(59,130,246,0.15);
    border-radius: var(--r-lg);
}

.guidance-text {
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.7;
}

/* ─── Use Options / Pathways ────────────────────────────────────────── */
.tier-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: var(--s-4);
}

.use-options-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.use-option-card {
    padding: var(--s-4);
    background: var(--gray-50);
    border-radius: var(--r-lg);
    border-left: 3px solid var(--gray-300);
}
.use-option-card.risk-low       { border-left-color: var(--risk-low); }
.use-option-card.risk-moderate  { border-left-color: var(--risk-medium); }
.use-option-card.risk-high      { border-left-color: var(--risk-high); }
.use-option-card.risk-not-viable { border-left-color: var(--gray-400); opacity: 0.7; }

.use-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--s-2);
}

.use-option-name {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-800);
}

.risk-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--r-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.risk-pill.low       { background: var(--risk-low-subtle);    color: var(--risk-low); }
.risk-pill.moderate  { background: var(--risk-medium-subtle); color: var(--risk-medium); }
.risk-pill.high      { background: var(--risk-high-subtle);   color: var(--risk-high); }
.risk-pill.not-viable { background: var(--gray-100); color: var(--gray-500); }

.use-option-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px var(--s-4);
    margin-bottom: var(--s-2);
}

.use-option-detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.use-option-detail.full-width { grid-column: 1 / -1; }

.use-option-detail .detail-key {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-400);
}

.use-option-detail .detail-val {
    font-size: 13px;
    color: var(--gray-700);
    line-height: 1.4;
}
.use-option-detail .detail-val.mono {
    font-family: var(--font-mono);
    font-size: 12px;
}

.use-option-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding-top: var(--s-2);
    border-top: 1px solid var(--gray-100);
}

.use-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--r-full);
    font-size: 11px;
    font-weight: 600;
}
.use-badge.licensing  { background: rgba(245,158,11,0.1); color: #B45309; }
.use-badge.population { background: rgba(239,68,68,0.1);  color: #DC2626; }
.use-badge.preemption { background: rgba(16,185,129,0.1); color: #059669; }

/* ─── Family Definition ─────────────────────────────────────────────── */
.family-def-card {
    padding: var(--s-5);
    background: var(--gray-50);
    border-radius: var(--r-lg);
}

.family-def-summary {
    display: flex;
    align-items: baseline;
    gap: var(--s-2);
    margin-bottom: var(--s-2);
}

.family-def-number {
    font-size: 2.5rem;
    color: var(--zoning-accent);
    line-height: 1;
}

.family-def-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.family-def-implication {
    font-size: 14px;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: var(--s-2);
}

.family-def-note {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--gray-500);
    padding: var(--s-2);
    background: rgba(246,141,46,0.06);
    border-radius: var(--r-md);
    margin-bottom: 4px;
}

.family-def-source {
    font-size: 12px;
    color: var(--gray-400);
    font-family: var(--font-mono);
    margin-top: 4px;
}

.expandable-section { margin-top: var(--s-4); }
.expandable-section summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--zoning-accent);
    padding: var(--s-2) 0;
}
.expandable-section summary:hover { color: var(--zoning-accent-dark); }

.expandable-content {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.6;
    padding: var(--s-4);
    background: var(--gray-50);
    border-radius: var(--r-md);
    margin-top: 4px;
    font-family: var(--font-mono);
    white-space: pre-wrap;
}

/* ─── State Preemption ──────────────────────────────────────────────── */
.preemption-card {
    padding: var(--s-5);
    background: linear-gradient(135deg, rgba(16,185,129,0.06) 0%, rgba(16,185,129,0.02) 100%);
    border: 1px solid rgba(16,185,129,0.15);
    border-radius: var(--r-lg);
}

.preemption-statute {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: var(--s-2);
    color: #059669;
    font-weight: 600;
}
.preemption-statute .mono {
    font-family: var(--font-mono);
    font-size: 14px;
}

.preemption-summary {
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.6;
}

.preemption-spacing {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--gray-500);
    margin-top: var(--s-2);
    padding-top: var(--s-2);
    border-top: 1px solid rgba(16,185,129,0.1);
}

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .gauge-wrapper {
        width: 240px;
    }
    .gauge-score {
        font-size: 2.5rem;
    }
    .use-option-details {
        grid-template-columns: 1fr;
    }
    .family-def-summary {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .gauge-wrapper {
        width: 220px;
    }
    .gauge-score {
        font-size: 2rem;
    }
    .rpt-temp-card {
        padding: var(--s-5);
    }
}

/* ─── Print ─────────────────────────────────────────────────────────── */
@media print {
    .rpt-header,
    #zoning-get-credits,
    .zr-loading-state,
    .zr-error-state {
        display: none !important;
    }
    #zoning-report-root {
        background: white;
    }
    .rpt-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
