/* 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.6;
    color: #333;
    background-color: #f5f7fa;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2rem;
    color: #7f8c8d;
}

/* Stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Controls */
.controls {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-container input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.search-container button {
    padding: 10px 20px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.search-container button:hover {
    background: #7f8c8d;
}

.filter-container {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-container label {
    font-weight: 600;
    color: #2c3e50;
}

.filter-container select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Source tabs */
.source-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 10px 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background: #ecf0f1;
}

.tab-button.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* Loading and error states */
.loading,
.error {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
}

.loading {
    color: #3498db;
}

.error {
    color: #e74c3c;
    background: #fdf2f2;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

/* Results */
.results-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.results-header span {
    font-weight: 600;
    color: #2c3e50;
}

.view-toggles {
    display: flex;
    gap: 5px;
}

.view-toggle {
    padding: 8px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.view-toggle:hover {
    background: #ecf0f1;
}

.view-toggle.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* Results Grid (Cards) */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    padding: 20px;
}

.wheel-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    background: white;
    transition: all 0.3s ease;
}

.wheel-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

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

.wheel-filename {
    font-weight: bold;
    color: #2c3e50;
    word-break: break-all;
    flex: 1;
}

.source-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 10px;
}

.source-badge.commit {
    background: #f39c12;
    color: white;
}

.source-badge.github_release {
    background: #27ae60;
    color: white;
}

.source-badge.release_version {
    background: #8e44ad;
    color: white;
}

.source-badge.nightly {
    background: #e74c3c;
    color: white;
}

.wheel-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-weight: 600;
    color: #7f8c8d;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.meta-value {
    color: #2c3e50;
    font-family: monospace;
}

.install-command {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    word-break: break-all;
    position: relative;
    cursor: pointer;
}

.install-command:hover {
    background: #34495e;
}

.install-command::after {
    content: '📋';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.7;
}

/* Results Table */
.results-table {
    padding: 20px;
    overflow-x: auto;
}

.results-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table th,
.results-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.results-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    position: sticky;
    top: 0;
}

.results-table tr:hover {
    background: #f8f9fa;
}

.results-table .filename {
    font-family: monospace;
    word-break: break-all;
    max-width: 200px;
}

.results-table .install-command {
    font-family: monospace;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    word-break: break-all;
    max-width: 300px;
    cursor: pointer;
}

.results-table .install-command:hover {
    background: #e9ecef;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: #7f8c8d;
    font-size: 0.9rem;
}

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

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

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }

    .filter-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .filter-container>div {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .source-tabs {
        flex-wrap: wrap;
    }

    .results-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}

/* Tooltip for copy functionality */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.tooltip:hover::before {
    opacity: 1;
}