:root {
    --primary-color: #6c6c6c;
    --secondary-color: #f5f5f5;
    --text-color: #333;
    --sidebar-width: 250px;
    --border-radius: 5px;
    --golden-gradient: linear-gradient(135deg, #8c7851, #d4af37, #8c7851);
    --grey-gradient: linear-gradient(90deg, #484747, #7c7c7ca5, #303030);
    --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

body {
    font-family: var(--font-sans);
    margin: 0;
    padding: 0;
    display: flex;
    min-height: 100vh;
    color: var(--text-color);
    background-color: #f8f8f8;
    transition: background-color 0.3s, color 0.3s;
    position: relative;
    overflow: hidden;
}

body.dark-mode {
    --primary-color: #ba942b;
    --secondary-color: #4f4f4f;
    --text-color: #ecf0f1;
    background-color: #1a1b26;
}

body.dark-mode a {
    color: #ffa600d4;
}

body.dark-mode #DarkToggleButton {
    background-color: #f1c40f;
    color: black;
}

#DarkToggleButton {
    background-color: linear-gradient (#3e381e, #9a2121) ;
    color: white;
    margin-top: auto;
    transition: all 0.3s;
    border-radius: 12px;
    border: 2px solid rgb(186, 162, 9, 0.9); 

}

#DarkToggleButton.circle {
position: fixed;
left: 10px;
bottom: 15px;
width: 40px;
height: 40px;
border-radius: 50%;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
}

#sidebar {
    width: var(--sidebar-width);
    background: var(--golden-gradient);
    color: white;
    padding: 20px;
    box-sizing: border-box;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transition: width 0.3s;
    overflow: hidden;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

#sidebar.hidden {
    width: 0;
    padding: 0;
    overflow: hidden;
}

#content {
    padding: 24px;
    background-color: var(--secondary-color);
    overflow-y: auto;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    position: relative;
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    transition: padding 0.3s, margin-left 0.3s;
    text-align: left;
    line-height: 1.6;
    z-index: 1;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
}

#content.full-width {
    margin-left: var(--sidebar-width);
    width: 100%;
}

#sidebar.hidden ~ #content {
    margin-left: 36px;
    padding-left: 0;
    padding-right: 36px;
}

.frame-mode {
    border: 10px solid var(--golden-gradient);
    margin: 20px;
    transition: margin 0.3s, border 0.3s;
}

.frame-mode #content {
    margin: 36px auto;
    text-align: left;
    padding: 24px;
    max-width: 80%;
    max-height: calc(100vh - 100px); /* Subtract padding and border */
    overflow-y: auto;
}

.frame-mode #sidebar {
    display: none;
}


h1, h2, h3 {
    background: var(--golden-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 600;
}

.menu-item {
    padding: 10px;
    margin: 5px 0;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.menu-item:hover {
    background: var(--golden-gradient);
    color: rgb(78, 61, 14);
}

.menu-item.selected {
    border: 2px solid rgb(255, 255, 255);
    background: var(--golden-gradient);
    color: rgb(5, 5, 5);
}

.sub-menu {
    display: none;
    margin-left: 20px;
}

.sub-menu.expanded {
    display: block;
}

.sub-menu-item {
    padding: 8px;
    margin: 3px 0;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.sub-menu-item:hover {
    background: var(--golden-gradient);
    opacity: 0.8;
}

.sub-menu-item.selected {
    background: var(--golden-gradient);
    color: rgb(5, 5, 5);
}

.pages-menu {
    display: none;
    margin-left: 20px;
}

.pages-menu.expanded {
    display: block;
}

.page-item {
    padding: 6px;
    margin: 2px 0;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    font-size: 0.85em;
    color: #e0e0e0;
}

.page-item:hover {
    background: var(--golden-gradient);
    opacity: 0.7;
}

.page-item.selected {
    background: var(--golden-gradient);
    color: rgb(5, 5, 5);
}

button {
    background: var(--grey-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px 20px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    margin: 5px 0;
    font-family: var(--font-sans);
    font-weight: 500;
}

button:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

#loginModal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
}

.modal-content {
    background: var(--golden-gradient);
    margin: 15% auto;
    padding: 24px;
    border-radius: var(--border-radius);
    width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.close {
    color: #fff;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #f1c40f;
}

input[type="text"], input[type="password"] {
    width: 90%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: var(--font-sans);
}

#courseMenuButton {
    position: absolute;
    top: 15px;
    right: 10px;
    background: var(--golden-gradient);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.5s, transform 0.1s;
}

#courseMenuButton:hover {
    
    transform: scale(1.10);
}

#courseMenu {
    display: none;
    position: absolute;
    top: 60px;
    right: 10px;
    background: var(--golden-gradient);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 10px;
    z-index: 1000;
}

#courseMenu a {
    display: block;
    padding: 8px 12px;
    color: #3b3a32;
    text-decoration: none;
    transition: background-color 0.3s;
    border-radius: var(--border-radius);
    cursor: pointer;
}

