:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-overlay: rgba(13, 17, 23, 0.8);
    --border-default: #30363d;
    --border-muted: #21262d;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --text-link: #58a6ff;
    --text-link-hover: #79c0ff;
    --accent-primary: #238636;
    --accent-emphasis: #2ea043;
    --danger: #da3633;
    --warning: #9e6a03;
    --success: #3fb950;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.light-mode {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #ffffff;
    --bg-overlay: rgba(246, 248, 250, 0.9);
    --border-default: #d0d7de;
    --border-muted: #eaeef2;
    --text-primary: #24292f;
    --text-secondary: #57606a;
    --text-link: #0969da;
    --text-link-hover: #0550ae;
    --accent-primary: #1f883d;
    --accent-emphasis: #1a7f37;
    --danger: #cf222e;
    --warning: #9a6700;
    --success: #1a7f37;
    --shadow: 0 8px 24px rgba(140, 149, 159, 0.2);
    --shadow-sm: 0 1px 3px rgba(140, 149, 159, 0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background 0.2s ease, color 0.2s ease;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-default);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 16px;
}

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

.github-logo {
    color: var(--text-primary);
}

.site-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.nav-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-btn.active {
    color: var(--text-primary);
    border-color: var(--border-default);
    background: var(--bg-tertiary);
}

.nav-btn .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--accent-primary);
    color: white;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.theme-toggle {
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.hidden {
    display: none !important;
}

/* Main Content */
.main-content {
    padding: 32px 0;
    min-height: calc(100vh - 64px);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Search Section */
.search-section {
    margin-bottom: 24px;
}

.search-wrapper {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 12px 48px 12px 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--text-link);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.search-clear:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.keyboard-hints {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
}

.hint {
    font-size: 12px;
    color: var(--text-secondary);
}

kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    color: var(--text-primary);
}

/* Filters */
.filters-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-select {
    padding: 6px 32px 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%238b949e' d='M4.427 7.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 7H4.604a.25.25 0 00-.177.427z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.filter-select:focus {
    outline: none;
    border-color: var(--text-link);
}

.results-info {
    margin-left: auto;
    font-size: 14px;
    color: var(--text-secondary);
}

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

.repo-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    padding: 16px;
    transition: all 0.2s;
    cursor: pointer;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.repo-card:hover {
    border-color: var(--text-link);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.repo-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.repo-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.repo-info {
    flex: 1;
    min-width: 0;
}

.repo-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-link);
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.repo-name:hover {
    color: var(--text-link-hover);
    text-decoration: underline;
}

.repo-category {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.repo-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.repo-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.action-btn {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-link);
}

.action-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.action-btn.liked {
    color: #da3633;
    border-color: #da3633;
}

/* Loading & Empty States */
.loading-state {
    text-align: center;
    padding: 80px 20px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-default);
    border-top-color: var(--text-link);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.no-results {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.no-results svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* Learning Paths */
.learning-paths-header {
    text-align: center;
    margin-bottom: 32px;
}

.learning-paths-header h2 {
    font-size: 28px;
    margin-bottom: 8px;
}

.learning-paths-header p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.learning-paths-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.learning-path-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    padding: 20px;
}

.path-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.path-title {
    font-size: 20px;
    font-weight: 600;
}

.path-actions {
    display: flex;
    gap: 8px;
}

.path-description {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.path-repos {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.path-repo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
}

.drag-handle {
    cursor: grab;
    color: var(--text-secondary);
}

.drag-handle:active {
    cursor: grabbing;
}

.path-repo-info {
    flex: 1;
}

.path-repo-name {
    font-weight: 500;
    color: var(--text-link);
}

.path-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--text-secondary);
}

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

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    padding: 24px;
    text-align: center;
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-link);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.stats-section {
    margin-bottom: 32px;
}

.stats-section h3 {
    font-size: 20px;
    margin-bottom: 16px;
}

.top-list {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    overflow: hidden;
}

.top-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-default);
}

.top-item:last-child {
    border-bottom: none;
}

.top-item-rank {
    font-weight: 700;
    font-size: 20px;
    color: var(--text-secondary);
    width: 40px;
}

.top-item-name {
    flex: 1;
    font-weight: 500;
}

.top-item-value {
    font-weight: 600;
    color: var(--text-link);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 1px solid var(--border-default);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-emphasis);
    border-color: var(--accent-emphasis);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: var(--shadow);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.path-modal-content {
    max-width: 500px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.path-modal-body h2 {
    margin-bottom: 16px;
}

.path-input,
.path-textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 12px;
}

.path-input:focus,
.path-textarea:focus {
    outline: none;
    border-color: var(--text-link);
}

.path-textarea {
    resize: vertical;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.help-content h2 {
    margin-bottom: 24px;
}

.shortcuts-grid {
    display: grid;
    gap: 16px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 0;
    }

    .header-nav {
        width: 100%;
        overflow-x: auto;
    }

    .nav-btn {
        padding: 6px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    .repos-grid {
        grid-template-columns: 1fr;
    }

    .search-input {
        font-size: 14px;
    }

    .keyboard-hints {
        display: none;
    }

    .filters-section {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select {
        flex: 1;
    }

    .results-info {
        margin-left: 0;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

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

    .site-title {
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 32px 0;
    padding: 20px;
}

.pagination-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}
