body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}
#header {
    background-color: #f8f9fa;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
}
#user-links {
    text-align: right;
}
#user-links a {
    margin-left: 10px;
    text-decoration: none;
    color: #0645ad;
}
#search-bar {
    flex-grow: 1;
    max-width: 500px;
    margin: 0 20px;
}
#search-bar form {
    display: flex;
}
#search-bar input[type="text"] {
    flex-grow: 1;
    padding: 5px 10px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
}
#search-bar input[type="submit"] {
    padding: 5px 15px;
    font-size: 16px;
    background-color: #0645ad;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}
#main-wrapper {
    display: flex;
    flex-grow: 1;
}
#sidebar {
    width: 250px;
    min-width: 250px;
    background-color: #f8f9fa;
    padding: 20px;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}
#sidebar-toggle {
    display: none;
}
#content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
}
.markdown-content img {
    max-width: 300px;
    max-height: 300px;
    object-fit: contain;
    cursor: pointer;
}
sup {
    vertical-align: super;
    font-size: smaller;
}
ol {
    padding-left: 20px;
}
#new-page-form {
    margin-top: 10px;
}
.reference-list {
    margin-top: 20px;
    padding-left: 20px;
}
.reference-list li {
    margin-bottom: 5px;
}
.breadcrumbs {
    margin-bottom: 20px;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}
.breadcrumbs a {
    text-decoration: none;
    color: #0645ad;
}
.breadcrumbs a:hover {
    text-decoration: underline;
}
.nav-item {
    margin-bottom: 5px;
}
.nav-item a {
    text-decoration: none;
    color: #333;
}
.nav-item a:hover {
    text-decoration: underline;
}
.edit-history {
    font-size: 0.8em;
    color: #666;
}
.edit-history h2 {
    font-size: 1.2em;
    margin-bottom: 5px;
}
.edit-history ul {
    margin-top: 0;
}
#edit-form {
    display: none;
}
.edit-link {
    font-size: 0.9em;
    margin-left: 10px;
}
.toggle-button {
    font-size: 0.8em;
    margin-left: 10px;
    cursor: pointer;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 2px 5px;
}
.toggle-button:hover {
    background-color: #e0e0e0;
}
#history-content {
    display: none;
}

/* New styles for collapsible navigation */
.nav-item .nav-toggle {
    position: relative;
    width: 20px;
    height: 20px;
    display: inline-block;
    background-color: #f0f0f0; /* Temporary background for visibility */
}

.nav-item .nav-toggle::before {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    transition: transform 0.3s ease;
    font-size: 16px; /* Adjust as needed */
}

.nav-item .nav-toggle.open::before {
    transform: translate(-50%, -50%) rotate(90deg);
}

.nav-toggle {
    display: inline-block;
    transition: transform 0.3s ease;
    transform: rotate(var(--rotation, 0deg));
}

.nav-children {
    display: none;
    margin-left: 15px;
}
.nav-children.open {
    display: block;
}

@media (max-width: 768px) {
    #header {
        flex-direction: column;
        align-items: stretch;
    }
    #user-links {
        text-align: center;
        margin-bottom: 10px;
    }
    #search-bar {
        max-width: none;
        margin: 10px 0;
    }
    #main-wrapper {
        flex-direction: column;
    }
    #sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ddd;
        display: none;
    }
    #sidebar.active {
        display: block;
    }
    #sidebar-toggle {
        display: block;
        background-color: #333;
        color: white;
        border: none;
        padding: 10px;
        width: 100%;
        text-align: left;
        cursor: pointer;
    }
}

.nav-item a.current-page {
    font-weight: bold;
    color: #007bff;
}

#preview-area {
    margin-top: 20px;
    border: 1px solid #ddd;
    padding: 20px;
    background-color: #f9f9f9;
}

#preview-content {
    max-width: 100%;
    overflow-wrap: break-word;
}

#preview-content img {
    max-width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
}

