:root {
    --background-color: #1a1a1a;
    --text-color: #e0e0e0;
    --primary-color: #007bff;
    --secondary-color: #333;
    --card-bg: #2a2a2a;
    --border-color: #444;
    --header-height: 60px;
    --nav-width: 250px;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

h1, h2, h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

h1 {
    font-size: 1.8rem;
    text-align: center;
    flex-grow: 1;
    margin: 0; /* Reset margin for flex layout */
}

h2 {
    font-size: 1.6rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 1rem;
}

h3 {
    font-size: 1.3rem;
    margin-top: 1rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6em 1.2em;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

button:hover:not(:disabled) {
    background-color: #0056b3;
}

button:disabled {
    background-color: #555;
    cursor: not-allowed;
}

header {
    background-color: var(--secondary-color);
    color: white;
    padding: 0 1rem;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    height: var(--header-height);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

#menu-toggle {
    background: none;
    border: none;
    padding: 0.5rem;
    margin-right: 1rem;
    cursor: pointer;
}

#menu-toggle svg {
    display: block; /* Remove extra space below SVG */
}

/* Slide-out Navigation */
#slide-nav {
    position: fixed;
    top: 0;
    left: calc(-1 * var(--nav-width)); /* Initially hidden */
    width: var(--nav-width);
    height: 100%;
    background-color: var(--secondary-color);
    padding-top: var(--header-height);
    box-shadow: 2px 0 5px rgba(0,0,0,0.5);
    transition: left 0.3s ease-in-out;
    z-index: 1001; /* Above header slightly */
    overflow-y: auto;
}

#slide-nav.open {
    left: 0;
}

#close-nav {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 2rem;
    line-height: 1;
    padding: 0.5rem;
}

#slide-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#slide-nav li a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--text-color);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

#slide-nav li a:hover {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
}

/* Overlay for closing nav */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999; /* Below nav, above content */
    display: none; /* Hidden by default */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#overlay.visible {
    display: block;
    opacity: 1;
}

main {
    padding: calc(var(--header-height) + 1rem) 1rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Section visibility */
.content-section {
    display: none; /* Hide all sections by default */
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.content-section.active {
    display: block; /* Show active section */
    opacity: 1;
}

/* Course Listing Styles */
#courses-container {
    margin-top: 1rem;
}

.course-group {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.course-group:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.3), 0 0 30px rgba(255,255,255,0.7);
    transform: translateY(-2px) scale(1.02);
}

.course-group:active {
    box-shadow: 0 4px 20px rgba(0,0,0,0.3), 0 0 30px rgba(255,255,255,0.7);
    transform: translateY(-2px) scale(1.02);
}

.course-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 1rem;
    border: 2px solid var(--border-color);
}

.course-group::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #00d4ff);
}

.course-group h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    position: relative;
    padding-right: 30px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: color 0.2s ease;
    color: white;
}

.course-group h3:hover {
    color: #e0e0e0;
}

.course-group h3::after {
    content: '▼';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
    font-size: 0.8em;
    color: var(--primary-color);
}

.course-group:not(.expanded) h3::after {
    transform: translateY(-50%) rotate(-90deg);
}

.course-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0;
}

.course-group.expanded .course-content {
    max-height: 2000px;
    opacity: 1;
    transition: max-height 0.5s ease-in, opacity 0.3s ease-in;
}

.topic-list, .series-list, .video-list {
    list-style: none;
    padding-left: 1rem;
    margin-top: 0.5rem;
}

.topic-group, .series-group {
    margin-bottom: 0.8rem;
    padding-left: 1rem;
    border-left: 2px solid var(--primary-color);
}

.series-group h4 {
     margin-bottom: 0.5rem;
     font-size: 1.1rem;
     color: var(--text-color);
}

.video-item {
    margin-bottom: 0.5rem;
}

.video-item button {
    background: none;
    border: none;
    color: var(--primary-color);
    text-align: left;
    padding: 0.3rem 0;
    cursor: pointer;
    font-size: 1rem;
}

.video-item button:hover {
    text-decoration: underline;
    background: none; 
}

.loading-message, .error-message {
    font-style: italic;
    color: #aaa;
    text-align: center;
    padding: 2rem;
}

.error-message {
    color: #ff6b6b;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    max-width: 90%;
    max-height: 90vh;
    width: 800px; 
    overflow-y: auto;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    color: var(--text-color);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.5rem;
}

.video-player-container {
    position: relative;
    padding-bottom: 56.25%; 
    height: 0;
    overflow: hidden;
    background-color: #000;
    margin-bottom: 1rem;
    border-radius: 4px;
}

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

#modal-title {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.4rem;
}

#modal-series-nav {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; 
    gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
}

#modal-series-nav p {
    margin: 0;
    flex-basis: 100%; 
    text-align: center;
    font-size: 0.9rem;
    color: #ccc;
}

#modal-series-nav button {
    flex-grow: 1; 
    min-width: 100px; 
}

#modal-episode-select {
    flex-grow: 2; 
    padding: 0.5rem;
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-width: 150px; 
}

#modal-video-description {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #bbb;
}

/* Featured & Learning Paths */
.featured-list, .learning-path ol {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
}

.learning-path {
    background-color: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary-color);
}

.learning-path h3 {
     margin-top: 0;
     margin-bottom: 0.5rem;
     color: var(--text-color);
}

.founder-portrait {
    text-align: center;
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.founder-image {
    width: 300px;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.founder-name {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--primary-color);
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }

    main {
        padding: calc(var(--header-height) + 1rem) 0.5rem 0.5rem;
    }

    .modal-content {
        width: 95%;
        max-width: 95%;
        padding: 1.5rem;
    }

    #modal-title {
        font-size: 1.2rem;
    }

     #modal-series-nav {
        flex-direction: column; 
        align-items: stretch; 
     }

     #modal-series-nav p {
         margin-bottom: 0.5rem; 
     }

     #modal-episode-select {
         width: 100%; 
     }
}

@media (max-width: 480px) {
     h1 {
        font-size: 1.3rem;
    }
     #menu-toggle {
         margin-right: 0.5rem;
     }
     #menu-toggle svg {
         width: 25px;
         height: 25px;
     }
    :root {
        --nav-width: 200px;
    }
     #slide-nav {
        left: calc(-1 * var(--nav-width));
     }
     .modal-content {
        padding: 1rem;
     }
     .close-modal {
         top: 5px;
         right: 8px;
         font-size: 1.8rem;
     }
}

.header-logo {
    height: 40px;
    margin-right: 1rem;
    filter: brightness(1.1);
}

.hero-section {
    background: linear-gradient(rgba(0, 123, 255, 0.8), rgba(0, 123, 255, 0.6)), url('hero-bg.png');
    background-size: cover;
    background-position: center;
    padding: 4rem 2rem;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.hero-section h2 {
    font-size: 2.5rem;
    color: white;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    border: none;
}

.hero-section p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 0 auto;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}