/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header styles */
.header {
    background-color: #b92b27;
    color: white;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

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

.search-input {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    width: 300px;
    font-size: 14px;
    background-color: rgba(255,255,255,0.9);
}

.search-input:focus {
    outline: none;
    background-color: white;
}

.nav-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-btn {
    background: none;
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.nav-btn:hover {
    background-color: rgba(255,255,255,0.1);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.3);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Main content layout */
.main {
    padding: 24px 0;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    align-items: start;
}

.main-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Question container */
.question-container {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.question-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
    line-height: 1.3;
    color: #111827;
}

.question-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    color: #6b7280;
    font-size: 14px;
}

.question-stats {
    display: flex;
    align-items: center;
}

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

.action-btn {
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn:hover {
    background-color: #e5e7eb;
    transform: translateY(-1px);
}

/* Answer cards */
.answers-section {
    padding: 0;
}

.answer-card {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s;
}

.answer-card:hover {
    background-color: #fafafa;
}

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

.user-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.user-info .user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #e5e7eb;
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #111827;
}

.user-credentials {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 2px;
}

.user-joined {
    font-size: 12px;
    color: #9ca3af;
}

.answer-date {
    font-size: 14px;
    color: #6b7280;
}

.answer-content {
    margin-bottom: 20px;
    line-height: 1.7;
}

.answer-content p {
    margin-bottom: 16px;
}

.answer-content ul {
    margin-left: 20px;
    margin-bottom: 16px;
}

.answer-content li {
    margin-bottom: 8px;
}

.answer-content strong {
    color: #111827;
    font-weight: 600;
}

/* Answer actions */
.answer-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

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

.vote-btn {
    background: none;
    border: 1px solid #d1d5db;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.vote-btn:hover {
    background-color: #f3f4f6;
    transform: scale(1.1);
}

.vote-btn.upvote.active {
    background-color: #1a73e8;
    color: white;
    border-color: #1a73e8;
}

.vote-btn.downvote.active {
    background-color: #dc2626;
    color: white;
    border-color: #dc2626;
}

.vote-icon {
    font-size: 16px;
    font-weight: bold;
}

.vote-count {
    font-weight: 600;
    color: #374151;
    min-width: 24px;
    text-align: center;
}

.comment-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

.comment-btn:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.comment-icon {
    margin-right: 4px;
}

/* Comments section */
.comments-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

.comment {
    margin-bottom: 16px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

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

.comment-info {
    flex: 1;
}

.comment-author {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
}

.comment-meta {
    font-size: 12px;
    color: #6b7280;
}

.comment-text {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vote-btn-small, .upvote-small, .downvote-small {
    background: none;
    border: 1px solid #d1d5db;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
}

.vote-btn-small:hover, .upvote-small:hover, .downvote-small:hover {
    background-color: #f3f4f6;
}

.vote-count-small {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.reply-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.reply-btn:hover {
    background-color: #e5e7eb;
    color: #374151;
}

.add-comment {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.comment-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

.comment-input:focus {
    outline: none;
    border-color: #1a73e8;
}

.comment-submit {
    background-color: #1a73e8;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.comment-submit:hover {
    background-color: #1557b0;
}

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

.sidebar-section {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #111827;
}

.related-questions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.related-question {
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.related-question:hover {
    background-color: #f8f9fa;
}

.related-question h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #1a73e8;
    line-height: 1.4;
}

.trending-topics {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trending-topic {
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.trending-topic:hover {
    background-color: #f8f9fa;
}

.trending-topic h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #111827;
}

.question-meta, .topic-meta {
    font-size: 12px;
    color: #6b7280;
}

/* Footer */
.footer {
    background-color: #111827;
    color: white;
    padding: 24px 0;
    margin-top: 48px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-link {
    color: #d1d5db;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-link:hover {
    color: white;
}

.footer-copyright {
    font-size: 14px;
    color: #9ca3af;
}

/* Responsive design */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .sidebar {
        order: -1;
    }
    
    .search-input {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .nav {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-input {
        width: 150px;
    }
    
    .nav-buttons {
        gap: 8px;
    }
    
    .nav-btn {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .question-title {
        font-size: 20px;
    }
    
    .question-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .answer-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .user-info {
        width: 100%;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .search-input {
        width: 120px;
    }
    
    .question-container {
        padding: 16px;
    }
    
    .answer-card {
        padding: 16px;
    }
    
    .sidebar-section {
        padding: 16px;
    }
    
    .user-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .user-info .user-avatar {
        width: 40px;
        height: 40px;
    }
    
    .answer-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .vote-section {
        flex-wrap: wrap;
    }
}

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

.comments-section {
    animation: fadeIn 0.3s ease-out;
}

.answer-card {
    animation: fadeIn 0.5s ease-out;
}

/* Accessibility improvements */
.vote-btn:focus,
.action-btn:focus,
.comment-btn:focus,
.nav-btn:focus {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

.search-input:focus,
.comment-input:focus {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .header,
    .sidebar,
    .footer,
    .answer-actions,
    .comment-actions,
    .question-actions {
        display: none;
    }
    
    .main-content {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
    }
}