/* ================================================================
   product-vulnerability-list.css  — aligned to docc standards
   ================================================================ */

html, body { overflow-x: hidden; }
.vuln-list-page { background: #fbfbfc; color: #1e293b; }

/* ---- Hero (mirrors docc-supported-hero) ------------------------- */
.vuln-hero {
    min-height: 400px;
    padding-top: 72px;
    background: linear-gradient(180deg, #1A0E50 0%, #432CB1 41%, #8673DF 67%, #A888FF 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.vuln-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(90deg, rgba(255,255,255,0.06) 0, rgba(255,255,255,0.06) 1px, transparent 1px, transparent 52px),
        repeating-linear-gradient(180deg, rgba(255,255,255,0.06) 0, rgba(255,255,255,0.06) 1px, transparent 1px, transparent 55px);
    pointer-events: none;
}

.vuln-hero-content {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    text-align: center;
    color: #fff;
    padding-bottom: 40px;
}

.vuln-hero h1 {
    margin: 0 0 16px;
    font-size: var(--title-hero);
    line-height: 68px;
    font-weight: 600;
    letter-spacing: 0;
}

.vuln-hero-desc {
    margin: 0;
    font-size: 20px;
    line-height: 30px;
    color: rgba(255,255,255,0.92);
}

.vuln-hero-updated {
    margin: 14px 0 0;
    font-size: 13px;
    color: rgba(255,255,255,0.55);
}
.vuln-section {
    padding: 56px 0 88px;
    background: #fbfbfc;
}

.vuln-container {
    width: min(1668px, calc(100% - 200px));
    margin: 0 auto;
}

/* ---- Charts -------------------------------------------------------- */
.vuln-charts {
    display: none; /* 暂时隐藏，数据量充足后改回 grid */
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
    align-items: start;
}

.vuln-chart-card {
    background: #fff;
    border: 1px solid #e8eaf0;
    border-radius: 10px;
    padding: 24px 28px;
}

.vuln-chart-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 16px;
}

.vuln-chart-body--donut {
    display: flex;
    align-items: center;
    gap: 24px;
}

.vuln-chart-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; }

.vuln-chart-legend li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .12s;
}

