/* CVE Security Database - Stylesheet */
/* Tailwind CSS loaded via CDN in header.php */

/* Custom CSS for additional styling */

/* Screen reader only (accessibility) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Skip link focus */
.skip-link:focus {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 9999;
    padding: 0.75rem 1.5rem;
    background-color: #3b82f6;
    color: white;
    border-radius: 0.375rem;
    text-decoration: none;
}

/* Search highlight */
mark {
    background-color: #fef08a;
    padding: 0.125rem 0.25rem;
    border-radius: 0.125rem;
}

/* CVE Card hover effect */
article:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

/* Loading spinner (for search) */
.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #3b82f6;
    width: 2rem;
    height: 2rem;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

/* Print styles */
@media print {
    header, footer, nav, .no-print {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    article {
        page-break-inside: avoid;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    /*
    Uncomment for dark mode support:

    body {
        background-color: #1f2937;
        color: #f3f4f6;
    }
    */
}

/* Custom severity colors */
.severity-critical {
    background-color: #fef2f2;
    color: #991b1b;
}

.severity-high {
    background-color: #fff7ed;
    color: #c2410c;
}

.severity-medium {
    background-color: #fefce8;
    color: #a16207;
}

.severity-low {
    background-color: #eff6ff;
    color: #1e40af;
}

/* Tooltip (for additional info) */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #1f2937;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
}

.tooltip:hover .tooltiptext,
.tooltip:focus .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Code blocks (for CVE details) */
code {
    background-color: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875em;
}

pre {
    background-color: #1f2937;
    color: #f3f4f6;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
}

pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

/* Badge styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Sticky header (optional) */
@media (min-width: 768px) {
    header {
        position: sticky;
        top: 0;
        z-index: 40;
    }
}

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

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* Grid responsive adjustments */
@media (max-width: 640px) {
    .grid-cols-1 {
        grid-template-columns: 1fr;
    }
}

/* Accessibility - High contrast mode */
@media (prefers-contrast: high) {
    * {
        border-color: currentColor !important;
    }

    .bg-gray-50 {
        background-color: #fff !important;
    }

    .text-gray-600 {
        color: #000 !important;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
