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

:root {
    --reddit-orange: #FF4500;
    --reddit-blue: #0079D3;
    --bg-primary: #DAE0E6;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F8F9FA;
    --text-primary: #1A1A1B;
    --text-secondary: #7C7C7C;
    --border-color: #CCCCCC;
    --hover-bg: #F5F5F5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Header */
.header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    height: 56px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
}

.logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.site-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: 20px;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: var(--hover-bg);
}

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

.search-section {
    flex: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-tertiary);
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--reddit-blue);
    background-color: var(--bg-secondary);
}

.user-section {
    display: flex;
    gap: 8px;
}

.btn-login,
.btn-signup {
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-login {
    background-color: transparent;
    color: var(--reddit-blue);
    border: 1px solid var(--reddit-blue);
}

.btn-login:hover {
    background-color: #EFF7FF;
}

.btn-signup {
    background-color: var(--reddit-blue);
    color: white;
}

.btn-signup:hover {
    background-color: #0064A8;
}

/* Main Container */
.main-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 312px;
    gap: 24px;
}

/* Posts Section */
.posts-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sort-bar {
    background-color: var(--bg-secondary);
    padding: 12px 16px;
    border-radius: 4px;
    display: flex;
    gap: 8px;
    border: 1px solid var(--border-color);
}

.sort-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

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

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

/* Post Card */
.post-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    padding: 8px;
    transition: border-color 0.2s;
}

.post-card:hover {
    border-color: #898989;
}

.vote-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 8px;
    gap: 4px;
}

.vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: all 0.2s;
}

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

.vote-btn.upvote:hover {
    color: var(--reddit-orange);
}

.vote-btn.downvote:hover {
    color: #7193FF;
}

.vote-count {
    font-weight: 700;
    font-size: 12px;
    color: var(--text-primary);
    min-width: 24px;
    text-align: center;
}

.post-content {
    flex: 1;
    padding: 4px 8px;
}

.post-header {
    display: flex;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 8px;
    align-items: center;
}

.subreddit-name {
    font-weight: 700;
    color: var(--text-primary);
}

.post-author,
.post-time {
    color: var(--text-secondary);
}

.post-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
    cursor: pointer;
}

.post-title:hover {
    text-decoration: underline;
}

.post-text {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.post-image {
    margin-bottom: 12px;
    border-radius: 4px;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: auto;
    display: block;
}

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

.action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 2px;
    transition: background-color 0.2s;
}

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

.action-btn svg {
    width: 16px;
    height: 16px;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
}

.sidebar-card h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.sidebar-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.btn-primary {
    width: 100%;
    padding: 8px;
    background-color: var(--reddit-blue);
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #0064A8;
}

.community-list {
    list-style: none;
}

.community-list li {
    margin-bottom: 8px;
}

.community-list a {
    color: var(--reddit-blue);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.community-list a:hover {
    text-decoration: underline;
}

.link-with-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.link-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

.link-with-logo svg.link-logo {
    width: 20px;
    height: 20px;
    color: var(--reddit-blue);
}

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

    .sidebar {
        order: -1;
    }

    .header-container {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 20px;
    }

    .nav {
        order: 3;
        width: 100%;
        margin-top: 8px;
    }

    .search-section {
        max-width: none;
        flex: 1;
    }
}

@media (max-width: 640px) {
    .header-container {
        flex-direction: column;
        align-items: stretch;
    }

    .logo-section {
        margin-right: 0;
    }

    .user-section {
        width: 100%;
        justify-content: stretch;
    }

    .btn-login,
    .btn-signup {
        flex: 1;
    }
}

