/* ============================================
   IMPAICT Diagnostic — Styles
   ============================================ */

:root {
    --diag-plus: #1D9E75;
    --diag-minus: #D85A30;
    --diag-alert: #E24B4A;
    --diag-neutral: #888780;
    --diag-paper: #F4F1EC;
    --diag-border: #E2DDD6;
    --diag-text: #1A1A1A;
    --diag-text-light: #4A5568;
    --diag-text-muted: #8A9DB0;
}

/* --- Search & Sort bar --- */
.diag-search-section {
    padding: 0 0 1.5rem;
}
.diag-search-bar {
    position: relative;
    max-width: 700px;
    margin: 0 auto 1rem;
}
.diag-search-bar__icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--diag-text-muted, #8A9DB0);
    pointer-events: none;
}
.diag-search-bar__input {
    width: 100%;
    padding: 0.85rem 2.5rem 0.85rem 2.8rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text, #fff);
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border, rgba(255,255,255,0.12));
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.diag-search-bar__input::placeholder {
    color: var(--text-muted, #6B7B8D);
    font-size: 0.88rem;
}
.diag-search-bar__input:focus {
    border-color: var(--accent-cool, #4A8FE7);
    box-shadow: 0 0 0 3px rgba(74,143,231,0.15);
}
.diag-search-bar__clear {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted, #6B7B8D);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    line-height: 1;
    border-radius: 4px;
}
.diag-search-bar__clear:hover {
    color: var(--text, #fff);
    background: rgba(255,255,255,0.1);
}
.diag-sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 700px;
    margin: 0 auto;
}
.diag-sort-bar__count {
    font-size: 0.82rem;
    color: var(--text-muted, #6B7B8D);
}
.diag-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border, rgba(255,255,255,0.12));
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    color: var(--text-muted, #6B7B8D);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.diag-sort-btn:hover {
    color: var(--text, #fff);
    border-color: var(--accent-cool, #4A8FE7);
}
.diag-no-results {
    text-align: center;
    color: var(--text-muted, #6B7B8D);
    padding: 3rem 0;
    font-size: 0.95rem;
}

/* --- Badge --- */
.diag-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    background: rgba(212, 69, 26, 0.15);
    color: #D4451A;
    margin-bottom: 1rem;
}

/* --- Profile badge (card) --- */
.diag-card__profile {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.25rem 0.65rem;
    border-radius: 5px;
    margin-bottom: 0.75rem;
    align-self: flex-start;
}
.diag-card__profile-icon {
    font-size: 0.75rem;
    line-height: 1;
}

/* --- Listing cards --- */
.diag-card {
    display: flex;
    flex-direction: column;
    background: var(--diag-paper);
    border: 1px solid var(--diag-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--diag-text);
    transition: transform 0.3s, box-shadow 0.3s;
}
.diag-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.diag-card__gauge {
    margin-bottom: 1rem;
}
.diag-card__gauge-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--diag-text-light);
    margin-bottom: 0.4rem;
}
.diag-card__gauge-bar {
    height: 6px;
    background: var(--diag-border);
    border-radius: 3px;
    overflow: hidden;
}
.diag-card__gauge-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}
.diag-card__title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.5rem;
    color: var(--diag-text);
}
.diag-card__summary {
    font-size: 0.9rem;
    color: var(--diag-text-light);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 1rem;
}
.diag-card__cta {
    font-size: 0.85rem;
    font-weight: 600;
    color: #D4451A;
}

/* --- Diagnostic section --- */
.diag-section {
    padding: 2rem 0 4rem;
}

/* --- Tabs --- */
.diag-tabs {
    display: flex;
    gap: 0.25rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.25rem;
    margin-bottom: 2rem;
}
.diag-tab {
    flex: 1;
    padding: 0.65rem 1rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.diag-tab:hover {
    color: var(--text);
}
.diag-tab--active {
    background: rgba(255,255,255,0.1);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* --- Exposure gauge --- */
.diag-exposure {
    margin-bottom: 1.5rem;
}
.diag-exposure__label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.diag-exposure__label strong {
    font-size: 1rem;
}
.diag-exposure__bar {
    height: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.diag-exposure__fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease, background 0.3s;
}

/* --- Synthesis --- */
.diag-synthesis {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 0 8px 8px 0;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
}

/* --- Detail panel --- */
.diag-detail {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    animation: diagSlideDown 0.25s ease;
}
@keyframes diagSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.diag-detail__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.diag-detail__header h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}
.diag-detail__close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}
.diag-detail__close:hover { color: var(--text); }
.diag-detail__body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.diag-detail__plus, .diag-detail__minus {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text);
}
.diag-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}
.diag-tag--plus { background: rgba(29,158,117,0.15); color: var(--diag-plus); }
.diag-tag--minus { background: rgba(216,90,48,0.15); color: var(--diag-minus); }

/* --- Grid --- */
.diag-grid-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 12px;
}
.diag-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.diag-grid th {
    padding: 0.6rem 0.5rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.diag-grid th:first-child {
    text-align: left;
    padding-left: 1rem;
    min-width: 140px;
    position: sticky;
    left: 0;
    background: var(--dark);
    z-index: 2;
}
.diag-grid td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.diag-grid td:first-child {
    padding-left: 1rem;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text);
    white-space: nowrap;
    position: sticky;
    left: 0;
    background: var(--dark);
    z-index: 2;
}
.diag-grid tr:last-child td { border-bottom: none; }