.vuln-chart-legend li:hover { background: #f5f3ff; }
.vuln-chart-legend li.leg-active { background: #ede9fe; font-weight: 600; }
.vuln-chart-legend .leg-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.vuln-chart-legend .leg-name { flex: 1; }
.vuln-chart-legend .leg-stat { font-size: 12px; color: #94a3b8; white-space: nowrap; }

/* ---- Stats ------------------------------------------------------ */
.vuln-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.vuln-stat-card {
    flex: 1 1 120px;
    background: #fff;
    border: 1px solid #e8eaf0;
    border-radius: 10px;
    padding: 20px 24px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(15,23,42,0.04);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.vuln-stat-card:hover { border-color: #c4b5fd; }

.vuln-stat-card--active {
    border: 2px solid #7c3aed !important;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.08);
}

.vuln-stat-num {
    display: block;
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
}

.vuln-stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.8px;
    color: #94a3b8;
}

.vuln-stat-critical .vuln-stat-num { color: #dc2626; }
.vuln-stat-high     .vuln-stat-num { color: #ea580c; }
.vuln-stat-medium   .vuln-stat-num { color: #d97706; }
.vuln-stat-low      .vuln-stat-num { color: #16a34a; }
.vuln-stat-total    .vuln-stat-num  { color: #1e293b; }
.vuln-stat-total    .vuln-stat-label { color: #94a3b8; }

.vuln-stat-card--active {
    border: 2px solid #7c3aed !important;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.08);
}

/* ---- Policy — no card, flush with page bg ----------------------- */
.vuln-policy {
    margin-bottom: 48px;
}

.vuln-policy-title {
    margin: 0 0 16px;
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.vuln-policy-desc {
    margin: 0 0 16px;
    font-size: 15px;
    color: #475569;
    line-height: 1.75;
}

.vuln-policy-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.vuln-policy-list li {
    font-size: 15px;
    color: #475569;
    line-height: 1.75;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.vuln-policy-list li::before {
    content: "\25CF";
    position: absolute;
    left: 0;
    top: 4px;
    font-size: 9px;
    color: #7c3aed;
}

/* ---- Toolbar ---------------------------------------------------- */
.vuln-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.vuln-toolbar-left {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.vuln-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---- 列设置 ----------------------------------------------------- */
.vuln-col-settings { position: relative; }

.vuln-col-settings-btn {
    height: 36px;
    padding: 0 14px;
    border: 1px solid #dde1ea;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.vuln-col-settings-btn:hover { border-color: #7c3aed; color: #7c3aed; }

.vuln-col-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1px solid #e8eaf0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15,23,42,0.10);
    padding: 8px 0;
    min-width: 130px;
    z-index: 200;
    display: none;
}

.vuln-col-dropdown.open { display: block; }

.vuln-col-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    user-select: none;
}

.vuln-col-option:hover { background: #f8fafc; }

.vuln-col-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #7c3aed;
    cursor: pointer;
    flex-shrink: 0;
}

.vuln-filter-select {
    height: 36px;
    padding: 0 28px 0 12px;
    border: 1px solid #dde1ea;
    border-radius: 6px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
    -webkit-appearance: none;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    min-width: 120px;
}

.vuln-filter-select:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.08);
}

.vuln-search {
    height: 36px;
    width: 260px;
    padding: 0 12px;
    border: 1px solid #dde1ea;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    background: #fff;
}

.vuln-search:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.08);
}

.vuln-result-count {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
}

/* ---- Tabs ------------------------------------------------------- */
.vuln-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e8eaf0;
    margin-bottom: 0;
}

.vuln-tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color .15s, border-color .15s;
}

.vuln-tab:hover { color: #7c3aed; }

.vuln-tab--active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

/* ---- Table ------------------------------------------------------ */
.vuln-table-wrap {
    background: #fff;
    border: 1px solid #e8eaf0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow-x: auto;
    position: relative;
}

.vuln-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.vuln-table thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid #e8eaf0;
    background: #fafbfd;
    white-space: nowrap;
}

.vuln-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background .1s;
}

.vuln-table tbody tr:last-child { border-bottom: none; }
.vuln-table tbody tr:hover { background: #fafbff; }

.vuln-table td {
    padding: 14px 16px;
    vertical-align: middle;
}

.col-id       { width: 130px; white-space: nowrap; }
.col-name     { min-width: 200px; }
.col-family   { width: 120px; }
.col-severity { width: 110px; }
.col-products { min-width: 160px; }
.col-version  { width: 160px; font-size: 12px; color: #94a3b8; }
.col-status   { width: 90px; }
.col-discover { width: 100px; white-space: nowrap; }
.col-date     { width: 100px; white-space: nowrap; }

/* plugin-id link */
.vuln-plugin-id {
    color: #7c3aed;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}
.vuln-plugin-id:hover { text-decoration: underline; }

/* severity badges */
.vuln-severity {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
    white-space: nowrap;
}

.vuln-severity::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.vuln-sev-critical { background: #fef2f2; color: #b91c1c; }
.vuln-sev-critical::before { background: #dc2626; }
.vuln-sev-high     { background: #fff7ed; color: #c2410c; }
.vuln-sev-high::before { background: #ea580c; }
.vuln-sev-medium   { background: #fffbeb; color: #92400e; }
.vuln-sev-medium::before { background: #d97706; }
.vuln-sev-low      { background: #f0fdf4; color: #166534; }
.vuln-sev-low::before { background: #16a34a; }
.vuln-sev-unrated  { background: #f8fafc; color: #64748b; }
.vuln-sev-unrated::before { background: #94a3b8; }

/* product badges */
.vuln-products {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.vuln-product-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #ede9fe;
    color: #5b21b6;
    white-space: nowrap;
}

/* status badge */
.vuln-status { font-size: 13px; }
.vuln-status-fixed   { color: #16a34a; }
.vuln-status-fixing  { color: #ea580c; }
.vuln-status-default { color: #64748b; }

/* sortable header */
.vuln-sortable { cursor: pointer; user-select: none; }
.vuln-sortable:hover { color: #7c3aed; }
.vuln-sortable.sorted-asc  .sort-icon::after { content: ' ↑'; }
.vuln-sortable.sorted-desc .sort-icon::after { content: ' ↓'; }
.sort-icon { opacity: .4; font-size: 10px; }
.vuln-sortable.sorted-asc .sort-icon,
.vuln-sortable.sorted-desc .sort-icon { opacity: 1; color: #7c3aed; }

/* empty / loading states */
.vuln-empty, .vuln-loading {
    padding: 60px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}

.vuln-empty p { margin: 0 0 12px; }

.vuln-empty button {
    padding: 8px 18px;
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* ---- Pagination ------------------------------------------------- */
.vuln-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    flex-wrap: wrap;
    gap: 12px;
}

.vuln-page-info {
    font-size: 13px;
    color: #64748b;
}

.vuln-page-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.vuln-page-btn {
    height: 32px;
    padding: 0 14px;
    border: 1px solid #dde1ea;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all .15s;
}

.vuln-page-btn:hover:not(:disabled) { border-color: #7c3aed; color: #7c3aed; }
.vuln-page-btn:disabled { opacity: .4; cursor: not-allowed; }

.vuln-page-num {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #dde1ea;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    text-align: center;
    line-height: 30px;
    display: inline-block;
    transition: all .15s;
}

.vuln-page-num:hover { border-color: #7c3aed; color: #7c3aed; }
.vuln-page-num.active { background: #7c3aed; color: #fff; border-color: #7c3aed; }

.vuln-page-size {
    height: 32px;
    padding: 0 24px 0 10px;
    border: 1px solid #dde1ea;
    border-radius: 6px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center;
    -webkit-appearance: none;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
}

/* ---- Summary grouped table -------------------------------------- */
.vuln-summary-tbl {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e8eaf0;
    border-radius: 8px;
    overflow: hidden;
    font-size: 13px;
    margin-top: 20px;
}

.vuln-summary-tbl thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: #f8f9fc;
    border-bottom: 1px solid #e8eaf0;
    white-space: nowrap;
}

.sum-group-row { cursor: pointer; background: #f8f9fc; border-bottom: 1px solid #e8eaf0; }
.sum-group-row:hover { background: #f1f2f8; }
.sum-group-row.sum-expanded { background: #f5f3ff; }
.sum-group-row td { padding: 14px 16px; vertical-align: middle; }

.sum-expand { display: inline-block; font-size: 10px; color: #7c3aed; margin-right: 8px; width: 12px; }

.sum-child-row td { padding: 11px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; background: #fff; }
.sum-child-row:last-child td { border-bottom: none; }
.sum-child-name-cell { padding-left: 36px !important; }
.sum-child-id { color: #7c3aed; font-size: 12px; margin-right: 8px; font-weight: 500; }
.sum-count { font-weight: 600; color: #374151; }

.sum-col-name { min-width: 300px; }
.sum-col-sev  { width: 130px; }
.sum-col-cnt  { width: 70px; }
.sum-col-prod { min-width: 160px; }
.vuln-summary-bar-medium   { background: #d97706; }
.vuln-summary-bar-low      { background: #16a34a; }

/* ---- Responsive ------------------------------------------------- */
@media (max-width: 1023px) {
    .vuln-container { width: min(1668px, calc(100% - 80px)); }
    .vuln-hero { min-height: 320px; }
    .vuln-stats { gap: 10px; }
    .vuln-stat-card { padding: 16px 12px; }
    .vuln-stat-num { font-size: 28px; }
}

@media (max-width: 767px) {
    .vuln-container { width: calc(100% - 40px); }
    .vuln-hero h1 { font-size: 32px; line-height: 1.2; }
    .vuln-hero-desc { font-size: 15px; }
    .vuln-stat-card { flex: 1 1 calc(50% - 8px); padding: 14px 10px; }
    .vuln-stat-total { flex: 1 1 100%; }
    .vuln-policy { padding: 20px; }

    /* 图1: 均衡行宽消除孤字，保持居中 */
    .vuln-hero-content { text-align: center; }
    .vuln-hero h1 { line-height: 1.2; }
    .vuln-hero-desc {
        font-size: 14px;
        text-wrap: balance;
        overflow-wrap: anywhere;
    }

    /* 图2: 图表单列堆叠 */
    .vuln-charts { grid-template-columns: 1fr; }
    /* 甜甜圈改为纵向：图在上，legend 在下 */
    .vuln-chart-body--donut { flex-direction: column; align-items: flex-start; gap: 16px; }
    #chartSeverity { width: 100% !important; height: 140px !important; }
    .vuln-chart-legend { width: 100%; }

    /* 图3: 筛选项 2×2 grid */
    .vuln-toolbar { flex-direction: column; align-items: stretch; }
    .vuln-toolbar-left {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .vuln-toolbar-right { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
    .vuln-search { flex: 1 1 100%; width: 100%; min-width: 0; }
    .vuln-filter-select { min-width: unset; width: 100%; }
    .vuln-pagination { flex-direction: column; align-items: flex-start; }

    /* 图4: 汇总表格横滚 + 右侧渐变提示 */
    #summaryGrid { position: relative; }
    #summaryGrid::after {
        content: '';
        position: absolute;
        top: 0; right: 0; bottom: 0;
        width: 40px;
        background: linear-gradient(to right, transparent, rgba(248,249,252,0.9));
        pointer-events: none;
    }
    .vuln-summary-tbl-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
