/*
Theme Name: Sam-Theme5
Description: A custom theme for CSE tutorial 
Author: Sam
Version: 9.0
*/

/* General Layout */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  margin: 0;
  padding: 0;
}

.site-header {
  background: #2f8d46;
  color: white;
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header-container {
  max-width: 1400px; /* Wider for modern screens */
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 15px;
}

.site-logo img {
  max-height: 50px;
  width: auto;
  display: block;
}

.site-title {
  margin: 0;
  font-size: 1.8em;
  font-weight: 600;
}

.site-title a {
  color: white;
  text-decoration: none;
  transition: color 0.3s ease;
}

.site-title a:hover {
  color: #e0e0e0;
}

.main-navigation {
  background: transparent; /* Remove separate background */
}

.main-navigation ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
}

.main-navigation li {
  padding: 10px 15px;
  position: relative;
}

.main-navigation a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.main-navigation a:hover {
  color: #e0e0e0;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.2em;
  cursor: pointer;
  padding: 10px;
}

.hamburger-icon {
  display: block;
  width: 24px;
  height: 3px;
  background: white;
  position: relative;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 3px;
  background: white;
  left: 0;
}

.hamburger-icon::before {
  top: -8px;
}

.hamburger-icon::after {
  top: 8px;
}

.menu-toggle[aria-expanded="true"] .hamburger-icon {
  background: transparent;
}

.menu-toggle[aria-expanded="true"] .hamburger-icon::before {
  transform: rotate(45deg);
  top: 0;
}

.menu-toggle[aria-expanded="true"] .hamburger-icon::after {
  transform: rotate(-45deg);
  top: 0;
}

.site-content {
  max-width: 1400px; /* Wider content */
  margin: 0 auto;
  padding: 20px;
}

.site-footer {
  background: #333;
  color: white;
  text-align: center;
  padding: 20px 0;
  margin-top: 40px;
}

/* Course Container */
.course-container {
  max-width: 1400px; /* Wider content */
  margin: 0 auto;
  padding: 20px;
}

/* Adjust course content width */
.course-content {
  flex: none;
  padding-right: 0;
  max-width: 100%;
}

/* Homepage */
.home-container {
  max-width: 1400px;
  margin: 0 auto;
}

.search-container {
  text-align: center;
  padding: 50px 0;
  background: #f0f0f0;
  border-radius: 5px;
  margin-bottom: 30px;
}

.search-field {
  width: 60%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
}

.search-submit {
  padding: 12px 20px;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.category-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 30px;
}

.category-box {
  flex: 1 0 200px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 20px;
  transition: all 0.3s ease;
}

.category-box:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transform: translateY(-5px);
}

.category-box a {
  text-decoration: none;
  color: #333;
}

/* Topic Navigation */
.topic-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.prev-topic,
.next-topic {
  background: #f9f9f9;
  padding: 10px 15px;
  border-radius: 4px;
}

.prev-topic a,
.next-topic a {
  text-decoration: none;
  color: #2f8d46;
}

/* Sidebar Styling */
.course-sidebar {
  flex: 1;
  background: #f5f5f5;
  padding: 20px;
  border-radius: 5px;
}

.topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.topic-list li {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.topic-list a {
  text-decoration: none;
  color: #333;
}

.current-topic {
  font-weight: bold;
}

.current-topic a {
  color: #2f8d46;
}

/* Course Archive */
.course-archive {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.course-intro {
  background: #f5f5f5;
  padding: 20px;
  border-radius: 5px;
  margin-bottom: 30px;
}

.course-topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.course-topic {
  background: white;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 20px;
  transition: all 0.3s ease;
}

.course-topic:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.course-topic a {
  text-decoration: none;
  color: #333;
}

/* Sliding Sidebar Styles */
.sliding-sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    background: #f5f5f5;
    overflow-y: auto;
    transition: left 0.3s ease;
    z-index: 1000;
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
}

.sliding-sidebar.open {
    left: 0;
}

.sidebar-toggle {
    background: #2f8d46;
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 16px;
    margin-bottom: 20px;
    display: block;
    width: auto;
}

.sidebar-close {
    background: #ddd;
    border: none;
    padding: 10px;
    width: 100%;
    text-align: right;
    cursor: pointer;
    font-size: 18px;
}

body.sidebar-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sliding-sidebar {
        width: 250px;
        left: -250px;
    }
    
    .topics-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .category-boxes {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .site-content {
        padding: 10px;
    }
    
    .search-field {
        width: 100%;
    }
    
    .topic-card {
        height: auto;
    }
    
    .topic-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .sidebar-toggle {
        width: 100%;
    }

    .menu-toggle {
        display: block;
    }

    .main-navigation ul#primary-menu {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        max-width: 300px;
        height: 100vh;
        background: #265f33;
        transition: right 0.3s ease;
        z-index: 1000;
        padding-top: 60px;
    }

    .main-navigation ul#primary-menu.toggled {
        display: flex;
        right: 0;
    }

    .main-navigation li {
        width: 100%;
        padding: 15px 20px;
    }

    .main-navigation ul ul {
        position: static;
        display: none;
        width: 100%;
        box-shadow: none;
        padding-left: 15px;
        background: #1e4b28;
    }

    .main-navigation ul ul li {
        padding-left: 0;
    }

    .main-navigation ul li:hover > ul {
        display: none;
    }

    .main-navigation ul li.submenu-toggled > ul {
        display: block;
    }

    .dropdown-icon {
        float: right;
        cursor: pointer;
    }

    .site-title {
        font-size: 1.5em;
    }

    .site-logo img {
        max-height: 40px;
    }

    .header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .topics-grid {
        grid-template-columns: 1fr;
    }
    
    .category-box {
        min-width: 100%;
    }
    
    h1, h2, h3 {
        font-size: 1.2em;
    }
}

/* Laptop view adjustments (min-width: 1024px) */
@media (min-width: 1024px) {
    /* Wider content containers for course pages */
    .single-course .site-content,
    .tax-course_category .site-content,
    .archive-course .site-content {
        max-width: 90%;
    }

    /* Limit text width for readability while allowing wider layout */
    .course-text,
    .course-intro,
    .topic-excerpt,
    .post-content {
        max-width: 900px;
        margin: 0 auto;
    }

    /* Toggle button positioned just below header on left */
    .sidebar-toggle {
        position: fixed;
        left: 0;
        padding: 10px 15px;
        margin: 0;
        z-index: 1001;
        border-radius: 0 5px 5px 0;
    }

    body.sidebar-open .sidebar-toggle {
        display: none;
    }

    body.sidebar-open::before {
        display: none;
    }

    body.sidebar-open .course-container,
    body.sidebar-open .course-category-full,
    body.sidebar-open .course-archive,
    body.sidebar-open .site-content {
        padding-left: 300px;
        transition: padding-left 0.3s ease;
    }

    .sliding-sidebar {
        height: 100vh;
        overflow-y: auto;
        position: fixed;
        top: 0;
        left: -300px;
        transition: left 0.3s ease;
    }

    .sliding-sidebar.open {
        left: 0;
    }
}