/* General Body & Font Styles */
body.vulnapi-cpe-page { /* Add a specific class to body if possible, or use a more specific parent */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f7f8fc; /* Lighter, cleaner background */
    color: #333d57; /* Softer black for text */
    line-height: 1.6;
}

/* Main Card Styling */
.vulnapi-cpe-card {
    max-width: 960px;
    margin: 40px auto;
    background: #ffffff;
    border-radius: 16px; /* Slightly larger, softer radius */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); /* Softer, more diffused shadow */
    overflow: hidden;
}

/* Card Header */
.vulnapi-cpe-header {
    background: linear-gradient(135deg, #6b21a8 0%, #8e44ad 100%); /* Refined gradient */
    color: #ffffff;
    padding: 30px 35px;
    display: flex;
    align-items: center;
    gap: 25px;
    position: relative;
}
.vulnapi-cpe-icon {
    font-size: 2.8em;
    background: rgba(255, 255, 255, 0.1); /* Subtle background for icon */
    color: #ffffff;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}
.vulnapi-cpe-icon .dashicons {
    width: auto;
    height: auto;
    font-size: inherit; /* Make dashicon inherit size */
}
.vulnapi-cpe-title {
    font-size: 1.8em; /* Larger title */
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
}
.vulnapi-cpe-title .deprecated-badge { /* Class for deprecated badge */
    background: #c0392b; /* Stronger red for deprecated */
    color: #fff;
    font-size: 0.6em; /* Relative to title */
    padding: 4px 10px;
    border-radius: 20px; /* Pill shape */
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.vulnapi-cpe-uri {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    background: rgba(0, 0, 0, 0.2); /* Darker, more contrasty background */
    color: #e0e0e0;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.95em;
    margin-bottom: 15px;
    display: inline-block;
    word-break: break-all;
}
.vulnapi-cpe-meta {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 30px;
    font-size: 0.9em;
}
.vulnapi-cpe-meta > div {
    display: flex;
    align-items: center;
}
.vulnapi-cpe-meta-label {
    font-weight: 600;
    color: #dcd1f0; /* Lighter purple for labels */
    margin-right: 8px;
}
.vulnapi-cpe-meta-value {
    color: #ffffff;
    font-weight: 400;
}

/* Error State Styling */
.vulnapi-cpe-header.error-header {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%); /* Error gradient */
}
.vulnapi-cpe-header.error-header .vulnapi-cpe-icon {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}
.vulnapi-cpe-header.error-header .vulnapi-cpe-title,
.vulnapi-cpe-header.error-header .vulnapi-cpe-uri {
    color: #ffffff;
}
.vulnapi-cpe-header.error-header .vulnapi-cpe-uri {
    background: rgba(0, 0, 0, 0.2);
}
.vulnapi-cpe-body.error-body {
    padding: 50px 35px;
    text-align: center;
}
.vulnapi-cpe-body.error-body .error-icon .dashicons {
    font-size: 3.5em;
    color: #e74c3c;
    margin-bottom: 20px;
}
.vulnapi-cpe-body.error-body .error-title {
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 10px;
    color: #333d57;
}
.vulnapi-cpe-body.error-body .error-message {
    color: #5a6588;
    font-size: 1.1em;
    line-height: 1.7;
}

/* Card Body */
.vulnapi-cpe-body {
    padding: 30px 35px;
}

/* Accordion Styling */
.vulnapi-cpe-accordion {
    margin-bottom: 25px;
    border-radius: 12px;
    background-color: #ffffff;
    border: 1px solid #e7e9ed; /* Softer border */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.3s ease;
}
.vulnapi-cpe-accordion:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
}
.vulnapi-cpe-accordion-header {
    background-color: #f9fafc; /* Very light grey for header */
    padding: 15px 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 1.15em;
    color: #333d57;
    border-bottom: 1px solid #e7e9ed;
    transition: background-color 0.3s ease;
}
.vulnapi-cpe-accordion-header:hover {
    background-color: #f1f3f6;
}
.vulnapi-cpe-accordion-header[aria-expanded="true"] {
    background-color: #f1f3f6;
    border-bottom-color: transparent;
}
.vulnapi-cpe-accordion-arrow {
    font-size: 0.9em;
    transition: transform 0.3s ease-in-out;
    color: #5a6588;
}
.vulnapi-cpe-accordion-header[aria-expanded="true"] .vulnapi-cpe-accordion-arrow {
    transform: rotate(90deg);
}
.vulnapi-cpe-accordion-content {
    padding: 25px;
    background-color: #ffffff;
    border-top: 1px solid #e7e9ed;
    font-size: 0.95em;
    line-height: 1.65;
    color: #45506e;
    /* Transition properties from JS will handle visibility */
    overflow: hidden;
    max-height: 0; /* Collapsed by default */
    opacity: 0; /* Hidden by default */
    transition: max-height 0.35s ease-in-out, opacity 0.35s ease-in-out, padding 0.35s ease-in-out;
}
.vulnapi-cpe-accordion-header[aria-expanded="true"] + .vulnapi-cpe-accordion-content {
    /* padding becomes active when max-height is not 0 */
}
.vulnapi-cpe-accordion-content.open { /* Class might be added by JS for open state if needed */
    /* max-height and opacity will be set by JS */
}
.vulnapi-cpe-accordion-content .cve-count-message {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 25px;
    color: #333d57;
    font-weight: 500;
}
.vulnapi-cpe-accordion-content .cve-count-message em {
    color: #7882a2;
    font-style: normal;
}

/* CVE Statistics Graphs */
.vulnapi-cve-graph-wrap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}
.vulnapi-cve-graph {
    background: #f9fafc;
    border-radius: 10px;
    padding: 20px 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
}
.vulnapi-cve-graph-title {
    font-weight: 600;
    color: #333d57;
    margin-bottom: 15px;
    font-size: 1.05em;
}
.vulnapi-cve-graph svg {
    display: block;
    margin-bottom: 10px;
    max-width: 100%; /* Ensure SVGs are responsive */
    height: auto; /* Maintain aspect ratio */
}
.vulnapi-cve-graph em { /* "No data" messages */
    color: #7882a2;
    font-style: normal;
    font-size: 0.95em;
    text-align: center;
    padding: 15px 0;
}
/* Severity Pie Legend */
.vulnapi-cve-graph .severity-legend {
    margin-top: 15px;
    font-size: 0.9em;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 15px;
}
.vulnapi-cve-graph .severity-legend-item {
    display: flex;
    align-items: center;
}
.vulnapi-cve-graph .severity-legend-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
}
.vulnapi-cve-graph .severity-legend-text {
    color: #45506e;
}
/* CVSS Histogram & Yearly Count X-axis labels */
.vulnapi-cve-graph .axis-labels {
    font-size: 0.8em;
    color: #7882a2;
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
}

