* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

.logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 20px;
    border: 3px solid rgba(255,255,255,0.3);
}

h1 {
    font-size: 2.5rem;
    margin: 0 0 10px 0;
    font-weight: 300;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

.main-content {
    padding: 40px;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 1.1rem;
}

.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4facfe;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.repo-section {
    margin-bottom: 50px;
}

.repo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
    flex-wrap: wrap;
    gap: 10px;
}

.repo-title {
    font-size: 1.8rem;
    color: #333;
    margin: 0;
}

.github-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: all 0.2s;
}

.github-link:hover {
    color: #333;
    border-color: #999;
    background: #f8f9fa;
}

.github-link:focus {
    outline: 2px solid #4facfe;
    outline-offset: 2px;
}

.github-icon {
    display: flex;
    align-items: center;
}

.releases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.release-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #e9ecef;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: fadeIn 0.3s ease-out;
}

.release-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.release-card.latest-release {
    background: linear-gradient(135deg, #fff5f5 0%, #f0f9ff 100%);
    border: 2px solid #4facfe;
    position: relative;
}

.release-card.latest-release:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(79, 172, 254, 0.2);
}

.release-header {
    margin-bottom: 20px;
}

.release-title-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.release-version {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.latest-badge {
    display: inline-block;
    background: transparent;
    color: #4facfe;
    border: 1.5px solid #4facfe;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.latest-badge:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.release-date {
    color: #666;
    font-size: 0.9rem;
}

.downloads-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.download-item {
    margin-bottom: 12px;
}

.download-wrapper {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.download-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    padding: 12px 16px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.download-button:focus {
    outline: 2px solid #4facfe;
    outline-offset: 2px;
}

.copy-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: auto;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.copy-link-btn:hover {
    background: #e9ecef;
    border-color: #6c757d;
}

.copy-link-btn:focus {
    outline: 2px solid #4facfe;
    outline-offset: 2px;
}

.download-button:hover {
    border-color: #4facfe;
    background: #f8fbff;
    transform: translateX(2px);
}

.download-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.download-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-icon i {
    font-size: 16px;
}

.github-icon i {
    font-size: 14px;
}

.download-arrow i {
    font-size: 14px;
}

.copy-link-btn i {
    font-size: 14px;
}

.download-name {
    font-weight: 500;
}

/* OS-based highlighting and recommendations */
.download-button.compatible {
    border-color: #28a745;
    background: #f8fff9;
}

.download-button.compatible:hover {
    border-color: #20c997;
    background: #e8f5e8;
    transform: translateX(3px);
}

.download-button.recommended {
    border-color: #007bff;
    background: linear-gradient(135deg, #f8fbff 0%, #e3f2fd 100%);
    position: relative;
}

.download-button.recommended:hover {
    border-color: #0056b3;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

.download-details {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.download-count {
    color: #666;
    font-size: 0.75rem;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.download-button.compatible .download-count {
    background: #d4edda;
    color: #155724;
}

.download-button.recommended .download-count {
    background: #cce5ff;
    color: #004085;
}

.downloads-title {
    margin: 0 0 10px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
}

.release-notes {
    margin-top: 15px;
    border-top: 1px solid #e9ecef;
    padding-top: 15px;
}

.release-notes summary {
    cursor: pointer;
    font-weight: 500;
    color: #495057;
    padding: 5px 0;
}

.release-notes summary:hover {
    color: #4facfe;
}

.release-notes-content {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.error-state {
    text-align: center;
    padding: 60px 40px;
    color: #dc3545;
}

.retry-button {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 15px;
    transition: background 0.2s;
}

.retry-button:hover {
    background: #0056b3;
}

.repo-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    color: #721c24;
}

.error-details {
    margin-top: 10px;
}

.error-details code {
    background: #f1f3f4;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

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

.download-size {
    color: #666;
    font-size: 0.85rem;
    font-weight: normal;
}

.os-info {
    color: #888;
    font-size: 0.75rem;
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.download-button.compatible .os-info {
    background: #d4edda;
    color: #155724;
}

.download-button.recommended .os-info {
    background: #cce5ff;
    color: #004085;
}

.error {
    text-align: center;
    padding: 40px;
    color: #dc3545;
    background: #f8d7da;
    border-radius: 8px;
    margin: 20px 0;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .repo-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .release-title-container {
        flex-wrap: wrap;
    }
    
    .download-wrapper {
        flex-direction: column;
        gap: 6px;
    }
    
    .copy-link-btn {
        width: 100%;
        height: 36px;
    }
    
    .releases-grid {
        grid-template-columns: 1fr;
    }
}

/* Focus and keyboard navigation improvements */
.download-button:focus {
    outline: 2px solid #4facfe;
    outline-offset: 2px;
}

.github-link:focus {
    outline: 2px solid #4facfe;
    outline-offset: 2px;
}

.latest-badge:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

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

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .download-button.compatible {
        border-width: 3px;
    }
    
    .download-button.recommended {
        border-width: 3px;
    }
    
    .latest-badge {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .download-button:hover {
        transform: none;
    }
    
    .release-card:hover {
        transform: none;
    }
}
