.blog-detail-container {
    background: #F8F9FA;
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* detail-header removed */
/* .detail-header { ... } */

.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem 0 1rem;
    /* Top padding for spacing */
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6B7280;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.back-btn:hover {
    background: #F3F4F6;
    color: #374151;
}

.back-btn .material-icons {
    font-size: 20px;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 8px;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.action-btn:hover {
    background: #F3F4F6;
    color: #374151;
}

.action-btn.active {
    color: #6366F1;
    background: #EEF2FF;
}

.action-btn .material-icons {
    font-size: 20px;
}

.post-detail {
    background: white;
    border-radius: 16px;
    margin: 2rem 0;
    overflow: hidden;
    border: 1px solid #E5E7EB;
}

.post-category-badge {
    background: #EEF2FF;
    color: #6366F1;
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: center;
}

.featured-image {
    background: #F3F4F6;
    overflow: hidden;
}

.featured-image img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

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

.post-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1F2937;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

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

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

.author-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.author-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.author-name {
    font-weight: 600;
    color: #1F2937;
    font-size: 1rem;
}

.author-handle {
    color: #6B7280;
    font-size: 0.875rem;
}

.post-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6B7280;
    font-size: 0.875rem;
}

.stat-item .material-icons {
    font-size: 16px;
}

.tldr-section {
    margin: 1.5rem 2rem;
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    border-radius: 12px;
    padding: 1.5rem;
}

.tldr-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tldr-header .material-icons {
    color: #D97706;
    font-size: 20px;
}

.tldr-label {
    color: #D97706;
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.tldr-content {
    color: #92400E;
    line-height: 1.6;
    font-weight: 500;
}

.post-content {
    padding: 1rem 2rem 2rem;
    line-height: 1.8;
    font-size: 1.125rem;
    color: #374151;
}

.post-content h1,
.post-content h2,
.post-content h3 {
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #1F2937;
}

.post-content h1 {
    font-size: 2rem;
}

.post-content h2 {
    font-size: 1.5rem;
}

.post-content h3 {
    font-size: 1.25rem;
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.post-content a {
    color: #6366F1;
    text-decoration: none;
    font-weight: 600;
}

.post-content a:hover {
    text-decoration: underline;
}

.post-content code {
    background: #F3F4F6;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.post-content pre {
    background: #1F2937;
    color: #F9FAFB;
    padding: 1.5rem;
    border-radius: 12px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

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

.post-content blockquote {
    border-left: 4px solid #6366F1;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    color: #6B7280;
    font-style: italic;
}

.post-actions-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-top: 1px solid #F3F4F6;
    background: #FAFBFC;
}

.action-group {
    display: flex;
    gap: 1rem;
}

.post-actions-footer .action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6B7280;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.2s;
    background: none;
    border: none;
    text-decoration: none;
}

.post-actions-footer .action-btn:hover {
    background: #F3F4F6;
    color: #374151;
}

.post-actions-footer .action-btn.active {
    color: #6366F1;
    background: #EEF2FF;
}

.post-actions-footer .action-btn .material-icons {
    font-size: 18px;
}

.action-count,
.action-text {
    font-weight: 600;
}

.upvote-btn.active {
    color: #EF4444 !important;
    background: #FEE2E2 !important;
}


.save-btn.active {
    color: #DC2626 !important;
    background: #FEF2F2 !important;
}

.related-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    border: 1px solid #E5E7EB;
}

.related-section h3 {
    color: #1F2937;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

.related-posts-list {
    display: grid;
    gap: 1rem;
}

.related-post-item {
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
}

.related-post-item:hover {
    border-color: #6366F1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.related-post-link {
    display: block;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
}

.related-post-link h4 {
    color: #1F2937;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.related-post-link p {
    color: #6B7280;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.related-post-author {
    color: #9CA3AF;
    font-size: 0.75rem;
    font-weight: 500;
}

.related-post-link:hover h4 {
    color: #6366F1;
}

@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }

    .detail-header {
        padding: 0.75rem 0;
    }

    .back-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }

    .back-btn .material-icons {
        font-size: 18px;
    }

    .header-actions {
        gap: 0.25rem;
    }

    .action-btn {
        padding: 0.375rem;
    }

    .action-btn .material-icons {
        font-size: 18px;
    }

    .post-detail {
        margin: 1rem 0;
        border-radius: 12px;
    }

    .featured-image img {
        height: 200px;
    }

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

    .post-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

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

    .author-avatar {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .post-stats {
        gap: 1rem;
    }

    .stat-item {
        font-size: 0.8rem;
    }

    .tldr-section {
        margin: 1rem;
        padding: 1rem;
    }

    .post-content {
        padding: 1rem;
        font-size: 1rem;
    }

    .post-content h1 {
        font-size: 1.5rem;
    }

    .post-content h2 {
        font-size: 1.25rem;
    }

    .post-content h3 {
        font-size: 1.125rem;
    }

    .post-actions-footer {
        padding: 0.75rem;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0;
        align-items: center;
    }

    .action-group {
        display: contents;
    }

    .post-actions-footer .action-btn {
        padding: 0.5rem;
        font-size: 0.8rem;
        width: 100%;
        justify-content: center;
    }

    .post-actions-footer .action-btn .material-icons {
        font-size: 16px;
    }

    .related-section {
        padding: 1.5rem 1rem;
        margin: 1rem 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }

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

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

    .author-info {
        gap: 0.5rem;
    }

    .author-avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .author-name {
        font-size: 0.875rem;
    }

    .author-handle {
        font-size: 0.8rem;
    }

    .post-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tldr-section {
        margin: 0.75rem;
        padding: 0.75rem;
    }

    .post-content {
        padding: 0.75rem;
    }

    .post-actions-footer {
        padding: 0.75rem;
    }

    .related-section {
        padding: 1rem 0.75rem;
    }
}

