/*
 * pi-dashboards.css — PI Strategy Dashboard Panels
 * Batch 29: KPI cards, CSS charts, breakdowns per strategy.
 * Zero hardcoded colors — CSS vars only.
 */

/* ============================================================
   DASHBOARD PANEL COMMON
   ============================================================ */
.pi-dashboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    box-sizing: border-box;
}

/* Empty state */
.pi-dashboard-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-dim);
}

.pi-dashboard-empty i {
    font-size: 2.5rem;
    opacity: 0.18;
}

.pi-dashboard-empty__text {
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    color: var(--text-muted);
    letter-spacing: var(--tracking-wide);
}

/* ============================================================
   METRIC CARDS ROW
   ============================================================ */
.dash-kpi-row {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.dash-metric-card {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease;
    overflow: hidden;
}

.dash-metric-card:hover {
    border-color: var(--glass-border-hover);
}

.dash-metric__label {
    font-family: var(--font-heading);
    font-size: 9px;
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-widest);
    color: var(--text-dim);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-metric__value {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
    color: var(--text-cyan, #134160);
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-metric__value--gold    { color: var(--gold-500); }
.dash-metric__value--positive { color: var(--color-positive); }
.dash-metric__value--negative { color: var(--color-negative); }
.dash-metric__value--muted   { color: var(--text-secondary); font-family: var(--font-heading); font-size: var(--text-sm); }

/* ============================================================
   SECTION CARDS
   ============================================================ */
.dash-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.dash-card__title {
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-widest);
    color: var(--text-dim);
    text-transform: uppercase;
}

/* ============================================================
   CSS HORIZONTAL BAR CHARTS
   ============================================================ */
.dash-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dash-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-bar-label {
    font-family: var(--font-heading);
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    width: 100px;
    flex-shrink: 0;
    text-align: right;
}

.dash-bar-track {
    flex: 1;
    height: 10px;
    background: var(--glass-border);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.dash-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
    min-width: 2px;
}

/* Stacked bar */
.dash-bar-track--stacked {
    display: flex;
    overflow: hidden;
    border-radius: var(--radius-full);
}

.dash-bar-segment {
    height: 10px;
    transition: width 0.4s ease;
    min-width: 0;
}

.dash-bar-value {
    font-family: var(--font-heading);
    font-size: 10px;
    color: var(--text-secondary);
    white-space: nowrap;
    width: 68px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* Segment colors */
.dash-seg--navy      { background: var(--text-cyan, #134160); }
.dash-seg--gold      { background: var(--gold-500); }
.dash-seg--green     { background: var(--color-positive); }
.dash-seg--red       { background: var(--color-negative); }
.dash-seg--blue-lt   { background: rgba(19,65,96,0.35); }
.dash-seg--gold-lt   { background: rgba(253,169,41,0.35); }
.dash-seg--muted     { background: var(--glass-border); }

/* ============================================================
   DECISION BOX (compact version for Flip panel)
   ============================================================ */
.dash-decision-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.dash-decision-box__offer-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
}

.dash-decision-box__label {
    font-family: var(--font-heading);
    font-size: 9px;
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-widest);
    color: var(--text-dim);
    text-transform: uppercase;
}

.dash-decision-box__offer {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--weight-black);
    color: var(--gold-500);
    letter-spacing: -0.03em;
    line-height: 1;
}

.dash-decision-box__right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dash-conf-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-heading);
    font-size: 9px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

.dash-conf-bar {
    height: 5px;
    background: var(--glass-border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.dash-conf-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(19,65,96,0.70), #134160);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.dash-verdict {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-size: 9px;
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    width: fit-content;
}

.dash-verdict--strong  { background: var(--color-positive-bg); border: 1px solid var(--color-positive-border); color: var(--color-positive); }
.dash-verdict--caution { background: var(--gold-alpha-20); border: 1px solid var(--gold-alpha-30); color: var(--gold-500); }
.dash-verdict--pass    { background: var(--color-negative-bg); border: 1px solid var(--color-negative-border); color: var(--color-negative); }

/* ============================================================
   CASH FLOW INDICATOR (Rental)
   ============================================================ */
.dash-cashflow-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.dash-cashflow-indicator__label {
    font-family: var(--font-heading);
    font-size: 9px;
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-widest);
    color: var(--text-dim);
    text-transform: uppercase;
}

.dash-cashflow-indicator__value {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: var(--weight-black);
    letter-spacing: -0.03em;
    line-height: 1;
}

.dash-cashflow-indicator__value--positive { color: var(--color-positive); }
.dash-cashflow-indicator__value--negative { color: var(--color-negative); }

.dash-cashflow-indicator__toggle {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.dash-cashflow-toggle-btn {
    padding: 2px 10px;
    background: none;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-size: 9px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.dash-cashflow-toggle-btn.active,
.dash-cashflow-toggle-btn:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    color: var(--text-secondary);
}

/* ============================================================
   FINANCING DONUT (CSS approximation)
   ============================================================ */
.dash-donut-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dash-donut {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
    position: relative;
    background: conic-gradient(
        var(--text-cyan, #134160) 0% var(--donut-principal, 60%),
        var(--gold-alpha-30) var(--donut-principal, 60%) var(--donut-pi, 85%),
        var(--glass-border) var(--donut-pi, 85%) 100%
    );
}

.dash-donut::after {
    content: '';
    position: absolute;
    inset: 18px;
    background: var(--surface-dark);
    border-radius: var(--radius-full);
}

.dash-donut-legend {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dash-donut-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-heading);
    font-size: 10px;
    color: var(--text-secondary);
}

.dash-donut-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .dash-kpi-row {
        flex-wrap: wrap;
    }

    .dash-metric-card {
        flex: 0 0 calc(50% - 4px);
    }
}

@media (max-width: 600px) {
    .dash-decision-box {
        flex-direction: column;
        align-items: flex-start;
    }

    .dash-bar-label {
        width: 70px;
    }
}

/* ============================================================
   BATCH 35 — DECISION HERO (Wholesale + Fix & Flip)
   ============================================================ */

/* Hero card */
.dash-hero {
    display: flex;
    gap: 0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--text-cyan, #134160);
    border-radius: 0 12px 12px 0;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.25s ease, opacity 0.25s ease;
}

/* Verdict state borders */
.dash-hero--strong   { border-left-color: var(--gold-500) !important; background: var(--gold-alpha-10) !important; }
.dash-hero--caution  { border-left-color: #f59e0b !important; }
.dash-hero--pass     { border-left-color: var(--color-negative) !important; opacity: 0.42; }

/* PASSED stamp overlay */
.dash-hero-stamp {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

.dash-hero--pass .dash-hero-stamp {
    display: flex;
}

.dash-hero-stamp__text {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: var(--weight-black);
    color: var(--color-negative);
    opacity: 0.30;
    letter-spacing: 0.15em;
    transform: rotate(-15deg);
    user-select: none;
    -webkit-user-select: none;
}

/* ── LEFT ZONE (60%) ── */
.dash-hero__left {
    flex: 60;
    min-width: 0;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dash-hero__eyebrow {
    font-family: var(--font-heading);
    font-size: 9px;
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-widest);
    color: var(--text-dim);
    text-transform: uppercase;
}

.dash-hero__offer {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: var(--weight-black);
    color: var(--gold-500);
    letter-spacing: -0.03em;
    line-height: 1;
}

.dash-hero__mao {
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    color: var(--text-dim);
    letter-spacing: var(--tracking-wide);
}

.dash-hero__reasoning {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 320px;
}

/* Action buttons */
.dash-hero__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.dash-hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    position: relative;
}

.dash-hero-btn--offer {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-fg);
    border: none;
}

.dash-hero-btn--offer:hover {
    background: var(--btn-primary-bg-hover);
    box-shadow: var(--glow-gold-sm);
}

.dash-hero-btn--negotiate {
    background: none;
    border: 1.5px solid var(--text-cyan, #134160);
    color: var(--text-cyan, #134160);
}

.dash-hero-btn--negotiate:hover {
    background: rgba(19,65,96,0.06);
}

.dash-hero-btn--pass {
    background: none;
    border: 1.5px solid var(--color-negative);
    color: var(--color-negative);
    opacity: 0.75;
}

.dash-hero-btn--pass:hover {
    background: rgba(220,38,38,0.05);
    opacity: 1;
}

/* Copied tooltip */
.dash-hero-btn__tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--surface-dark);
    font-size: 10px;
    font-family: var(--font-heading);
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.dash-hero-btn__tooltip.visible {
    opacity: 1;
}

/* Negotiate inline input */
.dash-hero-counter {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.dash-hero-counter.visible {
    display: flex;
}

.dash-hero-counter__input {
    padding: 5px 10px;
    background: var(--surface-dark);
    border: 1.5px solid var(--glass-border);
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    color: var(--text-primary);
    outline: none;
    width: 130px;
    transition: border-color 0.15s ease;
}

.dash-hero-counter__input:focus {
    border-color: var(--glass-border-hover);
}

.dash-hero-counter__result {
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ── RIGHT ZONE (40%) ── */
.dash-hero__right {
    flex: 40;
    min-width: 0;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-left: 1px solid var(--glass-border);
}

/* Circular confidence ring */
.dash-conf-ring-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.dash-conf-ring {
    width: 80px;
    height: 80px;
    border-radius: 999px;
    background: conic-gradient(
        var(--ring-color, var(--text-cyan, #134160)) 0% var(--ring-pct, 0%),
        var(--glass-border) var(--ring-pct, 0%) 100%
    );
    position: relative;
}

.dash-conf-ring::after {
    content: '';
    position: absolute;
    inset: 12px;
    background: var(--surface-dark);
    border-radius: 999px;
}

.dash-conf-ring__value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
    color: var(--text-primary);
    z-index: 2;
    letter-spacing: -0.02em;
}

.dash-conf-ring-label {
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-widest);
    text-transform: uppercase;
}

.dash-conf-ring-label--high    { color: var(--color-positive); }
.dash-conf-ring-label--moderate { color: #f59e0b; }
.dash-conf-ring-label--low     { color: var(--color-negative); }

/* Profit summary in hero right zone */
.dash-hero-profit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.dash-hero-profit__label {
    font-family: var(--font-heading);
    font-size: 9px;
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-widest);
    color: var(--text-dim);
    text-transform: uppercase;
}

.dash-hero-profit__value {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    letter-spacing: -0.02em;
}

.dash-hero-profit__value--positive { color: var(--color-positive); }
.dash-hero-profit__value--negative { color: var(--color-negative); }
