/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.7;
    color: #2c3e50;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    font-size: 16px;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
    color: white;
    padding: 3rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><g fill="%23ffffff" fill-opacity="0.05"><polygon points="36 34 24 34 30 24"/></g></svg>') repeat;
    opacity: 0.1;
}

.header .container {
    position: relative;
    z-index: 1;
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header p {
    font-size: 1.25rem;
    opacity: 0.95;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Content */
.main {
    padding: 2rem 0;
}

section {
    background: white;
    margin-bottom: 2rem;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

h2 {
    color: #1e293b;
    margin-bottom: 2rem;
    font-size: 1.875rem;
    font-weight: 700;
    position: relative;
    padding-bottom: 1rem;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    border-radius: 2px;
}

h3 {
    color: #334155;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2980b9);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.stat-card.critical::before {
    background: linear-gradient(90deg, #dc2626, #b91c1c);
}

.stat-card.high::before {
    background: linear-gradient(90deg, #ea580c, #c2410c);
}

.stat-card.medium::before {
    background: linear-gradient(90deg, #d97706, #b45309);
}

.stat-card.low::before {
    background: linear-gradient(90deg, #16a34a, #15803d);
}

.stat-number {
    display: block;
    font-size: 3rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #1e293b, #475569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Search Controls */
.search-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.controls-section {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: center;
    justify-content: space-between;
}

.control-section-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 0.5rem;
}

.search-input-group {
    display: flex;
    flex: 1;
    min-width: 300px;
}

.search-input-group input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 6px 0 0 6px;
    font-size: 1rem;
    border-right: none;
}

.search-input-group input:focus {
    outline: none;
    border-color: #3498db;
}

.filter-group, .sort-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.filter-group {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: #bae6fd;
}

.sort-group {
    background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
    border-color: #e9d5ff;
}

select {
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
}

select:focus {
    outline: none;
    border-color: #3498db;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #3498db;
    color: white;
    border-radius: 0 6px 6px 0;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-secondary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* Vulnerabilities List */
.vulnerabilities-list {
    display: grid;
    gap: 1rem;
}

.vulnerability-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.2s;
    cursor: pointer;
}

.vulnerability-card:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.1);
}

.vulnerability-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.cve-id {
    font-size: 1.25rem;
    font-weight: bold;
    color: #2c3e50;
}

.severity-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.severity-critical {
    background: #e74c3c;
    color: white;
}

.severity-high {
    background: #f39c12;
    color: white;
}

.severity-medium {
    background: #f1c40f;
    color: #2c3e50;
}

.severity-low {
    background: #27ae60;
    color: white;
}

.vulnerability-description {
    color: #555;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.vulnerability-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.cvss-score {
    font-weight: bold;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: #ecf0f1;
    color: #2c3e50;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

#pageInfo {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* System Status */
.status-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 6px;
    background: #ecf0f1;
}

.status-healthy {
    background: #d5f5d5;
    color: #27ae60;
}

.status-unhealthy {
    background: #f5d5d5;
    color: #e74c3c;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    color: #aaa;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

/* Loading States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    color: #7f8c8d;
}

.loading-spinner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    padding: 3rem;
    color: #7f8c8d;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer a {
    color: #3498db;
    text-decoration: none;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .search-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input-group {
        min-width: 100%;
    }

    .filter-group {
        justify-content: center;
    }

    .vulnerability-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .vulnerability-meta {
        justify-content: center;
    }

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

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vulnerability-card {
    animation: fadeIn 0.3s ease-out;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.text-muted {
    color: #7f8c8d;
}

/* Apple Context Section */
.apple-context-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.apple-context-section h3 {
    color: #007bff;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.apple-detail-item {
    background: white;
    border-radius: 6px;
    padding: 1rem;
    border-left: 4px solid #007bff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.apple-detail-item strong {
    color: #495057;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 0.5rem;
}

.apple-impact {
    color: #dc3545;
    font-weight: 500;
    margin: 0;
}

.apple-description {
    color: #28a745;
    font-weight: 500;
    margin: 0;
}

.apple-available-for {
    color: #6c757d;
    font-style: italic;
    margin: 0;
    font-size: 0.9rem;
}

.apple-product {
    color: #007bff;
    font-weight: 600;
    margin: 0;
    font-size: 1rem;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .header {
        padding: 2rem 0;
    }

    .header h1 {
        font-size: 2.25rem;
    }

    .header p {
        font-size: 1.125rem;
    }

    section {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    h2 {
        font-size: 1.5rem;
    }

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

    .stat-card {
        padding: 1.5rem;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .search-controls {
        gap: 1rem;
    }

    .controls-section {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .search-input-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .filter-group, .sort-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .control-section-label {
        text-align: center;
        margin-right: 0;
        margin-bottom: 0.25rem;
    }

    .vulnerability-card {
        padding: 1.25rem;
    }

    .vulnerability-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .vulnerability-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .meta-item {
        justify-content: flex-start;
    }

    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }

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

    .apple-context-section {
        padding: 1.25rem;
    }
}