@media (max-width: 400px) {

    .post-actions-footer .action-btn .action-text,
    .post-actions-footer .action-btn .action-count {
        display: none !important;
    }

    .post-actions-footer .action-btn {
        justify-content: center;
        padding: 0.5rem;
    }
}

/* Voting Loader Modal */
.voting-loader-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.voting-loader-modal.show {
    display: flex;
}

.voting-loader-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    min-width: 200px;
}

.voting-loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E5E7EB;
    border-top: 4px solid #6366F1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.voting-loader-content p {
    margin: 0;
    color: #6B7280;
    font-weight: 500;
}

/* Comments Section Styles */
.comments-section-wrapper {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    border: 1px solid #E5E7EB;
}

.comments-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.comments-header-row h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #1F2937;
}

.sort-dropdown {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6B7280;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.875rem;
}

/* Comment Input */
.main-comment-input {
    margin-bottom: 2rem;
}

.comment-form {
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    overflow: hidden;
}

.comment-form textarea {
    width: 100%;
    border: none;
    padding: 1rem;
    resize: vertical;
    outline: none;
    font-family: inherit;
    min-height: 100px;
    background: #F9FAFB;
}

.comment-form textarea:focus {
    background: white;
}

.form-actions {
    background: #F9FAFB;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    border-top: 1px solid #E5E7EB;
}

.btn-submit {
    background: #6366F1;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-submit:hover {
    background: #4F46E5;
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-cancel {
    background: none;
    border: none;
    color: #6B7280;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 1rem;
}

/* Comment Item */
.comment-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.comment-sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 32px;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    background: #E0E7FF;
    color: #6366F1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.comment-thread-line {
    flex-grow: 1;
    width: 2px;
    background: #E5E7EB;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    /* Only show thread line if there are children, but hard to know easily in CSS alone without JS logic. 
       Usually Reddit lines are hoverable. For simplicity we assume just a guide. */
    min-height: 20px;
}

/* Hide thread line for last item? 
   No, we will let it extend in recursive structure if we structure HTML right. 
   Our current structure is flat list in recursion. */

.comment-main {
    flex-grow: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.comment-author {
    font-weight: 600;
    color: #1F2937;
}

.comment-meta {
    color: #9CA3AF;
}

.comment-date {
    font-size: 0.7rem;
    font-weight: 400;
    color: #9CA3AF;
}

.comment-body {
    color: #374151;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.comment-footer {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.vote-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #F3F4F6;
    border-radius: 20px;
    padding: 2px 8px;
}

.comment-action-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    color: #6B7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.875rem;
    gap: 0.25rem;
}

.comment-action-btn:hover {
    background: #E5E7EB;
    border-radius: 4px;
}

.vote-btn .material-icons {
    font-size: 18px;
}

/* --- New Author Stats Card & Redesign Styles --- */

.post-header-mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

.author-stats-card {
    margin-top: 1rem;
}

.author-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.author-avatar-wrapper {
    position: relative;
    width: 64px;
    height: 64px;
}

.author-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #8B5CF6 0%, #D946EF 100%);
    padding: 3px;
    /* Gradient border */
}

