:root[data-theme="dark"] {
    --primary-color: #3b82f6;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --card-bg: #1e293b;
    --card-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
    --critical: #dc2626;
    --high: #f97316;
    --medium: #fbbf24;
    --low: #84cc16;
    --none: #64748b;
}

:root[data-theme="light"] {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --card-bg: #ffffff;
    --card-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --border-color: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
    --critical: #dc2626;
    --high: #ea580c;
    --medium: #d97706;
    --low: #65a30d;
    --none: #64748b;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --card-bg: #ffffff;
    --card-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --border-color: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
    --critical: #dc2626;
    --high: #ea580c;
    --medium: #d97706;
    --low: #65a30d;
    --none: #64748b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px var(--shadow);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-image {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.logo-icon {
    font-size: 28px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: -5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle {
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

.theme-toggle:hover {
    background: var(--card-hover);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

nav {
    display: flex;
    gap: 15px;
}

.nav-link {
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover {
    background: var(--card-hover);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.nav-link.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.search-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    margin-top: 30px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.search-section h2 {
    margin-bottom: 20px;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.section-description {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.input-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.input-wrapper {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.input-wrapper label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
    font-family: 'Courier New', monospace;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 12px var(--shadow);
    transition: background-color 0.3s ease;
}

.autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    color: var(--text-primary);
}

.autocomplete-item:hover {
    background: var(--card-hover);
}

.btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--card-hover);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.file-upload {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload-label {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.file-upload-label:hover {
    border-color: var(--primary-color);
    background: var(--card-hover);
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 15px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.results {
    margin-top: 30px;
}

.cve-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cve-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: var(--primary-color);
}

.cve-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
    border-color: var(--primary-color);
}

.cve-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.cve-title {
    flex: 1;
}

.cve-title h3 {
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.cve-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-secondary);
}

.badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-critical {
    background: rgba(220, 38, 38, 0.15);
    color: var(--critical);
    border: 1px solid var(--critical);
}

.badge-high {
    background: rgba(249, 115, 22, 0.15);
    color: var(--high);
    border: 1px solid var(--high);
}

.badge-medium {
    background: rgba(251, 191, 36, 0.15);
    color: var(--medium);
    border: 1px solid var(--medium);
}

.badge-low {
    background: rgba(132, 204, 22, 0.15);
    color: var(--low);
    border: 1px solid var(--low);
}

.badge-none {
    background: rgba(100, 116, 139, 0.15);
    color: var(--none);
    border: 1px solid var(--none);
}

.badge-exploited {
    background: rgba(220, 38, 38, 0.15);
    color: var(--critical);
    border: 1px solid var(--critical);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.cve-description {
    margin-bottom: 25px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
    line-height: 1.7;
    color: var(--text-primary);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.metric-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 18px;
    transition: all 0.3s ease;
}

.metric-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.metric-card h4 {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.metric-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.cvss-details {
    margin-top: 15px;
}

.cvss-vector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.cvss-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid var(--border-color);
}

.cvss-item-label {
    color: var(--text-secondary);
}

.cvss-item-value {
    font-weight: 600;
    color: var(--primary-color);
}

.section {
    margin-bottom: 25px;
}

.section h4 {
    font-size: 16px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.weakness-list,
.config-list,
.reference-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.weakness-item,
.config-item,
.reference-item {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.weakness-item:hover,
.config-item:hover,
.reference-item:hover {
    border-color: var(--primary-color);
    background: var(--card-hover);
}

.weakness-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.config-item {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.config-field {
    display: flex;
    flex-direction: column;
}

.config-field-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.config-field-value {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--text-primary);
}

.reference-item a {
    color: var(--primary-color);
    text-decoration: none;
    word-break: break-all;
}

.reference-item a:hover {
    text-decoration: underline;
}

.reference-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.tag {
    padding: 4px 8px;
    background: rgba(37, 99, 235, 0.15);
    border-radius: 4px;
    font-size: 11px;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chart-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.chart-container h3 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.chart-wrapper {
    position: relative;
    height: 300px;
}

.top-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.top-item:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.top-item-rank {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 40px;
}

.top-item-content {
    flex: 1;
    margin: 0 15px;
}

.top-item-title {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.top-item-description {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-item-value {
    font-size: 22px;
    font-weight: 700;
}

.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    border-radius: 8px;
    padding: 15px;
    color: var(--danger-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 15px;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.info-box {
    margin-top: 15px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.info-box p {
    font-size: 13px;
    color: var(--text-secondary);
}

.info-box strong {
    color: var(--text-primary);
}

footer {
    text-align: center;
    padding: 30px;
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    nav {
        flex-direction: column;
    }

    .input-group {
        flex-direction: column;
    }

    .input-wrapper {
        min-width: 100%;
    }

    .cve-header {
        flex-direction: column;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .cvss-vector {
        grid-template-columns: 1fr;
    }

    .config-item {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .search-section {
        padding: 20px;
    }

    .cve-card {
        padding: 15px;
    }

    .logo h1 {
        font-size: 20px;
    }
}

.impact-HIGH { color: var(--high); }
.impact-LOW { color: var(--low); }
.impact-NONE { color: var(--none); }
