/* ==========================================================================
   City Empathy Layer — Emotional Analytics UI Components
   ========================================================================== */

/* --- Weather widget (reusable across dashboards) --- */
.emo-widget {
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--border, #334155);
    border-radius: 0.75rem;
    padding: 0.875rem;
    font-size: 0.8rem;
}
.emo-widget__head {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.75rem;
}
.emo-widget__icon {
    font-size: 1.75rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.25));
}
.emo-widget__title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
}
.emo-widget__subtitle {
    font-size: 0.6875rem;
    color: var(--text-secondary, #94a3b8);
    margin-top: 0.125rem;
}

/* --- Metrics grid (2-4 cols) --- */
.emo-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.emo-metric {
    text-align: center;
    padding: 0.375rem;
    background: var(--bg-tertiary, #0f172a);
    border-radius: 0.5rem;
    border: 1px solid var(--border, #334155);
}
.emo-metric__value {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}
.emo-metric__label {
    font-size: 0.625rem;
    color: var(--text-secondary, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.125rem;
}
.emo-metric--positive .emo-metric__value { color: #34d399; }
.emo-metric--negative .emo-metric__value { color: #f87171; }
.emo-metric--neutral  .emo-metric__value { color: #60a5fa; }
.emo-metric--hot      .emo-metric__value { color: #fb923c; }

/* --- Stance distribution bars --- */
.emo-stance {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    background: var(--bg-tertiary, #0f172a);
}
.emo-stance__seg {
    transition: width 0.4s ease;
    min-width: 2px;
}
.emo-stance__seg--conservative { background: var(--primary); }
.emo-stance__seg--progressive  { background: var(--success); }
.emo-stance__seg--protective   { background: var(--warning); }
.emo-stance__seg--neutral      { background: #64748b; }

.emo-stance-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 0.75rem;
    font-size: 0.65rem;
    color: var(--text-secondary, #94a3b8);
}
.emo-stance-legend__dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 3px;
    vertical-align: middle;
}

/* --- District emotion list --- */
.emo-districts {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem;
}
.emo-districts__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border, #1e293b);
    font-size: 0.75rem;
}
.emo-districts__item:last-child { border-bottom: none; }
.emo-districts__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary, #e2e8f0);
}
.emo-districts__badge {
    font-size: 0.65rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-weight: 600;
    margin-left: 0.5rem;
    white-space: nowrap;
}
.emo-districts__badge--hot    { background: rgba(239,68,68,.15); color: #f87171; }
.emo-districts__badge--warm   { background: rgba(251,146,60,.15); color: #fb923c; }
.emo-districts__badge--cool   { background: rgba(96,165,250,.15); color: #60a5fa; }
.emo-districts__badge--calm   { background: rgba(52,211,153,.15); color: #34d399; }

/* --- Sparkline bar chart --- */
.emo-sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 32px;
    margin: 0.375rem 0;
}
.emo-sparkline__bar {
    flex: 1;
    min-width: 3px;
    max-width: 12px;
    border-radius: 2px 2px 0 0;
    transition: height 0.3s ease;
}

/* --- Warnings/alerts --- */
.emo-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.5rem;
    font-size: 0.7rem;
    margin-bottom: 0.375rem;
    line-height: 1.35;
}
.emo-alert--danger  { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25); color: #fca5a5; }
.emo-alert--warning { background: rgba(251,146,60,.1); border: 1px solid rgba(251,146,60,.25); color: #fed7aa; }
.emo-alert--info    { background: rgba(96,165,250,.1); border: 1px solid rgba(96,165,250,.25); color: #bfdbfe; }
.emo-alert__icon { font-size: 0.9rem; flex-shrink: 0; }

/* --- Hot spots list (Social Architect) --- */
.emo-hotspots {
    list-style: none;
    padding: 0;
    margin: 0;
}
.emo-hotspots__item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.375rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border, #1e293b);
    font-size: 0.75rem;
    align-items: center;
}
.emo-hotspots__item:last-child { border-bottom: none; }
.emo-hotspots__pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: emo-pulse 1.5s ease-in-out infinite;
}
@keyframes emo-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .6; transform: scale(1.3); }
}

/* --- Section header --- */
.emo-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0.625rem 0 0.375rem;
}
