/* ========================================
   Root Variables
======================================== */
:root {
    /* Primary Colors */
    --primary-red: #E31237;
    --primary-blue: #0096C7;

    /* Secondary Colors */
    --secondary-orange: #48C06;
    --secondary-yellow: #FFBA08;

    /* Neutral Colors */
    --neutral-gray: #343A40;
    --neutral-light: #DEE2E6;

    /* Accent Color */
    --accent-green: #3BB273;

    /* Shadow Levels */
    --shadow-sm: 0 2px 4px rgba(52, 58, 64, 0.05);
    --shadow-md: 0 4px 6px rgba(52, 58, 64, 0.1);
    --shadow-lg: 0 8px 16px rgba(52, 58, 64, 0.15);
    --menu-shadow: -2px 0 8px rgba(52, 58, 64, 0.1);
}

/* ========================================
   Reset
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--neutral-gray);
}

/* ========================================
   Header Styles
======================================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: var(--shadow-sm);
    z-index: 1000;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    background: white;
    box-shadow: var(--shadow-sm);
}

.logo {
    color: var(--primary-blue);
    font-size: 44px;
    font-weight: bold;
    font-family: "Times New Roman", Times, serif;
    
}

.logo {
    cursor: pointer;
}

.logo, .mobile-logo {
    cursor: pointer;
}

.social-icons {
    display: flex;
    gap: 20px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.social-icon {
    color: var(--primary-blue);
    font-size: 20px;
    transition: all 0.2s ease;
}

.social-icon:hover {
    transform: scale(1.1);
    opacity: 0.9;
}

.hamburger {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--neutral-gray);
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
}

.hamburger:hover {
    opacity: 0.8;
}

.hamburger.open {
    transform: rotate(90deg);
}

/* ========================================
   Layout
======================================== */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Ensures the page spans the full height of the viewport */
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--neutral-gray);
}

.container {
    flex: 1; /* Pushes the bottom-navigation to the bottom if content is short */
    display: flex;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
}

/* ========================================
   Navigation Styles
======================================== */
.nav-menu {
    width: 20%;
    background: white;
    padding: 20px;
    border-right: 1px solid var(--neutral-light);
    height: calc(100vh - 60px);
    overflow-y: auto;
    position: fixed;
}

.search-bar {
    background: white;
    border: 1px solid var(--neutral-light);
    border-radius: 24px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.search-bar input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 16px;
}

.search-icon-separator {
    width: 1px;
    height: 24px;
    background: var(--neutral-light);
    margin: 0 12px;
}

.search-container {
    display: none !important;
}

/* Navigation Sections */
.nav-sections {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 40px; 
}

/* Desktop Dropdown Menu - Add these new styles */
.desktop-dropdown {
    position: absolute;
    top: 60px;
    right: 20px;
    background: white;
    border: 1px solid var(--neutral-light);
    border-radius: 4px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    min-width: 150px;
}

.dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background: var(--neutral-light);
}

.dropdown-item i {
    color: var(--primary-blue);
}

/* Section Headers */
.section-header {
    font-size: 1.2rem; /* Distinct, larger section title */
    font-weight: bold;
    color: var(--neutral-gray); /* Gray color for section titles */
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 4px;
}

.section-header:hover {
    color: var(--primary-blue); /* Highlight section title on hover */
}

.section-header i {
    font-size: 0.9rem; /* Smaller arrow size */
    transition: transform 0.3s ease;
}

/* ========================================
   Content Area Styles
======================================== */
.content {
    flex: 1;
    margin-left: 20%;
    padding: 20px;
}

.right-column {
    width: 20%;
    padding: 20px;
}