/* Related CVEs List Styling */
.vulnapi-cve-summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.vulnapi-cve-summary-list li {
    margin-bottom: 20px;
    background: #fdfdff; /* Slightly off-white for list items */
    border-radius: 10px;
    padding: 20px 25px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.vulnapi-cve-summary-list li:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.vulnapi-cve-summary-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-bottom: 12px;
}
.vulnapi-cpe-cve-badge { /* CVE ID Badge */
    /* Dynamic background and color from PHP */
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.95em;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s ease, filter 0.2s ease;
    display: inline-block; /* Ensure padding and transform work */
}
.vulnapi-cpe-cve-badge:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
    text-decoration: none;
}
.vulnapi-cve-severity { /* CVSS Score and Severity Text */
    background: #e9ecef;
    color: #333d57;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
}
.vulnapi-cve-date {
    color: #7882a2;
    font-size: 0.9em;
    margin-left: auto; /* Push date to the right if space allows */
}
.vulnapi-cve-desc {
    font-size: 0.95em;
    color: #45506e;
    line-height: 1.6;
    margin-bottom: 15px;
}

/* Tags (CWE, EPSS, Impacts, Scopes) */
.vulnapi-cve-tags-container {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.vulnapi-cve-tags-group strong {
    font-weight: 600;
    color: #333d57;
    font-size: 0.9em;
    margin-right: 10px;
    display: inline-block;
    margin-bottom: 6px;
}
.vulnapi-cve-tag {
    padding: 4px 10px;
    border-radius: 15px; /* Pill-shaped tags */
    margin-right: 8px;
    margin-bottom: 8px;
    font-size: 0.85em;
    display: inline-block;
    line-height: 1.4;
    font-weight: 500;
    transition: filter 0.2s ease;
}
.vulnapi-cve-tag:hover {
    filter: brightness(0.95);
}
.vulnapi-cve-tag.cwe-tag { background-color: #e1e0ff; color: #5352ed; }
.vulnapi-cve-tag.impact-tag { background-color: #ffe0f0; color: #dd2c93; }
.vulnapi-cve-tag.scope-tag { background-color: #d6f5ff; color: #039be5; }

/* EPSS Trend */
.vulnapi-epss-trend-container strong {
    margin-bottom: 8px;
}
.vulnapi-epss-trend svg {
    vertical-align: middle;
    border: 1px solid #e7e9ed;
    background: #fdfdff;
    border-radius: 6px;
    margin-right: 10px;
}
.vulnapi-epss-trend .epss-current-text {
    font-size: 0.9em;
    color: #45506e;
}
.vulnapi-epss-trend .epss-no-data {
    font-size: 0.9em;
    color: #7882a2;
    font-style: normal;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .vulnapi-cpe-card {
        margin: 30px 20px;
    }
    .vulnapi-cve-graph-wrap {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .vulnapi-cpe-header {
        padding: 25px;
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    .vulnapi-cpe-icon {
        width: 60px;
        height: 60px;
        font-size: 2.4em;
    }
    .vulnapi-cpe-title {
        font-size: 1.6em;
    }
    .vulnapi-cpe-uri {
        font-size: 0.9em;
    }
    .vulnapi-cpe-meta {
        gap: 10px 20px;
        font-size: 0.85em;
    }
    .vulnapi-cpe-body {
        padding: 25px;
    }
    .vulnapi-cve-graph-wrap {
        grid-template-columns: 1fr; /* Single column for graphs on smaller screens */
        gap: 20px;
    }
    .vulnapi-cpe-accordion-header {
        padding: 12px 20px;
        font-size: 1.1em;
    }
    .vulnapi-cpe-accordion-content {
        padding: 20px;
    }
    .vulnapi-cve-summary-header {
        gap: 8px 12px;
    }
    .vulnapi-cve-date {
        margin-left: 0; /* Allow date to wrap naturally */
        width: 100%;   /* Take full width if it wraps */
        text-align: left; /* Align left if it wraps */
        margin-top: 5px;
    }
}

@media (max-width: 480px) {
    .vulnapi-cpe-card {
        margin: 20px 15px;
        border-radius: 12px;
    }
    .vulnapi-cpe-header { padding: 20px; }
    .vulnapi-cpe-icon { width: 50px; height: 50px; font-size: 2em; }
    .vulnapi-cpe-title { font-size: 1.4em; }
    .vulnapi-cpe-uri { font-size: 0.8em; }
    .vulnapi-cpe-meta { font-size: 0.8em; }
    .vulnapi-cpe-body { padding: 20px; }

    .vulnapi-cpe-accordion-header { font-size: 1em; padding: 10px 15px; }
    .vulnapi-cpe-accordion-content { padding: 15px; }

    .vulnapi-cpe-cve-badge,
    .vulnapi-cve-severity {
        font-size: 0.85em;
        padding: 4px 8px;
    }
    .vulnapi-cve-date { font-size: 0.85em; }
    .vulnapi-cve-tag { font-size: 0.8em; padding: 3px 8px; }
}

/* Ensure the accordion content transition works with JS */
.vulnapi-cpe-accordion-content.transitioning {
    /* JS will set max-height and opacity */
}

.vulnapi-cpe-meta-value {
    color: #ffffff;
    font-weight: 400;
}

/* Vendor Search Button */
.vulnapi-vendor-search-action {
    margin-top: 18px; /* Space from URI */
    margin-bottom: 18px; /* Space to meta or next element */
}

.vulnapi-vendor-search-button {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.15); /* Subtle white, works on dark header */
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: background-color 0.3s ease, transform 0.2s ease, border-color 0.3s ease;
}

.vulnapi-vendor-search-button:hover {
    background-color: rgba(255, 255, 255, 0.25); /* Slightly more opaque on hover */
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
    transform: translateY(-1px);
    text-decoration: none;
}


/* Error State Styling */
@media (max-width: 768px) {
    .vulnapi-vendor-search-button,
    .vulnapi-product-search-button {
        font-size: 0.85em;
        padding: 8px 15px;
    }
    .vulnapi-product-search-action {
        margin-top: 8px; /* Adjust for smaller screens */
    }
    .vulnapi-cpe-uri {
        font-size: 0.9em;
    }
    .vulnapi-vendor-search-action { /* Adjust margins for smaller screens */
        margin-top: 15px;
        margin-bottom: 15px;
    }
    .vulnapi-vendor-search-button {
        font-size: 0.85em;
        padding: 8px 15px;
    }
    .vulnapi-cpe-meta {
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    
    .vulnapi-vendor-search-button,
    .vulnapi-product-search-button {
        font-size: 0.8em;
        padding: 7px 12px;
    }
    .vulnapi-cpe-uri { font-size: 0.8em; }
    .vulnapi-vendor-search-button {
        font-size: 0.8em;
        padding: 7px 12px;
    }
    .vulnapi-cpe-meta { font-size: 0.8em; }
}

.vulnapi-vendor-search-action {
    margin-top: 18px; /* Space from URI */
    margin-bottom: 18px; /* Space to meta or next element */
}

.vulnapi-vendor-search-button {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.15); /* Subtle white, works on dark header */
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: background-color 0.3s ease, transform 0.2s ease, border-color 0.3s ease;
}

.vulnapi-vendor-search-button:hover {
    background-color: rgba(255, 255, 255, 0.25); /* Slightly more opaque on hover */
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
    transform: translateY(-1px);
    text-decoration: none;
}

/* Product Search Button (new) */
.vulnapi-product-search-action {
    margin-top: 10px; /* Slightly less top margin if following vendor button */
    margin-bottom: 18px;
}

.vulnapi-product-search-button {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.1); /* Slightly different or same as vendor */
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    border: 1px solid rgba(255, 255, 255, 0.25);
    transition: background-color 0.3s ease, transform 0.2s ease, border-color 0.3s ease;
}

.vulnapi-product-search-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
    color: #ffffff;
    transform: translateY(-1px);
    text-decoration: none;
}