#courseMenu a:hover {
    background: var(--golden-gradient);
    color: rgb(247, 247, 247);
}

#courseMenu .course-sub-menu {
    display: none;
    margin-left: 15px;
}

#courseMenu .course-sub-menu.expanded {
    display: block;
} 
#courseMenu .course-sub-item {
    font-size: 0.9em;
    padding: 6px 12px;
}

#courseMenu .course-sub-item:hover {
    background: var(--golden-gradient);
    color:white;
    opacity: 0.8;
}

#loginBtn {
    position: fixed;
    right: 10px;
    bottom: 15px;
    width: 40px;
    height: 40px;
    background: var(--grey-gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

#loginBtn:hover {
    background-color: #3e4389;
    transform: scale(1.05);
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.nav-button {
    padding: 4px 24px;
    background: var(--grey-gradient);
    color: rgb(0, 0, 0);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 28px;
    position: relative;
    z-index: 2;
}

.nav-button.prev-button {
    margin-right: 86px;
}

.nav-button.next-button {
    margin-left: 86px;
}

.navigation-row {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 360px;
    padding: 0 20px;
}

.page-buttons-group {
    display: flex;
    gap: 24px;

}

.nav-button:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pageButton {
    padding: 9px 14px;
    cursor: pointer;
    margin: auto auto;
    background: var(--grey-gradient);
    color: rgb(0, 0, 0);
    border: 1px solid transparent;
    border-radius: 50%;
    transition: all 0.3s ease;
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pageButton:hover {
    filter: brightness(1.1);
    background: linear-gradient(-45deg, #484747, #7c7c7ca5, #303030);
    transform: translateY(-3px);
    cursor: pointer;
}

.pageButton.active {
    transform: translateY(-5px);
    background: var(--golden-gradient);
    color: rgb(7, 7, 7);
    border-color: rgba(0,0,0,0.2);
}

#pageButtonsContainer {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    padding: 10px;
}

.page-indicator {
    padding: 5px 10px;
    color: rgba(0, 0, 0, 0.6);
    font-size: 0.85em;
    text-align: right;
    user-select: none;
    position: absolute;
    top: 20px;
    right: 20px;
}

.status-indicators {
    position: absolute;
    top: 20px;
    right: calc(20px + 150px);
    display: flex;
    gap: 10px;
    align-items: center;
}

.status-indicator {
    width: 24px;
    height: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.status-indicator.visible {
    opacity: 1;
}

.update-status-container {
    position: absolute;
    top: 20px;
    right: calc(20px + 150px); /* position left of page-indicator */
    display: flex;
    gap: 10px;
    height: 24px;
    align-items: center;
}

.update-status-item {
    width: 24px;
    height: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.update-status-item.visible {
    opacity: 1;
}

.update-status-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.current-page-title {
    text-align: center;
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 1.1em;
    opacity: 0.8;
}

/* Image resizing styles */
#content img {
max-width: 100%;
height: auto;
display: block;
margin: 10px auto;
cursor: pointer;
}

#content img.resizable {
resize: both;
overflow: auto;
border: 1px solid #ddd;
max-width: 100%;
}

/* Table styles */
#content table {
width: 100%;
border-collapse: collapse;
margin: 10px 0;
}

#content th, #content td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}

/* Video styles */
#content video {
max-width: 100%;
height: auto;
display: block;
margin: 10px auto;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
#sidebar {
    width: 100%;
    height: auto;
    position: relative;
}

#content {
    width: 100%;
    margin-left: 0;
    padding: 10px;
}

.frame-mode #content {
    margin: 0;
    max-width: 100%;
}

#courseMenuButton {
    top: 10px;
    right: 10px;
}

#courseMenu {
    width: 100%;
    top: 60px;
    right: 0;
}

#loginBtn, #DarkToggleButton {
    bottom: 10px;
}

#pageButtonsContainer {
    bottom: 60px;
}
}








