/* ═══════════════════════════════════════════════════
   CWE/CAPEC Detail Page Styles
   ═══════════════════════════════════════════════════ */

.cwe-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ── Hero ── */
.cwe-hero {
    text-align: center;
    padding: 2rem 1rem 1rem;
}
.cwe-hero-id {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
}
.cwe-hero-name {
    color: #94A3B8;
    font-size: 1rem;
    max-width: 700px;
    margin: 0.5rem auto 0;
    line-height: 1.5;
}
.cwe-badges {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.cwe-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}
.cwe-badge.abstraction { background: rgba(79, 70, 229, 0.1); color: #4f46e5; border: 1px solid rgba(79, 70, 229, 0.3); }
.cwe-badge.status { background: rgba(22, 163, 74, 0.1); color: #16a34a; border: 1px solid rgba(22, 163, 74, 0.3); }
.cwe-badge.likelihood-high { background: rgba(239, 68, 68, 0.1); color: #b91c1c; border: 1px solid rgba(239, 68, 68, 0.3); }
.cwe-badge.likelihood-medium { background: rgba(245, 158, 11, 0.12); color: #b45309; border: 1px solid rgba(245, 158, 11, 0.35); }
.cwe-badge.likelihood-low { background: rgba(30, 64, 175, 0.1); color: #1e40af; border: 1px solid rgba(30, 64, 175, 0.3); }

/* ── Stats Row ── */
.cwe-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.8rem;
    margin: 1.5rem 0;
}
.cwe-stat-card {
    background: rgba(241, 245, 249, 0.6);
    border: 1px solid rgba(203, 213, 225, 0.3);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}
.cwe-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #334155;
}
.cwe-stat-label {
    font-size: 0.7rem;
    color: #64748B;
    margin-top: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Section Cards ── */
.cwe-section {
    background: rgba(241, 245, 249, 0.6);
    border: 1px solid rgba(203, 213, 225, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}
.cwe-section h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #334155;
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cwe-section h3 i { color: #36d0ea; font-size: 0.9rem; }
.cwe-section p {
    color: #94A3B8;
    line-height: 1.7;
    font-size: 0.88rem;
    margin: 0.5rem 0;
}

/* ── Two Column Layout ── */
.cwe-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 768px) {
    .cwe-grid-2col { grid-template-columns: 1fr; }
}

/* ── Hierarchy Tree ── */
.cwe-hierarchy {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.cwe-hier-level {
    padding-left: 0;
}
.cwe-hier-level-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}
.cwe-hier-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* ── Chips (shared for CWE/CAPEC/CVE) ── */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}
.chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.chip.cwe {
    background: rgba(100, 116, 139, 0.12);
    color: #c084fc;
    border: 1px solid rgba(100, 116, 139, 0.25);
}
.chip.cwe:hover { background: rgba(100, 116, 139, 0.25); }
.chip.cwe.current {
    background: rgba(100, 116, 139, 0.3);
    border-color: rgba(100, 116, 139, 0.6);
    color: #e9d5ff;
}
.chip.capec {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.25);
}
.chip.capec:hover { background: rgba(245, 158, 11, 0.25); }
.chip.cve {
    background: rgba(54, 208, 234, 0.1);
    color: #67e8f9;
    border: 1px solid rgba(54, 208, 234, 0.2);
}
.chip.cve:hover { background: rgba(54, 208, 234, 0.2); }
.chip.severity-critical { border-left: 3px solid #991b1b; }
.chip.severity-high { border-left: 3px solid #475569; }
.chip.severity-medium { border-left: 3px solid #94a3b8; }
.chip.severity-low { border-left: 3px solid #22c55e; }

/* ── Badge Tooltips ── */
.cwe-badge-tooltip {
    position: relative;
}
.cwe-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid rgba(203, 213, 225, 0.5);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 0.72rem;
    line-height: 1.7;
    color: #475569;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    pointer-events: none;
    font-weight: 400;
}
.cwe-tooltip strong {
    color: #334155;
    font-size: 0.75rem;
    display: block;
    margin-bottom: 0.3rem;
}
.cwe-badge-tooltip:hover .cwe-tooltip {
    display: block;
}

/* ── CVE List in CWE/CAPEC Detail ── */
.cwe-cves-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.cwe-cve-row {
    display: grid;
    grid-template-columns: 160px auto 1fr auto;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
}
.cwe-cve-row:first-child {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.cwe-cve-row:hover {
    background: rgba(255, 255, 255, 0.03);
}
.cwe-cve-id {
    font-family: 'Inter', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: #60a5fa;
    white-space: nowrap;
}
.cwe-cve-badges {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}
.cwe-cve-scores {
    display: flex;
    gap: 0.8rem;
    justify-content: flex-end;
    align-items: center;
}
.cwe-cve-score {
    font-family: 'Inter', monospace;
    font-size: 0.8rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}
.cwe-cve-score.epss {
    color: #36d0ea;
    font-weight: 600;
}
.cwe-cve-date {
    font-family: monospace;
    font-size: 0.72rem;
    color: #64748B;
    white-space: nowrap;
}
@media (max-width: 768px) {
    .cwe-cve-row {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }
    .cwe-cve-scores {
        justify-content: flex-start;
    }
}

/* ── Top CVEs Table ── */
.cwe-cve-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.cwe-cve-table th {
    text-align: left;
    padding: 0.5rem;
    color: #64748B;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(203, 213, 225, 0.3);
}
.cwe-cve-table td {
    padding: 0.5rem;
    color: #475569;
    border-bottom: 1px solid rgba(203, 213, 225, 0.15);
}
.cwe-cve-table tr:hover { background: rgba(203, 213, 225, 0.1); }
.cwe-cve-table .mono { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }
.cwe-cve-table a { color: #67e8f9; text-decoration: none; }
.cwe-cve-table a:hover { text-decoration: underline; }

/* ── Consequences / Mitigations ── */
.cwe-list-item {
    background: rgba(203, 213, 225, 0.1);
    border-radius: 8px;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
}
.cwe-list-item-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.3rem;
}
.cwe-list-item-body {
    font-size: 0.8rem;
    color: #94A3B8;
    line-height: 1.6;
}

/* ── Error State ── */
.cwe-error {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748B;
}
.cwe-error i { font-size: 3rem; margin-bottom: 1rem; display: block; }
.cwe-error h2 { color: #94A3B8; margin: 0 0 0.5rem; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .cwe-container { padding: 1rem; }
    .cwe-hero-id { font-size: 1.5rem; }
    .cwe-stats-row { grid-template-columns: repeat(2, 1fr); }
}
