:root {
    --primary-color: #4A90E2;
    --secondary-color: #088d13;
    --accent-color: #ff0d00;
    --background-color: #F0F4F8;
    --text-color: #2D3748;
    --card-background: #FFFFFF;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --footer-words:#000000;
    --control-btn:#0077ff;
    --hover-btn:#55a1f8;
    --reverse-color:#FFFFFF;
}

/* Dark theme*/
[data-theme="dark"] {
    --primary-color: #7EB6FF;
    --secondary-color: #98D8A0;
    --accent-color: #ff0d00;
    --background-color: #2A4365;
    --text-color: #E2E8F0;
    --card-background: #3A5A8C;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --footer-words:#FFFFFF;
    --control-btn:#bbdbff;
    --hover-btn:#eff6fd;
    --reverse-color:#0077ff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Quicksand', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease;
}

.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.05;
    z-index: -1;
    background-image: radial-gradient(circle at 1px 1px, var(--text-color) 1px, transparent 0);
    background-size: 30px 30px;
}

header {
    text-align: center;
    padding: 2rem 0;
    background: linear-gradient(to right, transparent, var(--shadow-color), transparent);
    position: relative;
}

.site-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.site-subtitle {
    font-style: italic;
    font-weight: bold;
    color: var(--secondary-color);
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    gap: 1.5rem;
    margin-bottom: 0.5rem; /* Add space for footer */
}

.controls-panel {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
    width: 100%;
    justify-content: center; /* Center the buttons horizontally */
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--control-btn);
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    color: var(--control-btn);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.control-btn:hover {
    background: var(--hover-btn);
    border-color: var(--hover-btn);
    color: var(--reverse-color);
}

.notes-frame {
    width: 21cm;  /* A4 width */
    height: 29.7cm;  /* A4 height */
    background: var(--card-background);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px var(--shadow-color);
    position: relative;
    display: flex;
    flex-direction: column;
    transform: scale(0.65);
    transform-origin: top center;
    margin-bottom: -4rem;
    overflow: hidden; /* Add this to contain the scrolling */
}

.notes-container {
    flex: 1;
    opacity: 0;
    transition: opacity 0.5s ease;
    overflow: hidden; /* Add this to contain the scrolling */
    display: flex;
    flex-direction: column;
}

.notes-container.active {
    opacity: 1;
}

.topic-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--primary-color);
}

.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid var(--shadow-color);
}

.nav-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.nav-button:hover:not(:disabled) {
    color: var(--accent-color);
    transform: scale(1.1);
}

.nav-button:disabled {
    color: var(--shadow-color);
    cursor: not-allowed;
}

.page-indicator {
    font-size: 1.2rem;
    color: var(--secondary-color);
}

.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.theme-toggle:hover {
    transform: rotate(15deg);
}

footer {
    text-align: center;
    padding: 1rem;
    color: var(--footer-words);
    font-weight: bold;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));
}

footer .fa-heart {
    color: var(--accent-color);
}

/* Topics menu styles */
.topics-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.topics-menu-content {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px var(--shadow-color);
    max-width: 90%;
    width: 500px;
}

.topics-menu h3 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.topics-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.topic-item {
    background: none;
    border: none;
    padding: 1rem;
    text-align: left;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topic-item:hover {
    background: var(--primary-color);
    color: var(--card-background);
}

.topic-item.active {
    background: var(--secondary-color);
    color: var(--card-background);
}

.topic-item i {
    width: 24px;
    text-align: center;
}


/* Notes Theme */
.notes-content {
    height: 100%;
    overflow-y: auto;
    padding-right: 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.notes-content::-webkit-scrollbar {
    width: 8px;
}

.notes-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.notes-content::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.notes-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.topic-content {
    height: calc(100% - 4rem); /* Subtract the height of the title */
    overflow-y: auto;
}

.notes-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.section-title {
    color: var(--primary-color);
    font-size: 1.5em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.code-block {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    font-family: monospace;
    white-space: pre;
    overflow-x: auto;
}

code {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: monospace;
}

.section-content {
    color: var(--text-color);
    line-height: 1.6;
    font-size: 1em;
}

/* Code blocks styling */
.section-content pre {
    background: rgba(0, 0, 0, 0.1);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1rem 0;
    font-family: monospace;
}

/* List styling */
.section-content ul,
.section-content ol {
    list-style-position: inside;
    margin: 1rem 0;
}

.section-content li {
    margin: 0.5rem 0;
    padding-left: 1rem;
}

/* Element in the notes */
.element-group {
    margin: 1.5rem 0;
}

.element-group h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.1em;
}

.element-group ul {
    list-style: none;
    margin-left: 1rem;
}

.element-group ul li {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.code-demo {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.demo-result {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.demo-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 300px;
}

.demo-form input {
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

.demo-form button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    background: var(--primary-color);
    color: white;
    cursor: not-allowed;
    opacity: 0.7;
}


/* Responsive design */
@media (max-width: 768px) {
    .notes-frame {
        width: 100%;
        height: calc(100vh - 200px); /* Adjust height for mobile viewport */
        transform: none;
        margin: 0;
        padding: 1rem;
        overflow: hidden;
    }

    .notes-content {
        height: 100%;
        padding-right: 0.5rem;
    }

    .topic-content {
        height: calc(100% - 3rem); /* Adjusted for smaller title on mobile */
    }

    .notes-section {
        margin-bottom: 1rem;
        padding: 1rem;
    }

    .section-title {
        font-size: 1.2em;
    }

    .code-block {
        padding: 1rem;
        font-size: 0.85em;
    }

    .section-content {
        font-size: 0.95em;
    }

    /* Improve touch scrolling */
    .notes-content {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    .container {
        padding: 1rem;
        gap: 1rem;
    }

    /* Adjust navigation for mobile */
    .navigation {
        padding: 0.5rem 0;
    }

    .nav-button {
        padding: 0.5rem;
    }

    /* Ensure footer doesn't overlap content */
    footer {
        position: relative;
        margin-top: 1rem;
    }

    /* Better spacing for controls on mobile */
    .controls-panel {
        margin-bottom: 0.5rem;
    }

    .control-btn {
        padding: 0.6rem 1rem;
        font-size: 1rem;
    }

        .element-group {
        margin: 1rem 0;
    }
    
    .code-demo {
        padding: 1rem;
    }
    
    .demo-form {
        max-width: 100%;
    }
}