/* assets\styles\blog.css */

/* //////////////////////////////////////////////////
   BLOG DETAIL — MAIN LAYOUT
   ////////////////////////////////////////////////// */
.blog-detail-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 60px;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    align-items: start;
}

.blog-detail-main {
    min-width: 0;
}

/* //////////////////////////////////////////////////
   BACK LINK
   ////////////////////////////////////////////////// */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
    margin-top: 8%;
    transition: all 0.2s ease;
}

.back-link:hover {
    color: var(--primary);
    gap: 10px;
}

/* //////////////////////////////////////////////////
   ARTICLE HEADER
   ////////////////////////////////////////////////// */
.article-header {
    margin-bottom: 28px;
    background-color: var(--surface);
    padding: 20px 24px;
}

.article-category {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    background: rgba(var(--primary-rgb, 34, 197, 94), 0.1);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.article-title {
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.8px;
    margin-bottom: 16px;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-meta-item i {
    font-size: 15px;
}

.article-meta-divider {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--border);
}

/* //////////////////////////////////////////////////
   FEATURED IMAGE
   ////////////////////////////////////////////////// */
.article-image-wrapper {
    margin-bottom: 32px;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--sidebar-hover);
}

.article-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* //////////////////////////////////////////////////
   ARTICLE BODY
   ////////////////////////////////////////////////// */
.article-body {
    font-size: 16px;
    line-height: 1.85;
    color: var(--text);
    background-color: var(--surface);
    padding: 20px 24px;
    overflow-wrap: break-word; /* Break long words */
    word-wrap: break-word; /* Legacy */
    word-break: break-word; /* For long URLs */
}

.article-body h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 36px 0 14px;
    letter-spacing: -0.3px;
}

.article-body h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 28px 0 10px;
    letter-spacing: -0.2px;
}

.article-body p {
    margin-bottom: 18px;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.article-body img {
    max-width: 100%;
    height: auto; /* Maintain aspect ratio */
    border-radius: 12px;
    margin: 20px 0;
    display: block; /* Prevent inline spacing issues */
}

.article-body blockquote {
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    margin: 24px 0;
    background: var(--sidebar-hover);
    border-radius: 0 12px 12px 0;
    font-style: italic;
    color: var(--text);
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.article-body ul,
.article-body ol {
    margin-bottom: 18px;
    padding-left: 24px;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.article-body li {
    margin-bottom: 6px;
}

.article-body a {
    color: var(--primary);
    text-decoration: underline;
    word-break: break-all; /* Break long URLs in links */
}

.article-body code {
    background: var(--sidebar-hover);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: monospace;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-all; /* Break long code strings */
    display: inline-block; /* Allow breaking */
    max-width: 100%; /* Prevent overflow */
}

/* Add this for code blocks if you have them */
.article-body pre {
    background: var(--sidebar-hover);
    padding: 16px 20px;
    border-radius: 8px;
    overflow-x: auto; /* Scroll horizontally for code blocks */
    margin: 20px 0;
    max-width: 100%;
}

.article-body pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 0.9em;
    font-family: monospace;
    display: block;
    white-space: pre-wrap; /* Wrap long lines */
    word-break: break-all;
}

/* Handle tables */
.article-body table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
}

.article-body table td,
.article-body table th {
    padding: 8px 12px;
    border: 1px solid var(--border);
}

/* Handle iframes/videos */
.article-body iframe,
.article-body video {
    max-width: 100%;
    height: auto;
}

/* Container for embedded content */
.article-body .video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    margin: 20px 0;
}

.article-body .video-wrapper iframe,
.article-body .video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .article-body {
        padding: 16px 16px;
        font-size: 15px;
    }

    .article-body h2 {
        font-size: 1.3rem;
    }

    .article-body h3 {
        font-size: 1.1rem;
    }

    .article-body blockquote {
        padding: 12px 16px;
        margin: 18px 0;
    }

    .article-body ul,
    .article-body ol {
        padding-left: 20px;
    }
}

@media (max-width: 480px) {
    .article-body {
        padding: 12px 12px;
        font-size: 14px;
    }

    .article-body h2 {
        font-size: 1.1rem;
    }

    .article-body h3 {
        font-size: 1rem;
    }

    .article-body blockquote {
        padding: 10px 14px;
        margin: 14px 0;
    }

    .article-body ul,
    .article-body ol {
        padding-left: 18px;
    }

    .article-body pre {
        padding: 12px 14px;
        font-size: 12px;
    }

    .article-body code {
        font-size: 0.85em;
    }
}

/* //////////////////////////////////////////////////
   TAGS
   ////////////////////////////////////////////////// */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.tag-link {
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--sidebar-hover);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tag-link:hover {
    background: var(--primary);
    color: #fff;
}

/* //////////////////////////////////////////////////
   SHARE BUTTONS
   ////////////////////////////////////////////////// */
.article-share {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.article-share span {
    align-self: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.share-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(var(--primary-rgb, 34, 197, 94), 0.05);
}

.share-buttons-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

/* //////////////////////////////////////////////////
   POST NAVIGATION (Prev / Next)
   ////////////////////////////////////////////////// */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.post-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.2s ease;
    min-width: 0;
}

.post-nav-link:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.post-nav-link.prev {
    grid-column: 1;
}

.post-nav-link.next {
    grid-column: 2;
    text-align: right;
    flex-direction: row-reverse;
}

.post-nav-link.placeholder {
    opacity: 0.4;
    pointer-events: none;
}

