/* Mobile Article Content Fix - Mengatasi masalah teks melebar dan terpotong */

/* Override untuk semua elemen artikel agar tidak melebar */
.article-content {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
}

/* Semua elemen di dalam artikel content */
.article-content * {
    max-width: 100% !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Khusus untuk pre dan code blocks yang sering menyebabkan overflow */
.article-content pre {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: pre !important;
    box-sizing: border-box !important;
    margin: 1rem 0 !important;
    padding: 1rem !important;
    border-radius: 0.5rem !important;
    font-size: 0.875rem !important;
    line-height: 1.5 !important;
}

.article-content code {
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-break: break-all !important;
    white-space: pre-wrap !important;
    font-size: 0.875rem !important;
}

/* Inline code tidak boleh membuat horizontal scroll */
.article-content p code {
    white-space: normal !important;
    word-break: break-all !important;
    overflow-wrap: break-word !important;
}

/* Paragraf dan teks */
.article-content p {
    width: 100% !important;
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    hyphens: auto !important;
    text-align: justify !important;
    margin: 1rem 0 !important;
    line-height: 1.6 !important;
}

/* Heading */
.article-content h1, 
.article-content h2, 
.article-content h3, 
.article-content h4, 
.article-content h5, 
.article-content h6 {
    width: 100% !important;
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    hyphens: auto !important;
    line-height: 1.3 !important;
    margin: 1.5rem 0 1rem 0 !important;
}

/* Lists */
.article-content ul, 
.article-content ol {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 1.5rem !important;
    margin: 1rem 0 !important;
}

.article-content li {
    width: 100% !important;
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    margin: 0.5rem 0 !important;
    line-height: 1.5 !important;
}

/* Tables - responsif */
.article-content table {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    display: block !important;
    white-space: nowrap !important;
    border-collapse: collapse !important;
    margin: 1rem 0 !important;
}

.article-content table thead,
.article-content table tbody,
.article-content table tr {
    display: table !important;
    width: 100% !important;
    table-layout: fixed !important;
}

.article-content table th,
.article-content table td {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 200px !important;
    padding: 0.5rem !important;
    border: 1px solid #e5e7eb !important;
}

/* Images */
.article-content img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
    border-radius: 0.5rem !important;
    margin: 1rem 0 !important;
}

/* Blockquotes */
.article-content blockquote {
    width: 100% !important;
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    margin: 1rem 0 !important;
    padding: 1rem !important;
    border-left: 4px solid #2dd4bf !important;
    background-color: #f0fdfa !important;
    border-radius: 0 0.5rem 0.5rem 0 !important;
}

.dark .article-content blockquote {
    background-color: #0f2027 !important;
    color: #9ca3af !important;
}

/* Figures */
.article-content figure {
    width: 100% !important;
    max-width: 100% !important;
    margin: 1rem 0 !important;
    text-align: center !important;
}

.article-content figcaption {
    width: 100% !important;
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    font-size: 0.875rem !important;
    color: #6b7280 !important;
    margin-top: 0.5rem !important;
    padding: 0 1rem !important;
}

/* Container khusus untuk mobile */
@media (max-width: 768px) {
    .article-content {
        padding: 0 1rem !important;
        margin: 0 !important;
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }
    
    .article-content h1 {
        font-size: 1.875rem !important;
        line-height: 1.2 !important;
    }
    
    .article-content h2 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }
    
    .article-content h3 {
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
    }
    
    .article-content h4 {
        font-size: 1.125rem !important;
        line-height: 1.3 !important;
    }
    
    .article-content pre {
        font-size: 0.8rem !important;
        padding: 0.75rem !important;
        margin: 0.75rem 0 !important;
        overflow-x: auto !important;
        border-radius: 0.375rem !important;
    }
    
    .article-content blockquote {
        margin: 1rem 0 !important;
        padding: 0.75rem !important;
        font-size: 0.9rem !important;
    }
    
    .article-content ul, 
    .article-content ol {
        padding-left: 1.25rem !important;
    }
}

