:root {
    --primary-dark: #003366;
    --primary-medium: #336699;
    --accent-green: #4CAF50;
    --accent-yellow: #FFEB3B;
    --accent-orange: #FF9800;
    --neutral-light: #F8FAFC;
    --white: #FFFFFF;
    --text-primary: #1a202c;
    --text-secondary: #718096;
    --text-light: #9E9E9E;
    --border-color: #e2e8f0;
    --error-color: #ef4444;
    --success-color: #10b981;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f8fafb 0%, #e8f4f8 100%);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Enhanced Code Block Styling */
.code-container {
    position: relative;
    margin: 24px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-left: -0.9rem;
    margin-right: -0.9rem; 
}

pre {
    background: #0d1117 !important;
    /* Dark theme for better contrast */
    color: #e2e8f0 !important;
    border: none;
    border-radius: 0;
    padding: 20px;
    margin: 0;
    font-family: 'Fira Code', 'Monaco', 'Cascadia Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    position: relative;

    /* Fixed height with scrolling */
    max-height: 400px;
    overflow-y: auto;
    overflow-x: scroll;
}

pre code {
    background: transparent !important;
    color: inherit !important;
    padding: 0;
    border: none;
    white-space: pre;
    font-family: inherit;
    font-size: inherit;
}

/* Enhanced Copy Button */
.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(74, 85, 104, 0.9);
    color: #e2e8f0;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 14px;
    z-index: 10;
    transition: all 0.2s ease;
    opacity: 0.8;
    backdrop-filter: blur(4px);
}

.copy-btn:hover {
    background: var(--accent-green);
    opacity: 1;
    transform: scale(1.05);
}

.copy-btn.copied {
    background: var(--success-color);
    transform: scale(1.1);
}

/* Enhanced Scrollbar */
pre::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

pre::-webkit-scrollbar-track {
    background: #1a202c;
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

pre::-webkit-scrollbar-corner {
    background: #1a202c;
}

/* Post Container - Better Centering */
.post-container {
    /* max-width: 900px; */
    margin: 2rem auto;
    padding: 0 1rem;
}

.post-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

/* Post Header */
.post-header {
    padding: 2rem 2rem 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--neutral-light) 0%, var(--white) 100%);
}

.post-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid var(--accent-green);
    object-fit: cover;
}

.author-details h4 {
    color: var(--primary-dark);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.author-details .college {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem;
    border: none;
    background: var(--neutral-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
}

.action-btn:hover {
    background: var(--accent-green);
    color: var(--white);
    transform: translateY(-1px);
}

.post-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.post-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-style: italic;
}

.post-metadata {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.meta-icon {
    color: var(--accent-green);
}

.visibility-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.visibility-public {
    background: var(--success-color);
    color: var(--white);
}

.visibility-college {
    background: var(--accent-orange);
    color: var(--white);
}

/* Enhanced Post Content */
.post-content {
    padding: 2rem;
}

.post-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
    word-wrap: break-word;
}

/* Better typography for content */
.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.post-body h1 {
    font-size: 1.8rem;
}

.post-body h2 {
    font-size: 1.6rem;
}

.post-body h3 {
    font-size: 1.4rem;
}

.post-body p {
    margin-bottom: 1.2rem;
}

.post-body ul,
.post-body ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.post-body li {
    margin-bottom: 0.5rem;
}

.post-body blockquote {
    border-left: 4px solid var(--accent-green);
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    background: var(--neutral-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
}

/* FIXED: Image Alignment Styles */
.image-style-align-left {
    float: left !important;
    margin: 0 1.5em 1em 0 !important;
    max-width: 45% !important;
}

.image-style-align-right {
    float: right !important;
    margin: 0 0 1em 1.5em !important;
    max-width: 45% !important;
}

/* FIXED: Center aligned images */
figure.image-style-align-center {
    display: block !important;
    margin: 1.5em auto !important;
    text-align: center !important;
    width: auto !important;
    max-width: 80% !important;
    float: none !important;
}

figure.image img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    aspect-ratio: auto !important;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

figure.image_resized {
    max-width: 100% !important;
    height: auto !important;
}

/* Override inline width styles on center images */
figure.image-style-align-center[style*="width"] {
    width: auto !important;
}

figure.image_resized.image-style-align-center {
    width: auto !important;
    max-width: 80% !important;
}

/* Image captions */
figcaption {
    font-size: 0.9em;
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
    margin-top: 0.5em;
    padding: 0 1em;
}

.post-content::after,
.content::after {
    content: "";
    display: table;
    clear: both;
}

/* Tags Section */
.tags-section {
    padding: 1.5rem 2rem;
    background: var(--neutral-light);
    border-top: 1px solid var(--border-color);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.tags-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.tag-item {
    background: var(--accent-green);
    color: var(--white);
    padding: 0.4rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    display: inline-block;
}

.tag-item:hover {
    background: var(--primary-medium);
    transform: translateY(-1px);
    color: var(--white);
    text-decoration: none;
}

/* Engagement Section */
.engagement-section {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--white);
}

.engagement-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.engagement-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.engagement-btn:hover {
    border-color: var(--accent-green);
    color: var(--accent-green);
    transform: translateY(-1px);
}

.author-link {
    text-decoration: none;
    color: inherit;
    position: relative;
    display: inline-block;
    transition: color 0.3s ease;
}

.author-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--accent-green);
    transition: width 0.3s ease;
}

.author-link:hover {
    color: var(--primary-dark);
    text-decoration: none;
}

.author-link:hover::after {
    width: 100%;
}

.author-link h4 {
    margin: 0;
    transition: all 0.3s ease;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .post-container {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }

    .post-header {
        padding: 1.5rem 1rem 1rem 1rem;
    }

    .post-content {
        padding: 1.5rem 1rem;
    }

    .tags-section,
    .engagement-section {
        padding: 1rem;
    }

    .post-title {
        font-size: 1.8rem;
    }

    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .image-style-align-left,
    .image-style-align-right,
    .image-style-align-center {
        float: none !important;
        margin: 1em auto !important;
        display: block !important;
        max-width: 100% !important;
        width: auto !important;
    }

    .code-container pre {
        max-height: 300px;
        padding: 16px;
        font-size: 13px;
    }



    .copy-btn {
        top: 8px;
        right: 8px;
        padding: 6px 8px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .post-card {
        margin: 0;
        border-radius: 0;
    }

    .engagement-buttons {
        flex-direction: column;
    }

    .engagement-btn {
        width: 100%;
    }
}