.post-nav-icon {
    font-size: 22px;
    color: var(--primary);
    flex-shrink: 0;
}

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

.post-nav-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.post-nav-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: normal; /* 👈 This is the key change */
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: block;
    line-height: 1.4; /* Add some breathing room */
}

/* Mobile Responsive - Optional but keeps it clean */
@media (max-width: 768px) {
    .post-navigation {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .post-nav-link.next {
        grid-column: 1;
        flex-direction: row;
        text-align: left;
    }

    .post-nav-link.next .post-nav-icon {
        order: 0;
    }
}

@media (max-width: 480px) {
    .post-nav-link {
        padding: 12px 14px;
        gap: 10px;
    }

    .post-nav-title {
        font-size: 13px;
    }

    .post-nav-icon {
        font-size: 18px;
    }

    .post-nav-label {
        font-size: 10px;
    }
}

/* //////////////////////////////////////////////////
   COMMENTS SECTION (Coming Soon)
   ////////////////////////////////////////////////// */
.comments-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 2px solid var(--border);
}

.comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.comments-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.comments-count {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--sidebar-hover);
    padding: 4px 12px;
    border-radius: 20px;
}

.comments-coming-soon {
    text-align: center;
    padding: 48px 24px;
    border-radius: 16px;
    background: var(--sidebar-hover);
    border: 2px dashed var(--border);
}

.comments-coming-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: var(--primary);
}

.comments-coming-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.comments-coming-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto 20px;
}

.comments-features {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.comments-feature {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.comments-feature i {
    color: var(--primary);
    font-size: 14px;
}

/* //////////////////////////////////////////////////
   RELATED POSTS (Inside main content)
   ////////////////////////////////////////////////// */
.related-posts {
    margin-top: 48px;
}

.related-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    letter-spacing: -0.3px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.related-card {
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.2s ease;
}

.related-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.related-card-image {
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.related-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.related-card:hover .related-card-image img {
    transform: scale(1.04);
}

.related-card-body {
    padding: 14px 16px;
}

.related-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-card-date {
    font-size: 11px;
    color: var(--text-muted);
}

/* //////////////////////////////////////////////////
   SIDEBAR (Desktop)
   ////////////////////////////////////////////////// */
.blog-sidebar {
    position: sticky;
    top: 120px;
}

.sidebar-widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.sidebar-widget-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    letter-spacing: -0.2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-widget-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* About Author Widget */
.author-widget {
    text-align: center;
}

.author-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}

.author-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.author-role {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.author-bio {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Recent Posts Widget */
.recent-post-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.2s ease;
}

.recent-post-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.recent-post-item:hover {
    padding-left: 4px;
}

.recent-post-thumb {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--sidebar-hover);
}

.recent-post-info {
    min-width: 0;
}

.recent-post-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recent-post-date {
    font-size: 11px;
    color: var(--text-muted);
}

/* Newsletter Widget */
.newsletter-widget {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
}

.newsletter-widget .sidebar-widget-title {
    color: #fff;
}

.newsletter-widget .sidebar-widget-title::after {
    background: rgba(255, 255, 255, 0.2);
}

.newsletter-desc {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 14px;
    line-height: 1.5;
}

.newsletter-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    margin-bottom: 8px;
    font-family: inherit;
    box-sizing: border-box;
    max-width: 100%;
}

.newsletter-form input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.newsletter-form input:focus {
    outline: none;
    border-color: #fff;
}

.newsletter-form button {
    width: 100%;
    padding: 10px;
    background: #fff;
    color: var(--primary);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    /* Ensure padding is included in width calculation */
}

.newsletter-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* //////////////////////////////////////////////////
   RESPONSIVE — Sidebar stacks below on mobile
   ////////////////////////////////////////////////// */
@media (max-width: 991px) {
    .blog-detail-wrapper {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .blog-sidebar {
        position: static;
        top: auto;
    }

    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }

}

@media (max-width: 768px) {
    .blog-detail-wrapper {
        padding: 24px 16px 40px;
    }

    .post-navigation {
        grid-template-columns: 1fr;
    }

    .post-nav-link.next {
        grid-column: 1;
    }
}

@media (max-width: 480px) {
    .article-body {
        font-size: 15px;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .article-share {
        flex-wrap: wrap;
    }

    .comments-features {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
}

@media (min-width: 992px) {
    .blog-widget {
        display: none;
    }
}

/* Random Posts Section */
.random-posts {
    padding: 2rem 0;
}

.random-posts-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text);
    letter-spacing: -0.01em;
}

.random-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.random-post-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.random-post-card:hover {
    background: var(--bg);
    border-color: var(--text-muted);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.random-post-icon {
    font-size: 1.25rem;
    opacity: 0.7;
    flex-shrink: 0;
}

.random-post-title {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.random-post-arrow {
    font-size: 1rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.random-post-card:hover .random-post-arrow {
    transform: translateX(4px);
    color: var(--text);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .random-posts-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .random-post-card {
        padding: 0.875rem 1rem;
    }
}

.random-icon {
    flex-shrink: 0;
    color: var(--primary);
}


/* Site Links Section */
.site-links {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.site-links-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
    letter-spacing: -0.01em;
}

.site-links-list {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.site-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.site-link svg {
    color: var(--text-muted);
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.site-link:hover {
    background: var(--bg);
    border-color: var(--text-muted);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    color: var(--primary);
}

.site-link:hover svg {
    color: var(--primary);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .site-links-list {
        flex-direction: column;
        align-items: center;
    }
    
    .site-link {
        max-width: 280px;
        justify-content: center;
    }
}