.author-avatar img {
    border: 3px solid white;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.author-details {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.02em;
}

.author-handle {
    font-size: 0.875rem;
    font-weight: 600;
    color: #9CA3AF;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6B7280;
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-item .material-icons {
    font-size: 18px;
    color: #9CA3AF;
}

/* Tablet & Mobile Overrides */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .post-header-mobile-only {
        display: block;
        padding: 1.5rem 1rem 0 1rem;
    }

    .post-header-mobile-only .post-title {
        font-size: 1.75rem;
        font-weight: 800;
        line-height: 1.2;
        color: #111827;
        margin: 0;
    }

    /* Card Style for Author Stats on Mobile */
    .author-stats-card {
        background: white;
        border-radius: 24px;
        /* Rounded corners like design */
        padding: 1.5rem;
        box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.08);
        border: 1px solid #F3F4F6;
        margin-top: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        /* Force 3 columns if space allows, or flex wrap */
        column-gap: 0.5rem;
        row-gap: 1rem;
    }

    .stat-item {
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .stat-item .material-icons {
        font-size: 16px;
    }

    /* Modify Post Header padding */
    .post-header {
        padding: 0 1rem 1rem 1rem;
        /* Reduced top padding as title is moved above image */
    }

    /* Featured Image Adjustment */
    .featured-image {
        margin: 1rem;
        border-radius: 24px;
        overflow: hidden;
        box-shadow: none;
        /* Clean flat look */
    }

    .featured-image img {
        height: auto;
        aspect-ratio: 16/9;
    }
}

@media (max-width: 450px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        /* Keep compact */
    }

    .stat-item span {
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.upvote:hover {
    color: #EF4444;
}

.vote-count {
    font-size: 0.875rem;
    font-weight: 700;
    color: #4B5563;
}

.reply-form-container {
    margin-top: 1rem;
}

.comment-replies {
    margin-top: 1.5rem;
}

.user-avatar-small {
    display: none;
    /* Hide for now, layout complex */
}

/* Recursive indent */
.comment-replies .comment-item {
    margin-bottom: 1rem;
}

/* Markdown Table Styles */
.post-content table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.post-content th,
.post-content td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #E5E7EB;
    text-align: left;
    vertical-align: top;
}

.post-content th {
    font-weight: 700;
    color: #1F2937;
    background: #F9FAFB;
    border-bottom: 2px solid #E5E7EB;
}

.post-content tr:hover {
    background: #F9FAFB;
}

.post-content tr:last-child td {
    border-bottom: none;
}

/* Author Stats Card Redesign */

.author-stats-card {
    background: white;
    border-radius: 20px;
    /* Highly rounded as per Image 1 */
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    /* Soft shadow */
    border: 1px solid #F3F4F6;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.author-section-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    /* Removed min-width to save space */
}

.author-avatar-wrapper {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 3px;
    /* Gradient Ring - Purple/Pink like Image 1 */
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    flex-shrink: 0;
}

.author-avatar {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 50%;
    border: 3px solid white;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.author-avatar img {
    border-radius: 50%;
    width: 100%;
    height: 100%;
    display: block;
}

/* Author Text */
.author-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.125rem;
    /* Tight spacing between name and handle */
}

.author-real-name {
    font-size: 1.125rem;
    /* 18px */
    font-weight: 800;
    /* Extra bold */
    color: #111827;
    /* Dark text */
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.author-username-small {
    font-size: 0.8rem;
    /* ~13px */
    font-weight: 700;
    color: #9CA3AF;
    /* Light gray */
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Divider Line */
.stats-divider {
    width: 1px;
    height: 40px;
    /* Slightly shorter */
    background: #E5E7EB;
}

/* Stats Grid Right */
.stats-grid-right {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    flex-grow: 1;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #6B7280;
    /* Gray text specific to stats */
    font-size: 0.85rem;
    /* Smaller stats text */
    font-weight: 600;
    white-space: nowrap;
}

.stat-item .material-icons {
    font-size: 18px;
    color: #9CA3AF;
    /* Light gray icons */
}

/* Force read-time to next row if we want exact Image 1 layout */
.break-row-on-desktop {
    grid-column: 1 / -1;
    /* Start new row */
    margin-top: 0.25rem;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .author-stats-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .stats-divider {
        display: none;
    }

    .stats-grid-right {
        width: 100%;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .break-row-on-desktop {
        grid-column: auto;
        /* Reset */
    }
}