/* Quiz Container */
.quiz-container {
    order: -1;
    width: 100%;
    max-width: inherit;  /* Inherits max-width from parent (#content) */
    background: var(--secondary-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 0 0 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s, color 0.3s;
}

/* Quiz Header */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.quiz-header h3 {
    margin: 0;
    color: var(--text-color);
}

.quiz-status {
    background: var(--golden-gradient);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: var(--border-radius);
    margin: 5px 0;
    font-size: 0.9em;
    border: 1px solid var(--primary-color);
}

/* Quiz Question */
.quiz-question {
    margin-bottom: 25px;
}

.quiz-question p {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 15px;
}

/* Quiz Answers */
.quiz-answers {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Base Answer Style */
.quiz-answer {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-color);
    background-color: var(--secondary-color);
}

/* Hover State (Only for unanswered) */
.quiz-answer:hover:not(.answered) {
    background-color: var(--primary-color);
    color: var(--secondary-color);
}

/* Selected State (Unanswered) */
.quiz-answer.selected:not(.answered) {
    background: var(--golden-gradient);
    border-color: var(--primary-color);
}

/* Answered State */
.quiz-answer.answered {
    cursor: default;
    background-color: var(--secondary-color);
    opacity: 0.8;
}

/* Selected and Answered State */
.quiz-answer.answered.selected {
    background: var(--golden-gradient);
    border-color: var(--primary-color);
    color: var(--text-color);
}

/* Submit Button */
.quiz-submit {
    background: var(--golden-gradient);
    color: var(--text-color);
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.quiz-submit:hover {
    opacity: 0.9;
}

/* Container Width Constraints */
.frame-mode .quiz-container {
    max-width: 100%;  /* Ensures quiz doesn't overflow in frame mode */
    margin-right: auto;
    margin-left: auto;
}

#content.full-width .quiz-container {
    max-width: 100%;
    padding-right: 24px;  /* Matches content padding */
    padding-left: 24px;
}

/* Dark Mode Overrides */
.dark-mode .quiz-container {
    background: var(--grey-gradient);
}

.dark-mode .quiz-answer {
    background-color: var(--secondary-color);
    border-color: var(--primary-color);
}

.dark-mode .quiz-answer:hover:not(.answered) {
    background-color: var(--primary-color);
    color: var(--secondary-color);
}

.dark-mode .quiz-answer.selected:not(.answered),
.dark-mode .quiz-answer.answered.selected {
    background: var(--golden-gradient);
    color: var(--text-color);
}

.dark-mode .quiz-status {
    background: var(--golden-gradient);
    color: var(--text-color);
}












/* Quiz Admin Styles */
.quiz-placement-section {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.placement-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin: 5px 0;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.placement-info {
    flex-grow: 1;
}

.placement-info span {
    color: #495057;
}

.remove-button {
    background: #dc3545;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    margin-left: 10px;
    transition: background-color 0.2s;
}

.remove-button:hover {
    background: #c82333;
}

.no-items {
    color: #6c757d;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.empty-config {
    color: #dc3545;
    text-align: center;
    padding: 20px;
    font-weight: bold;
    border: 2px dashed #dc3545;
    border-radius: 4px;
    margin: 10px 0;
    background: rgba(220, 53, 69, 0.1);
}

    .star {
        width: 10px;
        height: 10px;
        background-color: gold;
        clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
        animation: growStar 9s infinite;
    }

    @keyframes growStar {
        0% {
            transform: scale(0.1);
            opacity: 0.5;
        }
        11% {
            transform: scale(0.2);
        }
        22% {
            transform: scale(0.3);
        }
        33% {
            transform: scale(0.4);
        }
        44% {
            transform: scale(0.5);
        }
        55% {
            transform: scale(0.6);
        }
        66% {
            transform: scale(0.7);
        }
        77% {
            transform: scale(0.8);
        }
        88% {
            transform: scale(0.9);
        }
        100% {
            transform: scale(1);
            opacity: 1;
        }
    }

/* Quiz Container */
#quizContainer {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.dark-mode #quizContainer {
    background: #2d2d2d;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Quiz Display States */
#quizContainer.hidden {
    display: none;
}

#quizContainer.visible {
    display: block;
}

/* Quiz Error States */
.quiz-error {
    color: #dc3545;
    padding: 15px;
    border: 1px solid #dc3545;
    border-radius: 4px;
    background: rgba(220, 53, 69, 0.1);
    margin: 10px 0;
}

.dark-mode .quiz-error {
    background: rgba(220, 53, 69, 0.2);
}

/* Debug Monitor */
#debugMonitor {
    background-color: #c896197a;
    padding: 15px;
    border-radius: 8px;
    margin: 10px;
    font-family: monospace;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.dark-mode #debugMonitor {
    background-color: #1e3a5f;
    color: #93762c;
}

/* Sidebar Icons */
.sidebar-icons {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.sidebar-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #d4af37;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--grey-gradient);
}

.sidebar-icon:hover {
    box-shadow: 0 0 15px #d4af37;
    transform: scale(1.1);
}

.sidebar-icon i {
    color: #d4af37;
    font-size: 20px;
}

.sidebar-icon.hidden {
    display: none;
}

.dynamic-content {
    display: none;
    color: rgba(25, 192, 81, 1);
    margin: 20px 0;
    padding: 15px;
    background-color: rgba(0, 0, 255, 0.05);
}

.dark-mode .dynamic-content {
    color: rgb(25, 192, 81);
}


.dynamic-content:empty {
    display: none;
}

a {
    text-decoration: none;
    color: #ffa600d4;
    background: black /* linear-gradient(-260deg, rgb(218, 142, 0), rgb(58, 45, 28)); */;
    -webkit-background-clip: text;
    /* -webkit-text-fill-color: transparent; */
}

a:hover {
    cursor: pointer;
    text-decoration: none;
}

.chapter-separator {
    border: none;
    height: 2px;
    background: linear-gradient(to right, rgb(141, 85, 1), #fc0);
    margin: 20px 0;
    width: 35%;}