.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(52, 58, 64, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ========================================
   Lesson Content
======================================== */
.lesson-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.lesson-title {
    color: var(--neutral-gray);
    font-size: 1 rem;
    margin-bottom: 0.25rem;
}

.lesson-subtitle {
    color: var(--neutral-gray);
    font-size: 1.5rem;
    font-weight: normal;
    margin-bottom: 2rem;
}

.tldr-section {
    background: var(--neutral-light);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.tldr-section h3 {
    color: var(--primary-red);
    margin-bottom: 0.5rem;
}

.lesson-content {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}
.lesson-item {
    font-size: 0.85rem; /* Smaller font size */
    color: var(--neutral-gray);
    text-decoration: none;
    padding: 4px 8px; /* Compact padding */
    border-radius: 4px;
    transition: all 0.2s ease-out;
    display: flex;
    align-items: center;
    gap: 8px; /* Spacing between icon and text */
}
.lesson-item:hover {
    background-color: var(--neutral-light); /* Background on hover */
    color: var(--primary-blue); /* Blue text on hover */
}

.lesson-item .lesson-status {
    order: -1; /* Move the circle (icon) to the left-hand side */
    margin-right: 8px; /* Add some space between the circle and the title */
    font-size: 0.8rem; /* Adjust the size of the circle if needed */
}
.lesson-item:hover {
    background-color: var(--neutral-light);
    color: var(--primary-blue);
}
.lesson-item:visited,
.lesson-item:focus,
.lesson-item {
    color: var(--neutral-gray); /* Ensure all states are gray by default */
}
.lesson-item.active {
    background-color: #f0f0f0; /* Light gray background */
    font-weight: bold;         /* Make the text bold */
    border-left: 4px solid #0096C7; /* Add a colored border to the left */
    padding-left: 8px;         /* Adjust padding for alignment */
}

.section-lessons {
    margin-left: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.5s ease;
}

.section.expanded .section-lessons {
    max-height: 2000px; /* Increased this value */
}



/* ========================================
   Attachments
======================================== */
.attachment {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: white;
    border: 1px solid var(--neutral-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.attachment:hover {
    background: var(--neutral-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========================================
   Miscellaneous
======================================== */
.menu-item {
    transition: all 0.2s ease-out;
    padding: 12px 16px;
    border-radius: 6px;
}

.menu-item:hover {
    background: var(--neutral-light);
    transform: translateX(4px);
}

.menu-item:active {
    background: rgba(227, 18, 55, 0.1);
    transform: translateX(6px);
}

.search-bar:focus-within {
    box-shadow: var(--shadow-md);
}


/* ========================================
   Markdown Content Styles
======================================== */
.lesson-content {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.lesson-content h1,
.lesson-content h2,
.lesson-content h3,
.lesson-content h4,
.lesson-content h5,
.lesson-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.lesson-content p {
    margin-bottom: 1.5rem;
}

.lesson-content p + p {
    margin-top: 1rem;
}

/* Add more spacing after headers */
.lesson-content h2 + p,
.lesson-content h3 + p {
    margin-top: 1rem;
}

/* Ensure spacing between sections */
.lesson-content > * + * {
    margin-top: 1.5rem;
}

/* New List Styles */
.lesson-content ul,
.lesson-content ol {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
    margin-top: 0.5rem;
}

.lesson-content li {
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
    line-height: 1.6;
}

.lesson-content ul li {
    list-style-type: disc;
}

.lesson-content ul ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Bottom Navigation Styling */
.bottom-navigation {
    background: white;
    border-top: 1px solid #ddd;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    padding: 15px 20px;
    display: flex;
    justify-content: center; /* Center the feedback section */
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    border-radius: 10px 10px 0 0;
    position: relative; /* Allow absolute positioning for buttons */
}

/* Feedback Section */
.feedback-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    width: 240px; /* Default card width */
    max-width: 90%; /* Make it responsive on smaller screens */
}

/* Feedback Buttons */
.feedback-buttons {
    display: flex;
    gap: 10px;
}

.feedback-button {
    border: 1px solid #ddd;
    background: #f9f9f9;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.feedback-button:hover {
    background: #e6e6e6;
    border-color: #ccc;
}

.feedback-button.yes {
    color: #28a745;
}

.feedback-button.no {
    color: #dc3545;
}

.feedback-icon {
    font-size: 24px;
    padding: 10px;
    border-radius: 50%;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    cursor: default;
}

.feedback-icon:hover {
    transform: scale(1.1);
}

/* Lesson Navigation Buttons (Next and Previous) */
.nav-button {
    background: #ADDDED;
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
    position: absolute; /* Position outside the card */
    top: 50%; /* Center vertically relative to the card */
    transform: translateY(-50%);
}

.nav-button.prev {
    left: calc(-240px - 20px); /* Position dynamically based on card width */
}

.nav-button.next {
    right: calc(-240px - 20px); /* Position dynamically based on card width */
}

.nav-button:hover {
    background: #0096C7;
}

/* ========================================
   Asset Modal
======================================== */
.asset-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    width: 100%; /* Ensure container takes full width */
    padding: 0 15px; /* Add some padding on the sides */
}

.asset-preview {
    cursor: pointer;
    position: relative;
    border: 1px solid #ddd;
    width: 100%; /* Make it responsive */
    max-width: 400px; /* Maximum width on larger screens */
    height: auto; /* Let height adjust automatically */
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.asset-thumbnail {
    width: 100%;
    height: auto;
    border: none;
    object-fit: contain;
}

/* PDF Preview specific styles */
.pdf-preview {
    max-width: 100% !important; /* Override any inline styles */
    height: auto !important;
    display: block;
    margin: 0 auto;
}

.preview-wrapper {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

/* Make sure the preview overlay is responsive */
.preview-overlay {
    width: 100% !important;
    height: 100% !important;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .asset-preview-container {
        padding: 0 10px;
    }

    .asset-preview {
        width: 100%;
        max-width: 100%;
    }

    .preview-wrapper {
        max-width: 100%;
    }

    /* Adjust the hover overlay text size for mobile */
    .preview-overlay div {
        font-size: 14px;
        padding: 8px 16px;
    }
}   


/* ========================================
   Responsive Adjustments
======================================== */
/* Hide the mobile logo on desktop */
@media (min-width: 769px) {
    .mobile-logo {
        display: none !important;
    }
}

@media (max-width: 768px) {
    /* Feedback Section Width Adjustment */
    .feedback-section {
        width: 80%; /* Adjust card width for smaller screens */
    }

    /* Hide the original header logo on mobile */
    .logo {
        display: block; /* Keep logo visible */
        font-size: 28px;
        color: var(--primary-blue);
    }

    .social-icons {
        position: absolute;
        left: 60%;
        transform: translateX(-50%); /* Keep the transform for centering */
    }

    .desktop-dropdown {
        display: none !important;
    }

    /* Style the logo inside the menu */
    .mobile-logo {
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 28px;
        font-weight: bold;
        color: var(--primary-blue);
        text-align: center;
        z-index: 1200;
        font-family: "Times New Roman", Times, serif;
    }

    /* Adjust Previous and Next buttons */
    .nav-button.prev {
        left: calc(-80% - 10px); /* Dynamically adjust button spacing */
    }

    .nav-button.next {
        right: calc(-80% - 10px); /* Dynamically adjust button spacing */
    }

    /* Bottom Navigation Styling */
    .bottom-navigation {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 15px;
    }

    /* Reduce lesson item spacing */
    .lesson-item {
        padding: 6px 8px;  /* Reduce padding */
        font-size: 1rem;  /* Keep text readable */
        display: flex;
        align-items: center;
        justify-content: flex-start; /* Ensure text and icon stay together */
    }

    /* Reduce the gap between text and > icon */
    .lesson-item i {
        font-size: 1rem; /* Keep arrow size */
        margin-left: auto; /* Ensure icon is positioned naturally */
        margin-right: 5px; /* Bring closer to text */
    }

    /* Expand the content area to full width */
    .content {
        width: 100%;
        margin-left: 0;
        margin: 0;
        padding: 0
    }

    .right-column {
        display: none;
        width: 0;
    }

    /* Ensure the container is full width */
    .container {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    /* Navigation Buttons (Previous & Next) */
    .nav-button {
        width: 100%;
        max-width: 300px;
        margin-bottom: 10px;
        position: static;
        transform: none;
    }

    .nav-button.next {
        order: 1; /* Put next button first */
    }

    .nav-button.prev {
        order: 2; /* Put prev button second */
    }

    .feedback-section {
        order: 3; /* Put feedback section last */
        width: 100%;
    }

    /* ========================================
       Mobile Menu (Hidden by Default)
    ======================================== */
    .nav-menu {
        position: fixed;
        top: 0;
        left: -100%; /* Keep it hidden off-screen */
        width: 90%; /* Covers 70% of the screen */
        height: 100%;
        background: white;
        padding: 20px 20px 20px 40px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
        z-index: 1100;
        overflow-y: auto;
        transition: transform 0.3s ease-in-out;
    }

    /* Show menu when open (slide in from the left) */
    .nav-menu.open {
        transform: translateX(100%);
    }

    /* Dim Background Overlay */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.3); /* 30% opaque */
        z-index: 1000;
        transition: opacity 0.3s ease-in-out;
        opacity: 0;
    }

    /* Show overlay when menu is open */
    .mobile-overlay.show {
        display: block;
        opacity: 1;
    }

    /* Prevent background content from moving */
    .container {
        width: 100%;
    }
}

/* ========================================
   Desktop View (Menu Always Visible)
======================================== */
@media (min-width: 769px) {
    .nav-menu {
        position: relative;
        left: 0;
        width: 20%;
        transform: none;
    }

    .mobile-overlay {
        display: none !important;
    }

    .container {
        display: flex;
        flex-direction: row;
    }

    .content {
        flex: 1; /* Take up remaining space */
        margin-left: 0; /* Remove unnecessary margin */
        padding-left: 20px; /* Just enough space for readability */
    }
}
