/* ─── Compat Overlay Redesign — Tabbed UI ─────────────────────────────── */

.compat-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.compat-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    font-size: 0.775rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    transition: color 0.15s;
    margin-bottom: -1px;
}

.compat-tab:hover { color: var(--text-secondary); }

.compat-tab.is-active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

.compat-tab__count {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    line-height: 1.4;
}

.compat-tab--errors .compat-tab__count   { background: rgba(248, 113, 113, 0.18); color: #f87171; }
.compat-tab--warnings .compat-tab__count { background: rgba(250, 204, 21, 0.18);  color: #facc15; }
.compat-tab--passed .compat-tab__count   { background: rgba(74, 222, 128, 0.12);  color: #4ade80; }
.compat-tab--unknown .compat-tab__count  { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }

/* Tab panels */
.compat-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    max-height: 360px;
    overflow-y: auto;
}

/* Check cards */
.compat-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: 7px;
    border: 1px solid;
}

.compat-card--error   { background: rgba(248, 113, 113, 0.05); border-color: rgba(248, 113, 113, 0.15); }
.compat-card--warning { background: rgba(250, 204, 21, 0.05);  border-color: rgba(250, 204, 21, 0.15); }
.compat-card--passed  { background: rgba(74, 222, 128, 0.04);  border-color: rgba(74, 222, 128, 0.12); }
.compat-card--unknown { background: rgba(100, 116, 139, 0.04); border-color: rgba(100, 116, 139, 0.12); }

.compat-card__icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.compat-card--error   .compat-card__icon { background: rgba(248, 113, 113, 0.2); color: #f87171; }
.compat-card--warning .compat-card__icon { background: rgba(250, 204, 21, 0.2);  color: #facc15; }
.compat-card--passed  .compat-card__icon { background: rgba(74, 222, 128, 0.18); color: #4ade80; }
.compat-card--unknown .compat-card__icon { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }

.compat-card__body { flex: 1; min-width: 0; }

.compat-card__title {
    font-size: 0.8375rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.compat-card__message {
    font-size: 0.775rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-top: 3px;
}

/* Component chips */
.compat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 7px;
}

.compat-chip {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.compat-chip b { color: var(--text-secondary); }

/* Footer summary pills */
.compat-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-top: 1px solid var(--border);
    font-size: 0.73rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.compat-pill {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.7rem;
}

.compat-pill--error   { background: rgba(248, 113, 113, 0.12); color: #f87171; }
.compat-pill--warning { background: rgba(250, 204, 21, 0.12);  color: #facc15; }
.compat-pill--passed  { background: rgba(74, 222, 128, 0.1);   color: #4ade80; }

/* Mobile: bottom sheet */
@media (max-width: 767px) {
    .popup-overlay--compat {
        align-items: flex-end;
        padding: 0;
    }

    .popup-overlay--compat .popup--compatibility {
        border-radius: 16px 16px 0 0;
        max-height: 78vh;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }

    .popup-overlay--compat .popup--compatibility.is-open {
        transform: translateY(0);
    }

    .compat-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .compat-card__title,
    .compat-card__message {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .compat-chip {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
