/*
 * demographics-profile.css — step-content styles for the Demographics
 * Profile tool at /tools/demographics-profile.
 *
 * Naming: .dp-* prefix parallels OC's .oc-*. Shell-owned surfaces
 * (.gw-modal, .gw-card, .gw-btn, .gw-gate) live in
 * /assets/geoweave-shell.css; this file styles only the tool-owned
 * step content that goes inside .gw-modal-body / .gw-modal-footer.
 */

/* -------------------- Section container -------------------- */

.dp-section {
    padding: 12px 0;
    border-bottom: 1px solid var(--gw-border, #e5e7eb);
}
.dp-section:last-child {
    border-bottom: none;
}
.dp-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gw-text-muted, #6b7280);
    margin-bottom: 8px;
}
.dp-section-hint {
    font-size: 12px;
    color: var(--gw-text-muted, #6b7280);
    margin-bottom: 8px;
}

/* -------------------- Layer picker -------------------- */

.dp-layer-select {
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--gw-border, #d1d5db);
    border-radius: 4px;
    background: #fff;
}

/* -------------------- Info panel (Setup step) -------------------- */

.dp-info {
    margin-top: 8px;
    padding: 8px 10px;
    background: var(--gw-bg-subtle, #f9fafb);
    border-radius: 4px;
    font-size: 12px;
    color: var(--gw-text, #111827);
}
.dp-info-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}
.dp-info-row .dp-label {
    color: var(--gw-text-muted, #6b7280);
}
.dp-info-row .dp-value {
    font-weight: 600;
}

.dp-phase-list {
    margin-top: 4px;
    font-size: 12px;
}
.dp-phase-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    color: #fff;
    font-weight: 600;
    margin-right: 4px;
}

/* -------------------- Progress (Compute step) -------------------- */

.dp-progress {
    margin-top: 8px;
    background: var(--gw-bg-subtle, #f9fafb);
    border-radius: 4px;
    padding: 10px 12px;
}
.dp-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gw-border, #e5e7eb);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}
.dp-progress-fill {
    height: 100%;
    background: var(--gw-accent, #238b45);
    transition: width 120ms ease;
    width: 0%;
}
.dp-progress-label {
    font-size: 12px;
    color: var(--gw-text-muted, #6b7280);
    display: flex;
    justify-content: space-between;
}

/* Per-circle result feed */
.dp-result-feed {
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 11px;
    border: 1px solid var(--gw-border, #e5e7eb);
    border-radius: 4px;
    background: #fff;
}
.dp-result-row {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-bottom: 1px solid var(--gw-border, #f3f4f6);
    gap: 8px;
}
.dp-result-row:last-child {
    border-bottom: none;
}
.dp-result-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dp-result-status.ok       { background: #22c55e; }
.dp-result-status.no_coverage { background: #9ca3af; }
.dp-result-status.sparse   { background: #f59e0b; }
.dp-result-status.err      { background: #ef4444; }
.dp-result-label {
    flex: 1;
    color: var(--gw-text, #111827);
}
.dp-result-note {
    color: var(--gw-text-muted, #6b7280);
    font-size: 10px;
}

.dp-compute-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.dp-btn {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid var(--gw-border, #d1d5db);
    border-radius: 4px;
    background: #fff;
    color: var(--gw-text, #111827);
    cursor: pointer;
}
.dp-btn:hover:not(:disabled) {
    background: var(--gw-bg-subtle, #f9fafb);
}
.dp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.dp-btn.primary {
    /* 2026-09-07 review: black, not green (owner call). */
    background: #111;
    color: #fff;
    border-color: #111;
}
.dp-btn.primary:hover:not(:disabled) {
    background: #333;
}
.dp-btn.danger {
    background: #fff;
    color: #dc2626;
    border-color: #fca5a5;
}
.dp-btn.danger:hover:not(:disabled) {
    background: #fef2f2;
}

/* -------------------- Review step -------------------- */

/* Confidence banner (low-population warning) */
.dp-confidence {
    padding: 8px 12px;
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
    font-size: 12px;
    color: #78350f;
    line-height: 1.5;
}

/* Per-circle summary — one row per source circle, click to fly-to */
.dp-per-circle-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid var(--gw-border, #e5e7eb);
    border-radius: 4px;
    background: #fff;
}
.dp-per-circle-row {
    display: grid;
    grid-template-columns: 12px 40px 80px 12px 1fr;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--gw-border, #f3f4f6);
}
.dp-per-circle-row:last-child { border-bottom: none; }
.dp-per-circle-row:hover { background: var(--gw-bg-subtle, #f9fafb); }
.dp-per-circle-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}
.dp-per-circle-idx {
    font-weight: 600;
    color: var(--gw-text, #111827);
}
.dp-per-circle-phase {
    color: var(--gw-text-muted, #6b7280);
}
.dp-per-circle-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.dp-per-circle-status.ok          { background: #22c55e; }
.dp-per-circle-status.sparse      { background: #f59e0b; }
.dp-per-circle-status.no_coverage { background: #9ca3af; }
.dp-per-circle-status.err         { background: #ef4444; }
.dp-per-circle-summary {
    color: var(--gw-text-muted, #6b7280);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Aggregate profile table — grouped by DEMO_COLS category */
.dp-agg-table {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--gw-border, #e5e7eb);
    border-radius: 4px;
    background: #fff;
    padding: 4px 0;
}
.dp-agg-group-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gw-accent, #238b45);
    padding: 8px 12px 3px;
    border-bottom: 1px solid var(--gw-border, #f3f4f6);
    background: var(--gw-bg-subtle, #f9fafb);
}
.dp-agg-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 12px;
    font-size: 12px;
}
.dp-agg-row-active {
    background: #ecfdf5;
    font-weight: 600;
}
.dp-agg-label {
    color: var(--gw-text-muted, #6b7280);
}
.dp-agg-value {
    color: var(--gw-text, #111827);
    font-weight: 600;
}
.dp-agg-na {
    color: var(--gw-text-muted, #9ca3af);
    font-weight: normal;
    font-style: italic;
}

/* Save section */
.dp-save-fields {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}
.dp-save-label {
    font-size: 11px;
    color: var(--gw-text-muted, #6b7280);
}
.dp-layer-name-input {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--gw-border, #d1d5db);
    border-radius: 4px;
    background: #fff;
    color: var(--gw-text, #111827);
}
.dp-save-actions {
    display: flex;
    gap: 8px;
}

/* -------------------- Choropleth legend widget -------------------- */
/* Mounted absolutely inside the map container (ctx.mapRaw.getContainer()).
 * Bottom-right per DP v3 scoping D25. */
.dp-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--gw-border, #e5e7eb);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--gw-text, #111827);
    min-width: 180px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    pointer-events: none;
}
.dp-legend-label {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--gw-text, #111827);
}
.dp-legend-bar {
    width: 100%;
    height: 12px;
    border-radius: 3px;
    margin: 4px 0;
    border: 1px solid rgba(0, 0, 0, 0.05);
}
.dp-legend-range {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--gw-text-muted, #6b7280);
}

/* -------------------- Deprecated stub (no longer used) --------------- */
.dp-review-stub {
    padding: 16px 12px;
    background: var(--gw-bg-subtle, #f9fafb);
    border-radius: 6px;
    border: 1px dashed var(--gw-border, #d1d5db);
}
.dp-review-stub h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--gw-text, #111827);
}
.dp-review-stub p {
    margin: 4px 0;
    font-size: 12px;
    color: var(--gw-text-muted, #6b7280);
}
.dp-review-stub ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
    font-size: 12px;
    color: var(--gw-text, #111827);
}
.dp-review-stub li {
    padding: 2px 0;
}
