:root {
    /* Light Theme */
    --bg-body: #f9fafb;
    --bg-panel: #ffffff;
    --bg-header: #ffffff;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);

    --font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
    --bg-body: #111827;
    --bg-panel: #1f2937;
    --bg-header: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --accent-primary: #60a5fa;
    --accent-hover: #93c5fd;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s, color 0.3s;
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.main-content {
    padding: 16px 0;
    width: 100%;
}

/* Header */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.header-title h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: inline-block;
    margin-right: 12px;
    letter-spacing: -0.025em;
}

.last-updated {
    font-size: 12px;
    color: var(--text-muted);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 18px;
    padding: 6px;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
    background-color: var(--bg-body);
    color: var(--text-primary);
}

/* Sections */
.section-container {
    margin-bottom: 24px;
}

#stats {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 0;
    border-bottom: none;
}

.section-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    background-color: transparent;
    border: none;
}

.stat-card {
    background-color: var(--bg-panel);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    /* Condensed border radius */
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background-color: var(--bg-body);
    font-size: 16px;
    transition: all 0.2s;
}

.stat-icon.stars {
    background-color: rgba(234, 179, 8, 0.1);
    color: #eab308;
}

[data-theme="dark"] .stat-icon.stars {
    background-color: rgba(234, 179, 8, 0.2);
}

.stat-icon.forks {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

[data-theme="dark"] .stat-icon.forks {
    background-color: rgba(59, 130, 246, 0.2);
}

.stat-icon.repos {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

[data-theme="dark"] .stat-icon.repos {
    background-color: rgba(16, 185, 129, 0.2);
}

.stat-icon.issues {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

[data-theme="dark"] .stat-icon.issues {
    background-color: rgba(239, 68, 68, 0.2);
}

.stat-info h3 {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
    font-weight: 600;
}

.stat-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.025em;
    font-family: var(--font-family);
    /* Monospace */
}

/* Zero stats dimming */
.stat-zero {
    opacity: 0.4;
}

/* Repositories Grid */
.repos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

/* Repo Card */
.repo-card {
    border: 1px solid var(--border-color);
    background-color: var(--bg-panel);
    padding: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 10px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    justify-content: space-between;
}

.repo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    border-color: var(--accent-primary);
}

.repo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Changed from flex-start to center for better alignment */
    margin-bottom: 8px;
}

.repo-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    /* Ensure ellipsis works */
}

.repo-website-icon {
    color: var(--text-secondary);
    font-size: 12px;
    opacity: 0.6;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    padding: 2px;
}

.repo-website-icon:hover {
    color: var(--accent-primary);
    opacity: 1;
}

.repo-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-primary);
    text-decoration: none;
    font-family: var(--font-family);
    transition: color 0.2s;
    word-break: break-word;
    line-height: 1.2;
    /* Removed max-width enabling text wrapping */
}

.repo-name:hover {
    color: var(--accent-hover);
    text-decoration: none;
}

.repo-visibility {
    font-size: 10px;
    padding: 1px 6px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    background-color: var(--bg-body);
    font-weight: 500;
    line-height: 1.4;
}

.repo-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    height: 68px;
    /* Fixed height for consistency */
}

.repo-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: auto;
    padding-bottom: 8px;
    font-family: var(--font-family);
    /* Monospace */
    /* border-bottom removed */
}

.repo-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.repo-stat i {
    font-size: 12px;
    opacity: 0.8;
}

.repo-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-muted);
}

.repo-footer-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.repo-lang {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.repo-license {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-family: var(--font-family);
}

.language-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.repo-dates {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.repo-date {
    font-family: var(--font-family);
    color: var(--text-muted);
    font-size: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Topic Badges */
.repo-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.topic-badge {
    padding: 2px 8px;
    background-color: var(--bg-body);
    color: var(--accent-primary);
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    font-family: var(--font-family);
    border: 1px solid var(--border-color);
}

/* Version Badges */
.repo-versions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    margin-bottom: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.version-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    font-family: var(--font-family);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.version-badge i {
    font-size: 10px;
}

.version-badge a {
    text-decoration: none;
    color: inherit;
}

/* Tag Badge (Git) */
.tag-badge {
    background-color: var(--bg-body);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.tag-badge i {
    color: var(--accent-primary);
}

.tag-badge:hover {
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

/* Package Badge (NPM/PyPI) */
.package-badge {
    background-color: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

[data-theme="dark"] .package-badge {
    background-color: rgba(255, 255, 255, 0.05);
}

.npm-badge i {
    color: #CB3837;
}

.pypi-badge i {
    color: #3775a9;
}

.crates-badge i {
    color: #dea584;
}

.vscode-badge i {
    color: #007ACC;
}

.openvsx-badge i {
    color: #c160ef;
}

.package-badge:hover {
    background-color: rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

[data-theme="dark"] .package-badge:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Filters */
.filters-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

select {
    appearance: none;
    -webkit-appearance: none;
    padding: 6px 32px 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    background-color: var(--bg-panel);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    font-family: var(--font-sans);
    font-weight: 500;
}

select:hover {
    border-color: var(--accent-primary);
    background-color: var(--bg-body);
}

/* Adjust icon color for dark mode */
[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Repo Workflow */
.repo-workflow {
    margin-top: 8px;
    font-size: 11px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.workflow-label {
    color: var(--text-secondary);
    font-size: 11px;
    flex-shrink: 0;
    padding-top: 1px;
}

.workflow-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.workflow-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 11px;
    transition: color 0.2s;
}

.workflow-link:hover {
    color: var(--text-primary);
    text-decoration: none;
}

/* Skeleton Loading */
.skeleton {
    background: var(--border-color);
    background: linear-gradient(90deg, var(--border-color) 25%, var(--bg-body) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    opacity: 0.7;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    width: 60%;
}

.skeleton-text.short {
    width: 30%;
}

.skeleton-text.long {
    width: 90%;
}

.skeleton-title {
    height: 20px;
    width: 50%;
    margin-bottom: 12px;
}

.repo-card.skeleton-card {
    pointer-events: none;
    border-color: var(--border-color);
}

.repo-card.skeleton-card .repo-header {
    margin-bottom: 12px;
}

.repo-card.skeleton-card .skeleton-title {
    margin-bottom: 16px;
}

.repo-card.skeleton-card .repo-footer {
    padding-top: 0;
    border-top-color: transparent;
}

/* Category Sections */
.category-section {
    margin-bottom: 1.5rem;
}

.category-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.category-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
    opacity: 0.5;
}