/* Row label dot */
.diag-row-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: middle;
}

/* Cell */
.diag-cell {
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.15s;
    min-width: 90px;
}
.diag-cell:hover {
    background: rgba(255,255,255,0.06);
}
.diag-cell--active {
    background: rgba(46,74,122,0.15) !important;
    outline: 2px solid var(--accent-cool);
    outline-offset: -2px;
}

/* Balance bars */
.diag-balance {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.diag-bar-row {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 7px;
}
.diag-bar {
    height: 100%;
    border-radius: 2px;
    min-width: 2px;
    transition: width 0.3s;
}
.diag-bar--plus { background: var(--diag-plus); }
.diag-bar--minus { background: var(--diag-minus); }

/* Net label */
.diag-net {
    font-size: 0.65rem;
    font-weight: 700;
    text-align: center;
    margin-top: 2px;
    letter-spacing: 0.02em;
}
.diag-net--positive { color: var(--diag-plus); }
.diag-net--slight { color: #5AB88F; }
.diag-net--tense { color: var(--diag-neutral); }
.diag-net--negative { color: var(--diag-minus); }
.diag-net--alert { color: var(--diag-alert); }

/* --- Reading guide --- */
.diag-reading-guide {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}
.diag-reading-guide__title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.diag-reading-guide__items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.diag-reading-guide__item {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    font-size: 0.82rem;
    line-height: 1.5;
}
.diag-reading-guide__item .diag-legend__dot {
    margin-top: 0.3rem;
    flex-shrink: 0;
}
.diag-reading-guide__item strong {
    display: block;
    color: var(--text);
    margin-bottom: 0.15rem;
}
.diag-reading-guide__item span {
    color: var(--text-muted);
}
.diag-reading-guide__cta {
    font-size: 0.85rem;
    color: var(--text);
    padding: 0.6rem 0.8rem;
    background: rgba(46, 74, 122, 0.12);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--accent-cool);
}
.diag-reading-guide__cta strong {
    color: var(--accent-cool-light);
}
.diag-reading-guide__note {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

/* --- Column tooltip --- */
.diag-th-tooltip {
    position: relative;
}
.diag-tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
    font-size: 0.55rem;
    font-weight: 700;
    margin-left: 2px;
    vertical-align: middle;
    cursor: pointer;
    position: relative;
}
.diag-tooltip-bubble {
    display: none;
    position: fixed;
    background: #0f1520;
    color: #D8DEE9;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.5;
    white-space: normal;
    width: 220px;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    z-index: 999;
    pointer-events: auto;
}
.diag-tooltip-trigger:hover .diag-tooltip-bubble,
.diag-tooltip-trigger:focus .diag-tooltip-bubble,
.diag-tooltip-trigger.is-open .diag-tooltip-bubble {
    display: block;
}

/* --- Legacy legend (kept for compat) --- */
.diag-legend {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
}
.diag-legend__dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 0.3rem;
    vertical-align: middle;
}

/* --- Actions section --- */
.diag-actions {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border);
}
.diag-actions__title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text);
}
.diag-actions__subtitle {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 700px;
}
.diag-actions__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}
.diag-action-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
}
.diag-action-card__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}
.diag-action-card__impact {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: rgba(200,164,110,0.15);
    color: var(--gold);
    margin-left: 0.5rem;
    vertical-align: middle;
}
.diag-action-card__title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text);
}
.diag-action-card__desc {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 0.75rem;
}
.diag-action-card__wwd {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* --- CTA --- */
.diag-cta {
    background: linear-gradient(135deg, var(--accent), rgba(46,74,122,0.8));
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}
.diag-cta p {
    color: rgba(255,255,255,0.85);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1.25rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .diag-reading-guide__items {
        grid-template-columns: 1fr;
    }
    .diag-detail__body {
        grid-template-columns: 1fr;
    }
    .diag-tabs {
        flex-direction: column;
    }
    .diag-grid th:first-child,
    .diag-grid td:first-child {
        min-width: 80px;
        white-space: normal;
    }
    .diag-cell {
        min-width: 75px;
    }

    /* Search & Sort — mobile */
    .diag-search-section {
        padding: 0 0 1rem;
    }
    .diag-search-bar {
        margin-bottom: 0.65rem;
    }
    .diag-search-bar__input {
        font-size: 0.88rem;
        padding: 0.75rem 2.2rem 0.75rem 2.5rem;
        border-radius: 10px;
    }
    .diag-search-bar__input::placeholder {
        font-size: 0.78rem;
    }
    .diag-search-bar__icon {
        left: 0.75rem;
        width: 18px;
        height: 18px;
    }
    .diag-search-bar__clear {
        right: 0.5rem;
    }
    .diag-sort-bar {
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .diag-sort-bar__count {
        font-size: 0.75rem;
    }
    .diag-sort-btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.65rem;
        gap: 0.3rem;
    }
    .diag-sort-btn svg {
        width: 14px;
        height: 14px;
    }

    /* Profile badge — mobile */
    .diag-card__profile {
        font-size: 0.62rem;
        padding: 0.2rem 0.5rem;
        margin-bottom: 0.6rem;
    }
}
