/* General HTML and Body styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #f4f4f4;
    color: #333;
    text-align: left;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Base container for content, used in both admin and public where applicable */
.container {
    max-width: 800px;
    margin: 20px auto;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    box-sizing: border-box;
    text-align: left;
    color: #333;
}

/* Headings styles (common) */
h1, h2, h3, h4, h5, h6 {
    color: #003366;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

/* Header links (admin) - these styles are now for links within AdminLTE header,
   or if you decide to use .header-links in public later, they'd apply. */
.header-links {
    margin-bottom: 20px;
}

.header-links a {
    color: #004085;
    margin-right: 15px;
    text-decoration: none;
    font-weight: bold;
}

.header-links a:hover {
    text-decoration: underline;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-family: 'Segoe UI', sans-serif;
    color: #444;
}

.breadcrumb a {
    color: #004085;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    text-decoration: underline;
    color: #002752;
}

/* Gaya separator: › atau ikon lain */
.breadcrumb-separator {
    color: #999;
    font-size: 1rem;
}

/* Untuk tajuk halaman semasa */
.breadcrumb .current-page {
    font-weight: 600;
    color: #222;
}


/* Combined styling for category links in post-categories and general category links */
.post-categories a,
.post-category {
    color: #004085;
    font-weight: bold;
    text-decoration: none;
    margin-right: 5px;
}

.post-categories a:hover,
.post-category:hover {
    text-decoration: underline;
}

/* NEW: Ensure post-category link color within post-meta-details is correct due to specificity */
.post-meta-details .post-category {
    color: #004085;
    font-weight: bold;
    text-decoration: none;
}

.post-meta-details .post-category:hover {
    text-decoration: underline;
}


/* Post content paragraph and image styles (common) */
.post p,
.single-post p {
    line-height: 1.6;
    word-wrap: break-word;
}

.ql-editor img,
.post-content-html img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px auto;
}

/* Table specific styles (common) */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table,
th,
td {
    border: 1px solid #ddd;
}

th,
td {
    padding: 10px;
    text-align: left;
}

th {
    background-color: #007bff;
    color: white;
}

th a {
    color: white;
    text-decoration: none;
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

th a:hover {
    text-decoration: underline;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

tr:hover {
    background-color: #e2e2e2;
}

.table-actions {
    white-space: nowrap;
}

.table-actions a {
    margin-right: 8px;
    text-decoration: none;
    color: #007bff;
}

.table-actions a.delete-link {
    color: #dc3545;
}

.table-actions a:hover {
    text-decoration: underline;
}

/* Post meta details (common) */
.post-meta-details {
    font-size: 0.9em;
    color: #444;
    margin-bottom: 5px;
}
.post-meta-details p {
    margin-bottom: 5px;
    line-height: 0.6;
}
/* Form styles (common) */
form {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #e9e9e9;
}

form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form select {
    width: calc(100% - 22px);
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

form textarea {
    width: calc(100% - 22px);
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    box-sizing: border-box;
}

#editor-container {
    height: 250px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 10px;
}

form button {
    background-color: #28a745;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

form button:hover {
    background-color: #218838;
}

.error {
    color: red;
    font-weight: bold;
    margin-bottom: 10px;
}

.success {
    color: green;
    font-weight: bold;
    margin-bottom: 10px;
}

.back-link {
    display: block;
    margin-top: 20px;
    text-align: right;
}

a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.category-checkboxes label {
    display: block;
    margin-bottom: 5px;
}

.category-checkboxes input[type="checkbox"],
.category-checkboxes input[type="radio"] {
    margin-right: 5px;
}

/* Styles for character counters */
.char-count {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
    text-align: right;
    padding-right: 2px;
}

.char-count span {
    color: inherit;
}

.char-count span.error-count {
    color: red;
    font-weight: bold;
}

.char-count span.success-count {
    color: green;
    font-weight: bold;
}

textarea#meta_description {
    padding: 8px 10px;
    height: auto;
    min-height: 38px;
}

/* Callout style (common, as used on dashboard home) */
.callout {
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 5px solid #eee;
    border-radius: .25rem;
}
.callout-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}
.callout h5 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}
.callout p:last-child {
    margin-bottom: 0;
}

/* Public Blog Layout specific styles */
.public-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

.public-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.public-header {
    background-color: #951a1fff;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    position: relative;
    overflow-x: hidden;
}

.public-header .header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 15px 20px; 
}

.public-header .logo a {
    color: #fff;
    font-size: 1em;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
}

/* NEW: Style for the header logo image */
.public-header .logo .header-logo {
    height: 40px; /* Set the desired height */
    width: auto; /* Maintain aspect ratio */
    max-width: 100%; /* Ensure it's responsive */
}


.public-header .public-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

.public-header .public-nav li {
    margin-left: 20px;
}