.table-of-contents {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.table-of-contents h2 {
    margin-top: 0;
}

.table-of-contents ul {
    list-style-type: none;
    padding-left: 20px;
}

.table-of-contents ul ul {
    padding-left: 15px;
}

.table-of-contents a {
    text-decoration: none;
    color: #0645ad;
}

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

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 100%;
}

.modal-content h2 {
    margin-top: 0;
}

.modal-content input[type="text"] {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
}

.modal-buttons input[type="submit"],
.modal-buttons button {
    margin-left: 10px;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.modal-buttons input[type="submit"] {
    background-color: #007bff;
    color: #fff;
}

.modal-buttons button {
    background-color: #f0f0f0;
}


/* Styles from search.php */
.search-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}
.search-form {
    margin-bottom: 20px;
}
.search-form input[type="text"] {
    width: 70%;
    padding: 10px;
    font-size: 16px;
}
.search-form input[type="submit"] {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
}
.search-results {
    list-style-type: none;
    padding: 0;
}
.search-result-item {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}
.search-result-title {
    font-size: 18px;
    margin-bottom: 10px;
}
.search-result-title a {
    color: #1a0dab;
    text-decoration: none;
}
.search-result-title a:hover {
    text-decoration: underline;
}
.search-result-snippet {
    color: #545454;
    font-size: 14px;
}
.no-results {
    color: #545454;
    font-style: italic;
}

/* Styles from admin_activity.php */
.activity-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.activity-table th, .activity-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}
.activity-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}
.activity-table tr:nth-child(even) {
    background-color: #f9f9f9;
}
.activity-table tr:hover {
    background-color: #f5f5f5;
}
.pagination {
    margin-top: 20px;
    text-align: center;
}
.pagination a {
    color: black;
    padding: 8px 16px;
    text-decoration: none;
    transition: background-color .3s;
    border: 1px solid #ddd;
    margin: 0 4px;
}
.pagination a.active {
    background-color: #4CAF50;
    color: white;
    border: 1px solid #4CAF50;
}
.pagination a:hover:not(.active) {
    background-color: #ddd;
}

/* Add these styles to the end of your main.css file */

.admin-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-overview {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

.stat-box {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    text-align: center;
    width: 23%;
}

.stat-box h3 {
    margin-top: 0;
    font-size: 16px;
    color: #333;
}

.stat-box p {
    font-size: 24px;
    font-weight: bold;
    margin: 10px 0 0;
    color: #007bff;
}

.recent-activity, .user-roles-chart {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 30px;
}

.recent-activity h2, .user-roles-chart h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.recent-activity table {
    width: 100%;
    border-collapse: collapse;
}

.recent-activity th, .recent-activity td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.recent-activity th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.recent-activity tr:nth-child(even) {
    background-color: #f9f9f9;
}

.view-all-btn {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 15px;
    background-color: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.view-all-btn:hover {
    background-color: #0056b3;
}

#userRolesChart {
    max-width: 400px;
    margin: 0 auto;
}

/* Admin Dashboard Styles */
header {
    background-color: #333;
    color: #fff;
    padding: 1rem;
    text-align: center;
}

header h1 {
    margin: 0;
}

header nav ul {
    padding: 0;
    list-style-type: none;
    margin-top: 1rem;
}

header nav ul li {
    display: inline;
    margin-right: 10px;
}

header nav ul li a {
    color: #fff;
    text-decoration: none;
}

main {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Pagination Styles */
.pagination {
    text-align: center;
    margin-top: 20px;
}

.pagination a {
    display: inline-block;
    padding: 8px 16px;
    margin: 0 4px;
    border: 1px solid #ddd;
    color: #007bff;
    text-decoration: none;
    transition: background-color 0.3s;
}

.pagination a.active {
    background-color: #007bff;
    color: white;
    border: 1px solid #007bff;
}

.pagination a:hover:not(.active) {
    background-color: #ddd;
}

.highlight {
    background-color: yellow;
    font-weight: inherit;
    color: inherit;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 5px;
}

.form-actions {
    margin-top: 20px;
}

.form-actions input[type="button"],
.form-actions input[type="submit"] {
    margin-right: 10px;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
}