/* Sangat khusus untuk mobile kecil */
@media (max-width: 480px) {
    .article-content {
        padding: 0 0.75rem !important;
        font-size: 0.9rem !important;
    }
    
    .article-content h1 {
        font-size: 1.75rem !important;
    }
    
    .article-content h2 {
        font-size: 1.375rem !important;
    }
    
    .article-content h3 {
        font-size: 1.125rem !important;
    }
    
    .article-content pre {
        font-size: 0.75rem !important;
        padding: 0.5rem !important;
        margin: 0.5rem 0 !important;
    }
    
    .article-content code {
        font-size: 0.8rem !important;
        padding: 0.125rem 0.25rem !important;
    }
}

/* Fix untuk prose class jika menggunakan Tailwind Typography */
.prose {
    max-width: 100% !important;
}

.prose pre {
    overflow-x: auto !important;
    white-space: pre !important;
}

.prose code {
    white-space: pre-wrap !important;
    word-break: break-all !important;
}

/* Khusus untuk grid layout di artikel */
.article-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    width: 100% !important;
    max-width: 100% !important;
}

@media (min-width: 768px) {
    .article-grid {
        grid-template-columns: 1fr 300px !important;
        gap: 2rem !important;
    }
}

/* Container utama artikel */
.blog-article-container {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 1rem !important;
    box-sizing: border-box !important;
}

@media (min-width: 768px) {
    .blog-article-container {
        padding: 0 2rem !important;
    }
}

/* Prevent horizontal scroll pada body */
body {
    overflow-x: hidden !important;
}

/* Khusus untuk mobile Android yang sering bermasalah */
@media screen and (max-width: 768px) and (orientation: portrait) {
    .article-content {
        width: calc(100vw - 2rem) !important;
        max-width: calc(100vw - 2rem) !important;
        margin: 0 auto !important;
        padding: 0 1rem !important;
    }
    
    .article-content * {
        max-width: 100% !important;
        width: auto !important;
    }
    
    .article-content pre {
        width: calc(100vw - 4rem) !important;
        max-width: calc(100vw - 4rem) !important;
        overflow-x: auto !important;
    }
}

/* Fix untuk landscape mode di mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .article-content {
        width: calc(100vw - 3rem) !important;
        max-width: calc(100vw - 3rem) !important;
        padding: 0 1.5rem !important;
    }
}

/* Debugging helper - dapat dihapus setelah testing */
/* 
.article-content * {
    border: 1px solid rgba(255, 0, 0, 0.1) !important;
}
*/

/* ========================================
   FOOTER SPACING OPTIMIZATION
   ======================================== */

/* Optimized footer spacing for blog articles */
.blog-article-footer-spacing {
    margin-top: 3rem !important; /* 48px instead of 96px */
}

/* Responsive footer padding optimization */
footer .blog-article-container {
    padding-top: 3rem !important; /* 48px instead of 80px */
    padding-bottom: 3rem !important; /* 48px instead of 80px */
}

/* Mobile optimization for footer */
@media (max-width: 768px) {
    .blog-article-footer-spacing {
        margin-top: 2rem !important; /* 32px on mobile */
    }
    
    footer .blog-article-container {
        padding-top: 2rem !important; /* 32px on mobile */
        padding-bottom: 2rem !important; /* 32px on mobile */
    }
}

/* Tablet optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    .blog-article-footer-spacing {
        margin-top: 2.5rem !important; /* 40px on tablet */
    }
    
    footer .blog-article-container {
        padding-top: 2.5rem !important; /* 40px on tablet */
        padding-bottom: 2.5rem !important; /* 40px on tablet */
    }
}

/* Ensure smooth transition between content and footer */
footer {
    transition: all 0.3s ease !important;
}

/* Better visual separation without excessive spacing */
footer::before {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(75, 85, 99, 0.3), transparent);
    margin-bottom: 1rem;
}
