/*
Theme Name: Sam-Theme5
Description: A custom theme for CSE tutorial 
Author: Sam
Version: 5.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: 10px 0; /* Reduced padding for smaller height */
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-logo img {
  max-height: 40px; /* Smaller logo for reduced header height */
  width: auto;
  display: block;
}

.site-title {
  margin: 0;
  font-size: 1.5em; /* Smaller font size */
  font-weight: 600;
}

.site-title a {
  color: white;
  text-decoration: none;
  transition: color 0.3s ease;
}

.site-title a:hover {
  color: #e0e0e0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.search-form {
  display: flex;
  align-items: center;
  max-width: 300px;
}

.search-field {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px 0 0 4px;
  font-size: 14px;
  width: 100%;
}

.search-submit {
  background: #4caf50;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-size: 14px;
}

.search-submit:hover {
  background: #3d8b40;
}

.main-navigation {
  background: transparent;
}

.main-navigation ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
}

.main-navigation li {
  padding: 8px 12px; /* Smaller padding for compact nav */
  position: relative;
}

.main-navigation a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px; /* Smaller font size */
  transition: color 0.3s ease;
}

.main-navigation a:hover {
  color: #e0e0e0;
}

.main-navigation .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #265f33;
  min-width: 200px;
  z-index: 999;
  flex-direction: column;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
}

.main-navigation .sub-menu li {
  width: 100%;
  padding: 8px 12px;
}

.main-navigation li:hover > .sub-menu {
  display: block;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.1em;
  cursor: pointer;
  padding: 8px;
}

.hamburger-icon {
  display: block;
  width: 20px;
  height: 2px;
  background: white;
  position: relative;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 2px;
  background: white;
  left: 0;
}

.hamburger-icon::before {
  top: -6px;
}

.hamburger-icon::after {
  top: 6px;
}

.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;
  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;
  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;
}

.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.active {
    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-active::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%;
        max-width: 200px;
    }
    
    .search-submit {
        padding: 8px 10px;
    }
    
    .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: 12px 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.3em;
    }

    .site-logo img {
        max-height: 35px;
    }

    .header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .search-form {
        max-width: 100%;
    }
}

@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: 769px) */
@media (min-width: 769px) {
    /* Wider content containers for course pages */
    .single-course .site-content,
    .tax-course_category .site-content,
    .archive-course .site-content {
        max-width: calc(100% - 320px);
        margin-left: 320px;
    }

    /* Limit text width for readability while allowing wider layout */
    .course-text,
    .course-intro,
    .topic-excerpt,
    .post-content {
        max-width: 900px;
        margin: 0 auto;
    }

    /* Sidebar hidden by default, shown when active */
    .sliding-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        height: 100vh;
        overflow-y: auto;
        z-index: 999;
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    }

    .sliding-sidebar.active {
        display: block;
        left: 0;
    }

    .sidebar-toggle {
        display: none;
    }

    .sidebar-close {
        display: none;
    }

    body.sidebar-active::before {
        display: none;
    }

    /* Ensure content shifts right */
    .course-container,
    .course-category-full,
    .course-archive,
    .site-content {
        padding-left: 20px;
    }
}