/* --- Variabel Warna & Reset Dasar --- */
:root {
    --blue-light: #4e95ff;
    --blue-dark: #0d6efd;
    --text-dark: #343a40;
    --text-light: #f8f9fa;
    --bg-light: #f8f9fa;
    --border-color: #dee2e6;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body { 
    font-family: 'Poppins', sans-serif; 
    background-color: var(--bg-light); 
    color: var(--text-dark); 
    line-height: 1.8;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 20px;
    margin-top: 30px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

h1:first-child, h2:first-child, h3:first-child, 
h4:first-child, h5:first-child, h6:first-child {
    margin-top: 0;
}

p {
    margin-bottom: 20px;
    line-height: 1.8;
    text-align: justify;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-line;
}

p:last-child {
    margin-bottom: 0;
}

.preserve-breaks {
    white-space: pre-line;
}

.preserve-all {
    white-space: pre-wrap;
}

.break-words {
    word-break: break-word;
    overflow-wrap: break-word;
}

.break-all {
    word-break: break-all;
}

ul, ol {
    margin-bottom: 20px;
    padding-left: 30px;
}

ul li, ol li {
    margin-bottom: 8px;
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

blockquote {
    margin: 25px 0;
    padding: 20px;
    border-left: 4px solid var(--blue-dark);
    background-color: var(--bg-light);
    font-style: italic;
    line-height: 1.8;
    white-space: pre-line;
    word-wrap: break-word;
}

.content-area {
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.content-area p {
    margin-bottom: 20px;
    line-height: 1.8;
}

.content-area br {
    line-height: 2.5;
}

header {
    background: linear-gradient(90deg, var(--blue-light), var(--blue-dark));
    color: white;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

header nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

header nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

header nav a.active {
    background-color: white;
    color: var(--blue-dark);
    font-weight: 500;
}

/* --- Hero Section (Slider) --- */
.hero {
    position: relative;
    height: 500px;
    width: 100%;
    overflow: hidden;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    opacity: 0;
    animation: fadeEffect 18s infinite;
    transition: opacity 1.5s ease-in-out;
}

.hero-slide:nth-child(1) { animation-delay: 0s; }
.hero-slide:nth-child(2) { animation-delay: 6s; }
.hero-slide:nth-child(3) { animation-delay: 12s; }
.hero-slide:nth-child(4) { animation-delay: 18s; } 
.hero-slide:nth-child(5) { animation-delay: 24s; }

@keyframes fadeEffect {
  0% { opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

.hero-overlay {
    position: relative;
    z-index: 2;
    background: rgba(0, 0, 0, 0.4);
    padding: 40px;
    border-radius: 10px;
}

.hero h1 {
    font-size: 48px;
    margin-bottom: 15px; /* Spacing yang lebih baik */
    margin-top: 0;
    white-space: pre-line; /* Support line break di hero title */
}

.hero p {
    font-size: 18px;
    max-width: 600px;
    margin: 0 auto 30px auto;
    opacity: 0.9;
    line-height: 1.6;
    white-space: pre-line; /* Support line break di hero description */
}

/* --- Main Content --- */
.page-section {
    padding: 80px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
    margin-top: 0;
    font-size: 32px;
    white-space: pre-line; /* Support line break di section title */
}

/* --- Kartu Statistik --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.stat-card {
    background: white;
    padding: 30px;
    text-align: center;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    font-size: 48px;
    color: var(--blue-dark);
    margin-bottom: 10px;
    margin-top: 0;
    white-space: pre-line;
}

.stat-card p {
    color: #6c757d;
    font-size: 16px;
    margin-bottom: 0;
    white-space: pre-line;
    line-height: 1.6;
}

/* --- Tombol (Button) --- */
.btn {
    display: inline-block;
    background: linear-gradient(90deg, var(--blue-light), var(--blue-dark));
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 500;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    margin: 10px 5px; /* Spacing untuk tombol */
    white-space: nowrap; /* Mencegah teks tombol terpecah */
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.btn.btn-secondary {
    background: #6c757d;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* --- Kartu Berita Terbaru --- */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.post-card {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
}

.post-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-card-content {
    padding: 25px;
}

.post-card-content h4 {
    margin-bottom: 15px;
    margin-top: 0;
    line-height: 1.4;
    word-wrap: break-word;
}

.post-card-content h4 a {
    text-decoration: none;
    color: var(--text-dark);
    font-size: 18px;
}

.post-card-content p {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 15px;
    line-height: 1.6;
    white-space: pre-line; /* Support line break di excerpt */
    word-wrap: break-word;
}

.post-card-content small {
    color: #adb5bd;
}

/* --- Footer --- */
footer {
    background-color: var(--text-dark);
    color: var(--text-light);
    text-align: center;
    padding: 40px 20px;
    margin-top: 50px;
}

/* --- Responsiveness --- */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 15px;
    }

    .hero h1 {
        font-size: 36px;
    }

    .hero p {
        font-size: 16px;
    }
    
    /* Spacing yang lebih kecil di mobile */
    h1, h2, h3, h4, h5, h6 {
        margin-bottom: 15px;
        margin-top: 25px;
    }
    
    p {
        margin-bottom: 15px;
    }
}

/* --- Halaman Header (untuk semua halaman internal) --- */
.page-header {
    padding: 60px 20px;
    background: var(--text-dark);
    color: white;
    text-align: center;
}

.page-header h1 {
    font-size: 40px;
    margin-bottom: 0;
    margin-top: 0;
    white-space: pre-line; /* Support line break di page title */
}

/* --- Layout Halaman Profil --- */
.profile-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.profile-sidebar {
    flex: 0 0 250px;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 15px;
    position: sticky;
    top: 100px;
}

.profile-sidebar ul {
    list-style: none;
    margin-bottom: 0;
    padding-left: 0;
}

.profile-sidebar li {
    margin-bottom: 5px;
}

.profile-sidebar li a {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-dark);
    border-radius: 8px;
    font-weight: 500;
    transition: background-color 0.3s, color 0.3s;
    word-wrap: break-word;
    white-space: pre-line;
}

.profile-sidebar li a:hover {
    background-color: var(--bg-light);
}

.profile-sidebar li a.active {
    background-color: var(--blue-dark);
    color: white;
}

.profile-content {
    flex: 1;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.profile-content h2 {
    margin-top: 0;
    font-size: 28px;
    color: var(--text-dark);
    border-bottom: 2px solid var(--blue-dark);
    padding-bottom: 10px;
    margin-bottom: 25px;
    white-space: pre-line;
}

.profile-content h3 {
    font-size: 22px;
    color: var(--text-dark);
    margin-top: 35px;
    margin-bottom: 15px;
    white-space: pre-line;
}

/* Support untuk konten profil */
.profile-content p,
.profile-content div,
.profile-content span {
    white-space: pre-line;
    word-wrap: break-word;
    line-height: 1.8;
}

/* --- Responsive untuk Halaman Profil --- */
@media (max-width: 992px) {
    .profile-layout {
        flex-direction: column;
    }
    .profile-sidebar {
        width: 100%;
        position: static;
    }
}

/* --- Halaman Detail Artikel --- */
.article-container {
    max-width: 800px;
    margin: 20px auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.article-container h1 {
    font-size: 32px;
    margin-bottom: 20px;
    margin-top: 0;
    color: var(--text-dark);
    white-space: pre-line;
    word-wrap: break-word;
}

.article-container h2 {
    font-size: 26px;
    margin-top: 40px;
    margin-bottom: 20px;
    color: var(--text-dark);
    white-space: pre-line;
}

.article-container h3 {
    font-size: 22px;
    margin-top: 35px;
    margin-bottom: 15px;
    color: var(--text-dark);
    white-space: pre-line;
}

.article-meta {
    text-align: center;
    margin-bottom: 30px;
    padding: 15px;
    background-color: var(--bg-light);
    border-radius: 8px;
    color: #6c757d;
    white-space: pre-line;
}

.article-image {
    width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 30px 0;
    box-shadow: var(--shadow);
}

.article-content {
    line-height: 1.8;
    font-size: 16px;
    white-space: pre-line; /* PENTING: Mempertahankan line break dari database */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Styling khusus untuk konten artikel */
.article-content p {
    margin-bottom: 25px;
    text-align: justify;
    white-space: pre-line; /* Mempertahankan line break */
    word-wrap: break-word;
}

.article-content ul, .article-content ol {
    margin: 25px 0;
    padding-left: 30px;
}

.article-content li {
    margin-bottom: 10px;
    line-height: 1.8;
    white-space: pre-line;
    word-wrap: break-word;
}

/* Support untuk konten yang diambil dari database/CMS */
.article-content div,
.article-content span {
    white-space: pre-line;
    word-wrap: break-word;
}

/* --- Halaman Formulir --- */
.form-wrapper {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.form-wrapper h4 {
    margin-top: 35px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    white-space: pre-line;
}

.form-wrapper h4:first-child {
    margin-top: 0;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-dark);
    white-space: pre-line;
    word-wrap: break-word;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="email"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
    line-height: 1.5;
    word-wrap: break-word;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
    white-space: pre-wrap; /* Mempertahankan formatting di textarea */
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: var(--blue-dark);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

/* --- Halaman Kontak --- */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
    align-items: flex-start;
}

.contact-info h4, .contact-form-wrapper h4 {
    font-size: 22px;
    margin-bottom: 20px;
    margin-top: 0;
    white-space: pre-line;
}

.contact-info p {
    margin-bottom: 15px;
    line-height: 1.7;
    white-space: pre-line;
    word-wrap: break-word;
}

.contact-info iframe {
    margin-top: 25px;
    border-radius: 10px;
}

/* --- Footer Modern --- */
footer {
    background-color: var(--text-dark);
    color: rgba(255, 255, 255, 0.7);
    padding: 60px 0 0 0;
    margin-top: 60px;
    font-size: 15px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    padding-bottom: 40px;
}

.footer-col h4 {
    color: white;
    font-size: 18px;
    margin-bottom: 20px;
    margin-top: 0;
    position: relative;
    padding-bottom: 10px;
    white-space: pre-line;
}

.footer-col h4::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 2px;
    background: var(--blue-dark);
}

.footer-col p {
    margin-bottom: 15px;
    line-height: 1.7;
    white-space: pre-line;
    word-wrap: break-word;
}

.footer-col ul {
    list-style: none;
    margin-bottom: 0;
    padding-left: 0;
}

.footer-col ul li {
    margin-bottom: 12px;
}

.footer-col ul li a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.3s, padding-left 0.3s;
    line-height: 1.6;
    white-space: pre-line;
    word-wrap: break-word;
}

.footer-col ul li a:hover {
    color: white;
    padding-left: 5px;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 0;
    text-align: center;
    font-size: 14px;
    white-space: pre-line;
}

/* --- UTILITY CLASSES UNTUK SPACING TAMBAHAN --- */
.spacing-sm { margin-bottom: 15px; }
.spacing-md { margin-bottom: 25px; }
.spacing-lg { margin-bottom: 35px; }
.spacing-xl { margin-bottom: 50px; }

.mt-sm { margin-top: 15px; }
.mt-md { margin-top: 25px; }
.mt-lg { margin-top: 35px; }
.mt-xl { margin-top: 50px; }

/* --- LINE BREAK UTILITY CLASSES --- */
.line-break { white-space: pre-line; }
.no-wrap { white-space: nowrap; }
.break-word { word-break: break-word; overflow-wrap: break-word; }
.break-all { word-break: break-all; }

/* --- PREFORMATTED TEXT SUPPORT --- */
pre {
    background-color: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 25px 0;
    border-left: 4px solid var(--blue-dark);
    line-height: 1.6;
    white-space: pre-wrap; /* Mempertahankan formatting */
    word-wrap: break-word;
}

code {
    background-color: var(--bg-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    white-space: pre-wrap;
}

/* --- TABLE STYLING --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.6;
    white-space: pre-line; /* Support line break di table */
    word-wrap: break-word;
}

table th {
    background-color: var(--blue-dark);
    color: white;
    font-weight: 600;
}

table tr:hover {
    background-color: var(--bg-light);
}

/* --- SUPPORT UNTUK KONTEN DINAMIS --- */
.dynamic-content {
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.8;
}

.dynamic-content p {
    margin-bottom: 20px;
}

.dynamic-content h1,
.dynamic-content h2,
.dynamic-content h3,
.dynamic-content h4,
.dynamic-content h5,
.dynamic-content h6 {
    margin-top: 30px;
    margin-bottom: 15px;
    white-space: pre-line;
}

.dynamic-content h1:first-child,
.dynamic-content h2:first-child,
.dynamic-content h3:first-child,
.dynamic-content h4:first-child,
.dynamic-content h5:first-child,
.dynamic-content h6:first-child {
    margin-top: 0;
}

/* --- SUPPORT UNTUK EDITOR WYSIWYG --- */
.wysiwyg-content {
    white-space: pre-line;
    word-wrap: break-word;
    line-height: 1.8;
}

.wysiwyg-content * {
    white-space: pre-line;
    word-wrap: break-word;
}

.wysiwyg-content p {
    margin-bottom: 20px;
}

.wysiwyg-content br {
    line-height: 2.5;
}