.public-header .public-nav a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 0;
    transition: color 0.3s ease;
}

.public-header .public-nav a:hover {
    color: #ebae14;
}

/* Mobile Toggle Button (Burger Menu) */
.menu-toggle-button {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 100;
}

.menu-toggle-button .bar {
    width: 100%;
    height: 3px;
    background-color: #fff;
    border-radius: 5px;
    transition: all 0.3s ease-in-out;
}

/* MAIN PUBLIC CONTENT CONTAINER */
.public-main-content {
    flex-grow: 1;
    /* Kita akan mengelola lebar dengan .public-container di dalamnya */
    padding: 20px 0; /* Biarkan padding vertikal di sini jika diinginkan */
    position: relative;
}

/* NEW: Specific styles for public content container */
.public-container {
    max-width: 800px; /* Lebar maksimum yang sama dengan footer */
    margin: 20px auto; /* Pusat kontainer */
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    box-sizing: border-box;
    text-align: left;
    color: #333;
}


/* The original .container is still used in admin_layout and other places.
   No changes needed to the original .container definition. */

/* NEW: Table of Contents Sidebar styles (using position: fixed) */
.toc-sidebar {
    width: 200px;
    background-color: #fff;
    border-radius: 8px;
    padding: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    
    position: fixed;
    top: 116px;
    right: 222px;
    z-index: 1000;
    height: fit-content;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    font-size: 0.9em;
    
    
}

.toc-sidebar .toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 5px;
    padding-left: 9px;
}
.toc-sidebar h3 {
    margin: 0;
    font-size: 1.1em;
    color: #003366;
}
.toc-toggle-button {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 25px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}
.toc-toggle-button .bar {
    width: 100%;
    height: 3px;
    background-color: #333;
    border-radius: 5px;
    transition: all 0.3s ease-in-out;
}
/* Burger icon animation for toggle */
.toc-toggle-button.active .bar:nth-child(1) { transform: rotate(-45deg) translate(-5px, 6px); }
.toc-toggle-button.active .bar:nth-child(2) { opacity: 0; }
.toc-toggle-button.active .bar:nth-child(3) { transform: rotate(45deg) translate(-5px, -6px); }

#toc-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#toc-nav li {
    margin-bottom: 5px;
}

#toc-nav a {
    display: block;
    color: #333;
    text-decoration: none;
    border-radius: 3px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

#toc-nav a:hover {
    background-color: #f0f0f0;
    color: #007bff;
}

/* ToC Level indentation */
.toc-level-2 a {
    padding-left: 10px;
}
.toc-level-3 a {
    padding-left: 25px;
    font-size: 0.95em;
}

/* Active state for ToC links */
#toc-nav a.active {
    background-color: #007bff;
    color: #fff;
    font-weight: bold;
}


/* Responsive adjustments for header (Mobile First) */
@media (max-width: 768px) {
    .public-header .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .public-header .logo {
        margin-bottom: 0;
    }

    .menu-toggle-button {
        display: flex; /* Show burger button on mobile */
    }

 .public-header .public-nav {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        display: none; /* Kekal none, JS akan menukar kepada flex bila aktif */
        flex-direction: column;
        background-color: #444;
        box-shadow: 0 5px 5px rgba(0,0,0,0.2);
        z-index: 99;
        overflow-x: hidden;
        box-sizing: border-box; 
    }
    .public-header .public-nav.active {
        display: flex !important; /* Mula-mula, gunakan !important untuk menguji sama ada ini mengatasi masalah */
      
    }

    .public-header .public-nav ul {
        flex-direction: column;
        width: 100%;
        padding: 10px 0;
        box-sizing: border-box;
    }

    .public-header .public-nav li {
        margin-left: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        box-sizing: border-box;
        width: 100%;
    }

    .public-header .public-nav li:last-child {
        border-bottom: none;
    }

    .public-header .public-nav a {
        padding: 10px 0px 0px 30px; 
        display: block;
        width: 100%;
        white-space: normal;
        box-sizing: border-box;
    }

    /* .container in media query for public pages should now be .public-container */
    .public-container { /* Ganti .container dengan .public-container di sini */
        margin: 10px auto;
        padding: 15px;
    }
}

@media (max-width: 992px) {
    .toc-sidebar {
        position: static;
        top: auto; right: auto;
        width: 100%;
        margin-top: 20px;
        box-shadow: none;
        border-top: 1px solid #ddd;
        border-bottom: none; border-left: none; border-right: none;
        border-radius: 0;
        padding-top: 15px; padding-bottom: 15px;
    }
    .toc-header {
        cursor: pointer;
        border-bottom: none;
    }
    .toc-content {
        display: none;
    }
    .toc-content.active {
        display: block;
    }
}

/* Hide AdminLTE body margin on public pages */
.public-layout.sidebar-mini {
    margin: 0 !important;
}