/* Base Styles */
:root {
    --primary: #1565C0;
    --primary-dark: #0D47A1;
    --primary-light: #42A5F5;
    --dark: #1a1a1a;
    --light: #f5f5f5;
    --border: #e0e0e0;
    --text: #1a1a1a;
    --text-light: #424242;
    --bg-white: #ffffff;
    --success: #4CAF50;
    --warning: #FF9800;
    --error: #F44336;
}

body.dark-theme {
    --light: #1e1e1e;
    --dark: #f5f5f5;
    --border: #444;
    --text: #ffffff;
    --text-light: #e0e0e0;
    --bg-white: #2a2a2a;
    --primary: #64B5F6;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--light);
    color: var(--text);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 1rem 0 0.5rem 0;
    color: var(--text);
}

p {
    margin-bottom: 1rem;
    color: var(--text-light);
    line-height: 1.8;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* Navigation */
.navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.nav-right {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--light);
    color: var(--text);
    border: 1px solid var(--border);
}

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

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Section Title */
.section-title {
    font-size: 1.75rem;
    font-weight: 600;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 0.75rem;
    margin: 3rem 0 2rem 0;
    color: var(--text);
}

.header-section {
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.header-section h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.header-section > p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.category-card {
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 2rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.category-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(33, 150, 243, 0.2);
    transform: translateY(-4px);
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: inline-block;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(33, 150, 243, 0.1);
    border-radius: 10px;
}

.category-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.category-desc {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    flex-grow: 1;
    line-height: 1.6;
}

.category-stats {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Two Column Layout */
.two-column {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Post Item */
.post-item {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    text-decoration: none;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
}

.post-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15);
}

.post-title {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.post-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.post-stats {
    text-align: right;
    white-space: nowrap;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
    flex-shrink: 0;
}

/* Sidebar Widget */
.sidebar-widget {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.75rem;
    color: var(--text);
}

.user-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

.leaderboard-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: var(--text-light);
    font-weight: 500;
}

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

.leaderboard-rank {
    font-weight: 700;
    color: var(--primary);
    margin-right: 0.75rem;
    display: inline-block;
    min-width: 30px;
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Search Box */
.search-box {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: 24px;
    width: 260px;
    font-size: 0.95rem;
    background: var(--bg-white);
    color: var(--text);
    transition: all 0.2s ease;
}

.search-box::placeholder {
    color: var(--text-light);
}

.search-box:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
    background: var(--bg-white);
    border-radius: 8px;
    border: 1px dashed var(--border);
}

/* Responsive */
@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: 1fr;
    }

    .two-column {
        grid-template-columns: 1fr;
    }

    .navbar-content {
        flex-direction: column;
        gap: 1rem;
    }

    .search-box {
        width: 100%;
    }

    .header-section h1 {
        font-size: 1.8rem;
    }

    .section-title {
        font-size: 1.4rem;
    }

    .post-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .post-stats {
        text-align: left;
    }

    .leaderboard-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .nav-right {
        width: 100%;
    }
}

/* Footer */
footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}
