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

:root {
    --primary-color: #0056b3;
    --primary-hover: #004085;
    --secondary-color: #6c757d;
    --secondary-hover: #5a6268;
    --background: #ffffff;
    --background-alt: #f8f9fa;
    --text: #212529;
    --text-muted: #6c757d;
    --border: #dee2e6;
    --border-focus: #0056b3;
    --success: #28a745;
    --warning: #ffc107;
    --error: #dc3545;
    --spacing-unit: 1rem;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text);
    background-color: var(--background-alt);
    padding: var(--spacing-unit);
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Stale Data Warning Banner */
.stale-data-warning {
    background-color: #fff3cd;
    border: 2px solid var(--warning);
    border-left: 5px solid var(--warning);
    color: #856404;
    padding: calc(var(--spacing-unit) * 1);
    margin-bottom: calc(var(--spacing-unit) * 2);
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: calc(var(--spacing-unit) * 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.warning-content {
    flex: 1;
    line-height: 1.6;
}

.warning-actions {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 0.5);
    flex-shrink: 0;
}

.warning-content a {
    color: #856404;
    text-decoration: underline;
    font-weight: 600;
}

.warning-content a:hover,
.warning-content a:focus {
    text-decoration: none;
    outline: 2px solid #856404;
    outline-offset: 2px;
}

.warning-close {
    background: none;
    border: none;
    color: #856404;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0 calc(var(--spacing-unit) * 0.5);
    line-height: 1;
    flex-shrink: 0;
}

.warning-close:hover,
.warning-close:focus {
    color: #664d03;
    outline: 2px solid #856404;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Success state for refresh banner */
.stale-data-warning .warning-content[style*="color: #155724"] {
    color: #155724 !important;
}

/* Error state for refresh banner */
.stale-data-warning .warning-content[style*="color: #721c24"] {
    color: #721c24 !important;
}

/* Header */
header {
    background-color: var(--background);
    padding: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 2);
    border-bottom: 3px solid var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2rem;
    margin-bottom: calc(var(--spacing-unit) * 0.5);
    color: var(--primary-color);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
}

/* Filters Section */
.filters-section {
    background-color: var(--background);
    padding: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 2);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filters-section h2 {
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    font-size: 1.5rem;
    color: var(--text);
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: calc(var(--spacing-unit) * 1.5);
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: calc(var(--spacing-unit) * 0.5);
    color: var(--text);
}

.required {
    color: var(--error);
    font-weight: bold;
}

.filter-group select {
    padding: calc(var(--spacing-unit) * 0.75);
    border: 2px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    font-family: var(--font-family);
    background-color: var(--background);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-group select:hover {
    border-color: var(--primary-color);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.25);
}

.wcag-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: calc(var(--spacing-unit) * 1.5);
    grid-column: 1 / -1;
    padding-top: calc(var(--spacing-unit) * 1);
    border-top: 2px solid var(--border);
    margin-top: calc(var(--spacing-unit) * 1);
}

.wcag-filters[aria-hidden="true"] {
    display: none;
}

.filter-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    margin-top: calc(var(--spacing-unit) * 1);
}

/* Buttons */
.button {
    padding: calc(var(--spacing-unit) * 0.75) calc(var(--spacing-unit) * 1.5);
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-family: var(--font-family);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    font-weight: 600;
}

.button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.25);
}

.button:active {
    transform: translateY(1px);
}

.button-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.button-secondary:hover {
    background-color: var(--secondary-hover);
}

.button-secondary:focus {
    box-shadow: 0 0 0 3px rgba(108, 117, 125, 0.25);
}

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

.button-primary:hover {
    background-color: var(--primary-hover);
}

.button-primary:focus {
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.25);
}

.button-primary:disabled {
    background-color: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Results Section */
.results-section {
    background-color: var(--background);
    padding: calc(var(--spacing-unit) * 2);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.results-section h2 {
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    font-size: 1.5rem;
    color: var(--text);
}

.results-count {
    font-size: 1rem;
    font-weight: normal;
    color: var(--text-muted);
    margin-left: calc(var(--spacing-unit) * 0.5);
}

#results-container {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 1.5);
}

.software-heading {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 1);
    padding-bottom: calc(var(--spacing-unit) * 0.5);
    border-bottom: 3px solid var(--primary-color);
}

.software-heading:first-child {
    margin-top: 0;
}

.level-heading {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-top: calc(var(--spacing-unit) * 1.5);
    margin-bottom: calc(var(--spacing-unit) * 0.75);
    padding-bottom: calc(var(--spacing-unit) * 0.5);
    border-bottom: 2px solid var(--border);
}

.level-heading:first-of-type {
    margin-top: calc(var(--spacing-unit) * 0.5);
}

.issue-card {
    border: 2px solid var(--border);
    border-radius: 4px;
    padding: calc(var(--spacing-unit) * 1.5);
    background-color: var(--background-alt);
    transition: box-shadow 0.2s;
}

.issue-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.issue-card:focus-within {
    outline: 3px solid var(--border-focus);
    outline-offset: 2px;
}

.issue-header {
    margin-bottom: calc(var(--spacing-unit) * 1);
}

.issue-badges {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 0.5);
    list-style: none;
    padding: 0;
    margin: 0;
    justify-content: flex-start;
}

.issue-badges li {
    margin: 0;
    padding: 0;
}

.badge {
    padding: calc(var(--spacing-unit) * 0.25) calc(var(--spacing-unit) * 0.75);
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    display: inline-block;
}

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

.badge-standard {
    background-color: var(--secondary-color);
    color: white;
}

.badge-guideline {
    background-color: #17a2b8;
    color: white;
    white-space: normal;
    max-width: 100%;
}

.badge-support {
    background-color: var(--error);
    color: white;
}

.issue-description {
    color: var(--text);
    line-height: 1.6;
    margin-top: calc(var(--spacing-unit) * 1);
}

.issue-support-level {
    margin-top: calc(var(--spacing-unit) * 0.75);
    font-weight: 600;
    color: var(--error);
}

.issue-remarks {
    margin-top: calc(var(--spacing-unit) * 1.5);
    padding-top: calc(var(--spacing-unit) * 1.5);
    border-top: 2px solid var(--border);
}

.issue-remarks-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: calc(var(--spacing-unit) * 0.75);
}

.issue-remarks-content {
    color: var(--text);
    line-height: 1.6;
    white-space: pre-wrap;
}

.no-results {
    text-align: center;
    padding: calc(var(--spacing-unit) * 3);
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Screen Reader Only */
.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;
}

/* Footer */
footer {
    margin-top: calc(var(--spacing-unit) * 3);
    padding: calc(var(--spacing-unit) * 2);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

footer a:hover,
footer a:focus {
    text-decoration: none;
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: calc(var(--spacing-unit) * 0.5);
    }

    header h1 {
        font-size: 1.5rem;
    }

    .filters-form {
        grid-template-columns: 1fr;
    }

    .wcag-filters {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        justify-content: stretch;
    }

    .button {
        width: 100%;
    }

    .issue-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .issue-title {
        width: 100%;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --border: #000000;
        --border-focus: #000000;
    }

    .issue-card {
        border-width: 3px;
    }
}

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

