/* Reset and base styles */
:root {
    --primary-color: #9C27B0;
    --text-color: #333;
    --background: #f5f5f5;
    --white: #fff;
    --border-color: #ddd;
    --accent-color: #FF4081;
    --error-color: #f44336;
    --success-color: #4CAF50;
}

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

body {
    font-family: Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background-color: var(--white);
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    flex-shrink: 0;
}

.logo img {
    height: 40px;
    width: auto;
    display: block;
}

.logo-text {
    font-size: 18px;
    font-weight: bold;
    margin-left: 0.5rem;
    color: var(--primary-color);
}

.search-form {
    flex: 1;
    max-width: 500px;
    display: flex;
    gap: 0.5rem;
}

.search-form input {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.search-form button {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.main-nav {
    display: flex;
    gap: 1rem;
    margin-left: auto;
}

.btn {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    text-align: center;
    display: inline-block;
}

/* Main content */
.main-content {
    flex: 1;
    padding: 2rem 1rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 2rem;
    align-items: start;
}

/* Sidebar */
.sidebar {
    background-color: var(--white);
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 1rem;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-section h2 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.category-list, .community-list, .trending-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-item, .community-item, .trending-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.9rem;
}

.category-item i, .community-icon {
    margin-right: 0.5rem;
}

.community-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 12px;
}

.sidebar-actions {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.trending-title {
    font-weight: bold;
    display: block;
}

.trending-meta {
    font-size: 0.8rem;
    color: #666;
}

/* Posts */
.posts-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post {
    background-color: var(--white);
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.post-wrapper {
    display: flex;
    gap: 1rem;
}

.post-votes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.vote-button {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 1.2rem;
}

.vote-count {
    font-size: 0.9rem;
    font-weight: bold;
}

.post-content {
    flex: 1;
    min-width: 0;
}

.post-link {
    text-decoration: none;
    color: inherit;
}

.post-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: bold;
}

.post-type {
    background: var(--primary-color);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-right: 0.5rem;
    font-weight: normal;
}

.post-meta {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.post-text {
    margin-bottom: 1rem;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    font-size: 0.9rem;
}

.post-media {
    margin-bottom: 1rem;
    text-align: center;
    background-color: #f9f9f9;
    border-radius: 4px;
    overflow: hidden;
}

.post-media img {
    max-height: 300px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 4px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.post-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.post-action {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #666;
    font-size: 0.9rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.post-action i {
    margin-right: 0.5rem;
}

/* Comments */
.comments-section {
    background-color: var(--white);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 1rem;
    padding: 1.5rem;
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.comments-header h2 {
    font-size: 1.2rem;
    color: var(--text-color);
    margin: 0;
    font-weight: bold;
}

.comment-sort-button {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-form {
    margin-bottom: 2rem;
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #eee;
}

.comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    resize: vertical;
    background-color: #fff;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(156, 39, 176, 0.1);
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.comment {
    padding: 1rem;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.comment:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-left-width: 4px;
}

.comment-meta {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.75rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.comment-author {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 0.95rem;
}

.comment-time {
    color: #777;
    font-size: 0.8rem;
}

.comment-content {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    padding: 0.25rem 0;
    white-space: pre-line;
}

.comment-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid #eee;
    padding-top: 0.5rem;
}

.comment-action {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
    display: flex;
    align-items: center;
    padding: 0.2rem 0;
    transition: color 0.2s ease;
}

.comment-action:hover {
    color: var(--primary-color);
}

.comment-action i {
    margin-right: 0.4rem;
    font-size: 0.85rem;
}

.reply-form {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f5f5f5;
    border-radius: 4px;
    border: 1px solid #eee;
}

.reply-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    resize: vertical;
    background-color: #fff;
}

.reply-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(156, 39, 176, 0.1);
}

.reply-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.replies {
    margin-top: 1rem;
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.replies .comment {
    border-left: 2px solid #7B1FA2;
    background-color: #f5f5f5;
}

.edit-comment-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    resize: vertical;
    background-color: #fff;
}

.edit-comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(156, 39, 176, 0.1);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.alert-success {
    background-color: #E8F5E9;
    color: var(--success-color);
    border: 1px solid #C8E6C9;
}

.alert-error {
    background-color: #FFEBEE;
    color: var(--error-color);
    border: 1px solid #FFCDD2;
}

.no-posts {
    padding: 2rem;
    text-align: center;
    background-color: var(--white);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 1rem;
}

/* Footer */
.footer {
    background-color: var(--white);
    padding: 1.5rem 1rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-info {
    font-size: 0.9rem;
    color: #666;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Desktop-first responsive design */
@media (max-width: 1200px) {
    .main-content {
        max-width: 100%;
    }
    
    .content-wrapper {
        grid-template-columns: 200px 1fr 200px;
        gap: 1.5rem;
    }
}

@media (max-width: 992px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-form {
        max-width: 100%;
        width: 100%;
    }
    
    .main-nav {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        margin-left: 0;
    }
    
    .btn {
        flex: 1;
        text-align: center;
        min-width: 120px;
    }
    
    .post-wrapper {
        flex-direction: column;
    }
    
    .post-votes {
        flex-direction: row;
        justify-content: center;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 0.75rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.75rem;
    }
    
    .main-content {
        padding: 1rem 0.5rem;
    }
    
    .main-nav {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .post-title {
        font-size: 1.1rem;
    }
}
