
/* ===== CSS Variables ===== */
:root {
    --primary: #526cfe;
    --primary-light: #eef2ff;
    --bg: #ffffff;
    --surface: #f5f5f5;
    --text: #333333;
    --text-secondary: #666666;
    --border: #e0e0e0;
    --sidebar-bg: #f5f5f5;
    --header-bg: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
    --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

[data-theme="dark"] {
    --bg: #1e1e1e;
    --surface: #2d2d2d;
    --text: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border: #404040;
    --sidebar-bg: #252525;
    --header-bg: #1e1e1e;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

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

/* ===== Layout ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 300px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--sidebar-bg);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

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

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus { border-color: var(--primary); }

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 14px;
}

.sidebar-nav {
    padding: 16px 0;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-header {
    padding: 8px 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.nav-header:hover { color: var(--text); }

.nav-header i { font-size: 10px; transition: transform 0.2s; }

.nav-section.collapsed .nav-header i { transform: rotate(-90deg); }
.nav-section.collapsed .nav-items { display: none; }

.nav-items { list-style: none; }

.nav-items li a {
    display: block;
    padding: 6px 20px 6px 32px;
    color: var(--text-secondary);
    font-size: 14px;
    border-left: 2px solid transparent;
    transition: all 0.2s;
}

.nav-items li a:hover,
.nav-items li a.active {
    color: var(--primary);
    background: var(--primary-light);
    border-left-color: var(--primary);
    text-decoration: none;
}

.nav-count {
    float: right;
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: 300px;
    min-height: 100vh;
}

/* ===== Top Header ===== */
.top-header {
    position: sticky;
    top: 0;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 50;
    backdrop-filter: blur(10px);
}

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

.breadcrumb a { color: var(--text-secondary); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text);
    font-size: 16px;
    transition: all 0.2s;
}

.theme-toggle:hover { background: var(--surface); }

.github-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--surface);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.github-link:hover { background: var(--border); text-decoration: none; }

/* ===== Content Area ===== */
.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px;
}

.page-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 700px;
}

.stats-bar {
    display: flex;
    gap: 24px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-item i { color: var(--primary); }

/* ===== Section Headers ===== */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 40px 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary);
}

.section-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.section-header .count {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

/* ===== Cards Grid ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.2s;
    position: relative;
}

.card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    border-color: var(--primary);
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title a { color: inherit; }
.card-title a:hover { text-decoration: none; color: var(--primary); }

.card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.card-stars {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.card-stars i { color: #f1c40f; }

.card-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.tag.license { background: #e3f2fd; color: #1565c0; border-color: #bbdefb; }
.tag.language { background: #f3e5f5; color: #6a1b9a; border-color: #e1bee7; }
.tag.platform { background: #e8f5e9; color: #2e7d32; border-color: #c8e6c9; }

.card-links {
    display: flex;
    gap: 8px;
}

.card-links a {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.card-links a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    text-decoration: none;
}

/* ===== Mobile Menu Toggle ===== */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text);
    padding: 8px;
}

/* ===== Footer ===== */
.site-footer {
    text-align: center;
    padding: 40px 32px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 60px;
}

.site-footer a { color: var(--primary); }

/* ===== Scroll to Top ===== */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    z-index: 200;
    transition: all 0.2s;
}

.scroll-top:hover { transform: translateY(-3px); }
.scroll-top.visible { display: flex; }

/* ===== No Results ===== */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-results i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--border);
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.open { transform: translateX(0); }

    .main-content { margin-left: 0; }

    .menu-toggle { display: block; }

    .content { padding: 20px; }

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

    .page-header h1 { font-size: 24px; }

    .top-header {
        padding: 12px 16px;
    }

    .github-link span { display: none; }
}

/* ===== Overlay for mobile ===== */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.overlay.active { display: block; }

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

.card {
    animation: fadeIn 0.3s ease forwards;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }
