:root {
    --icon-size: 37px;
    --panel-transition-duration: 0.5s;
}

/* Global styles */
*:not(input):not(textarea) {
    user-select: none;
}

input, textarea {
    user-select: text;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    background-color: #1a202c;
    color: white;
    overflow-x: hidden;
    padding-top: 60px; /* Add padding to account for fixed navbar */
}

/* Main content styles */
.main-content {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px); /* Subtract navbar height */
    overflow: hidden;
}

/* Navbar styles */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #2a3f5d;
    padding: 10px;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    height: 60px;
}

.navbar-logo img {
    width: 50px;
    height: auto;
}

.navbar-links {
    display: flex;
    align-items: center;
}

.nav-link, .dropbtn {
    color: white;
    text-decoration: none;
    padding: 10px 12px; /* Adjust padding to fit all links */
    display: block;
    font-size: 14px; /* Adjust font size to ensure everything fits */
}

.nav-link:hover, .dropbtn:hover, .dropdown:hover .dropbtn {
    color: #ffd700;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 190px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 1;
    border-radius: 5px;
    border-bottom: 1px solid #d3d3d3;
}

.dropdown-content a, .dropdown-content .learning-resources-btn {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    border-radius: 5px;
    border-bottom: 1px solid #2a3f5d;
}

.dropdown-content a:last-child, .dropdown-content .learning-resources-btn:last-child {
    border-bottom: none;
}

.dropdown:hover .dropdown-content {
    display: block;
    background-color: #ffd700;
}

.dropdown .dropdown-content a:hover, 
.dropdown-content .learning-resources-btn:hover {
    background-color: #ffd700;
    color: #1a202c;
    font-weight: bold;
}

/* Specific styles for nested dropdown under 'Learning Resources' */
.dropdown-content .nested-dropdown {
    display: block; /* Always displayed but initially invisible */
    opacity: 0; /* Initial invisible state */
    transition: opacity 0.3s ease; /* Smooth transition for opacity change */
    position: absolute;
    left: 100%; /* Position to the right */
    top: 0;
}

.nested-dropdown a {
    border-bottom: 1px solid #2a3f5d;
}

.nested-dropdown a:last-child {
    border-bottom: none;
}

/* Change opacity to 1 when hovering over 'Learning Resources' link or nested dropdown */
.dropdown-content .learning-resources-link:hover + .nested-dropdown,
.nested-dropdown:hover {
    opacity: 1; /* Make nested dropdown visible on hover */
}

/* Language switcher styles */
.language-switcher select {
    color: #ffd700;
    font-weight: bold;
    background-color: #2a3f5d;
    border: none;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.language-switcher select option {
    background-color: #ffd700;
    color: #1a202c;
    font-weight: normal;
}

/* Hamburger menu styles */
.hamburger {
    display: none;
    cursor: pointer;
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 30px;
    height: 3px;
    margin-bottom: 5px;
    background-color: grey;
    transition: all 0.3s ease;
}

.hamburger.change span {
    background-color: #ffd700;
}

.hamburger.change span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.change span:nth-child(2) {
    opacity: 0;
}

.hamburger.change span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Hamburger Menu and Navbar styles for Mobile */
@media (max-width: 600px) {
    .hamburger {
        display: block;
    }

    .navbar-links {
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background-color: #2a3f5d;
        display: none;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        padding: 10px 0;
    }

    .navbar-links.show {
        display: flex;
     }

    .navbar-links > .nav-link, .navbar-links > .dropdown {
        display: block; /* Changed to block for a vertical layout */
        margin: -10px -5px; /* Increased left and right margin */
        text-align: center; /* Center align the text for a better look */
    }
    .dropdown-content {
        top: 100%;
        left: 0;
        min-width: 200px; /* Example: Change the minimum width */
        max-width: 100%; /* Optionally, you can set a maximum width */
        max-height: 120px; /* Example: limit the height of the dropdown */
    }

    /* Adjustments for the nested dropdown for mobile screens */
    .dropdown-content .nested-dropdown {
        position: static; /* Reset position for mobile */
    }

    .language-switcher {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
}

/* Footer styles */
.footer {
    background-color: #2a3f5d;
    color: #ffd700;
    text-align: center;
    padding: 20px 0;
    width: 100%;
    margin-top: auto;
}

/* Genre tab styles */
#genreTabsContainer {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    overflow-y: auto;
    transition: max-height 0.5s ease-in-out, width 0.5s ease-in-out;
}

#genreTabsContainer.expanded {
    max-height: calc(100vh - 120px);
}

.genre-tabs {
    display: flex;
    flex-direction: column;
    width: 100%;
    border-right: 1px solid #555;
    padding: 10px;
    align-items: center;
    z-index: 1001;
    overflow-y: auto;
    flex-grow: 1;
    position: relative;
}

.genre-tab {
    padding: 10px 20px;
    margin-bottom: 10px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    user-select: none;
    color: grey;
    border-bottom: 1px solid lightgray;
    transition: color 0.3s ease;
}

.genre-tab:hover {
    color: #ffd700;
}

.selected-tab {
    color: #ffd700;
}

.genre-tab.child-tab {
    display: flex;
    align-items: center;
    padding-left: 42px;
    position: relative;
}

.genre-tab.child-tab::before {
    content: '•';
    color: #ffd700;
    position: absolute;
    left: 30px;
    font-size: 20px;
}

.genre-tab.accordion-tab::before {
    content: '';
}

/* Accordion styles */
#accordionHeader,
#numberSenseHeader,
#whiteboardHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: color 0.3s ease;
}

#accordionHeader .arrow-container,
#numberSenseHeader .arrow-container,
#whiteboardHeader .arrow-container {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    background-color: #2a3f5d;
    border-radius: 50%;
    border: 2px solid #ffd700;
    margin-left: 8px;
    transition: transform var(--panel-transition-duration) ease;
}

#accordionHeader .arrow,
#numberSenseHeader .arrow,
#whiteboardHeader .arrow {
    font-weight: bold;
    color: #ffd700;
}

#accordionHeader.expanded .arrow-container,
#numberSenseHeader.expanded .arrow-container,
#whiteboardHeader.expanded .arrow-container {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--panel-transition-duration) ease, opacity var(--panel-transition-duration) ease;
    opacity: 0;
}

.accordion-content.show {
    opacity: 1;
    max-height: 1000px; /* Arbitrary large value to ensure full expansion */
}

/* Content wrapper styles */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: calc(100vh - 60px);
    padding-bottom: 60px;
    position: relative;
}

#contentFrame {
    width: 100%;
    border: none;
    transition: all var(--panel-transition-duration) ease;
    flex-grow: 1;
}

/* Footer styles */
.footer {
    background-color: #2a3f5d;
    color: #ffd700;
    text-align: center;
    padding: 10px 0;
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    transition: transform 0.3s ease-in-out;
    transform: translateY(0); /* Visible initially */
}

.footer.collapsed {
    transform: translateY(100%); /* Hidden */
}

/* Footer trigger styles */
.footer-trigger {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: transparent;
    z-index: 1000;
}

/* Page title styles */
#courseTitle {
    text-align: center;
    text-decoration: underline;
    font-size: 2rem;
    color: #ffd700;
    padding-top: 20px;
    padding-bottom: 20px;
}

/* Custom scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #2a3f5d;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background-color: #ffd700;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #ff8c00;
}

/* Button container styles */
.button-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#downloadScreenshotBtn,
#toggleGenreTabsBtn {
    background-color: #ffd700;
    color: #1a202c;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    white-space: nowrap;
}

#downloadScreenshotBtn {
    max-width: 200px;
}

#downloadScreenshotBtn:hover,
#toggleGenreTabsBtn:hover {
    background-color: #ff8c00;
}

#toggleGenreTabsBtn .arrow-container {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    background-color: #2a3f5d;
    border-radius: 50%;
    border: 2px solid #ffd700;
    margin-left: 8px;
}

#toggleGenreTabsBtn .arrow {
    font-weight: bold;
    color: #ffd700;
}

#toggleGenreTabsBtn.expanded .arrow-container {
    transform: rotate(180deg);
}

/* Panel toggle button styles */
.panel-toggle-btn-container {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1001;
    transition: left var(--panel-transition-duration) ease;
}

.panel-toggle-btn {
    cursor: pointer;
    transition: transform var(--panel-transition-duration) ease;
    background-color: rgba(42, 63, 93, 0.7);
    border-radius: 50%;
    padding: 5px;
}

.panel-toggle-btn img {
    width: var(--icon-size);
    height: var(--icon-size);
}

.panel-toggle-btn.collapsed img {
    transform: rotate(180deg);
}

/* Hamburger menu styles */
.hamburger {
    display: none;
    cursor: pointer;
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 30px;
    height: 3px;
    margin-bottom: 5px;
    background-color: grey;
    transition: all 0.3s ease;
}

.hamburger.change span {
    background-color: #ffd700;
}

.hamburger.change span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.change span:nth-child(2) {
    opacity: 0;
}

.hamburger.change span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Responsive styles */
@media (max-width: 768px) {
    body {
        overflow: hidden;
    }
   
    .content-wrapper {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 60px); /* Adjust this value if necessary */
    }

    #genreTabsContainer {
        position: fixed;
        top: 60px; /* Adjust this value to match your navbar height */
        left: 0;
        right: 0;
        bottom: 0; /* Adjust this value to match your footer height */
        width: 100%;
        z-index: 1000;
        background-color: #1a202c;
        overflow-y: auto;
        transition: height 0.3s ease-in-out;
        display: none;
    }

    #genreTabsContainer.expanded {
        display: block;
        height: calc(100vh - 120px); /* Adjust 120px if it's not the sum of your navbar and footer heights */
    }

    .genre-tabs {
        padding: 10px;
    }

    .genre-tab {
        padding: 15px;
        font-size: 16px;
    }

    #toggleGenreTabsBtn {
        display: flex;
    }

    #contentFrame {
        height: calc(100vh - 60px); /* Adjust this value if necessary */
    }

    .fixed-header {
        position: sticky;
        top: 60px;
        z-index: 50;
        background-color: #1a202c;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 10px;
        flex-direction: column;
        transition: max-height 0.3s ease;
    }

    .fixed-header.collapsed h1 {
        display: none;
    }

    .fixed-header.collapsed .button-container {
        padding: 0;
    }

    .hamburger {
        display: block;
    }

    .panel-toggle-btn-container {
        display: none;
    }

    .navbar-links {
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background-color: #2a3f5d;
        display: none;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        padding: 10px 0;
    }

    .navbar-links.show {
        display: flex;
    }

    .navbar-links > .nav-link, .navbar-links > .dropdown {
        display: block;
        margin: -10px -5px;
        text-align: center;
    }

    .dropdown-content {
        top: 100%;
        left: 0;
        min-width: 200px;
        max-width: 100%;
        max-height: 120px;
    }

    .dropdown-content .nested-dropdown {
        position: static;
    }

    .language-switcher {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    /* Hide footer on mobile and make it visible on hover */
    .footer {
        opacity: 0;
        visibility: hidden;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }

    .footer-trigger {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 20px;
        background: transparent;
        z-index: 1000;
    }

    .footer-trigger:hover ~ .footer,
    .footer:hover {
        opacity: 1;
        visibility: visible;
    }
}

@media (min-width: 769px) {
    .main-content {
        flex-direction: row;
    }

    #genreTabsContainer {
        width: 450px;
        max-height: none;
    }

    #genreTabsContainer.collapsed {
        width: 0;
    }

    .content-wrapper {
        flex-direction: row;
    }

    #toggleGenreTabsBtn {
        display: none;
    }
}

/* Add this CSS to dynamically adjust font size for smaller screens */
@media (max-width: 768px) {
    .dropdown-content a, .dropdown-content .learning-resources-btn, .nested-dropdown a {
        font-size: 12px; /* Adjust the font size as needed */
    }

    .dropbtn {
        font-size: 14px; /* Adjust the font size for dropdown buttons */
    }

    .nested-dropdown {
        font-size: 12px; /* Adjust the font size for nested dropdown */
    }
}

/* Further adjustments if needed for even smaller screens */
@media (max-width: 480px) {
    .dropdown-content a, .dropdown-content .learning-resources-btn, .nested-dropdown a {
        font-size: 10px; /* Adjust the font size as needed */
    }

    .dropbtn {
        font-size: 12px; /* Adjust the font size for dropdown buttons */
    }

    .nested-dropdown {
        font-size: 10px; /* Adjust the font size for nested dropdown */
    }
}
