/* =========================
   THEME VARIABLES
   ========================= */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #ffffff;
    --text-color: #020202;
    --card-bg: #f9f9f9;
    --border-color: #ddd;
    --input-bg: #ffffff;
    --input-text: #222;
    --link-color: #3273dc;
    --link-hover: #2758a1;
    --tag-bg: #f0f0f0;
    --label-color: #11161d;
    --neural-bg-color: #ffffff;
    --neural-color: #010914;
  }
}

[data-theme=dark],
.theme-dark {
  --bg-color: #121212;
  --text-color: #f1f1f1;
  --card-bg: #1e1e1e;
  --border-color: #333;
  --input-bg: #2a2a2a;
  --input-text: #f1f1f1;
  --link-color: #66b2ff;
  --link-hover: #99ccff;
  --tag-bg: #2f2f2f;
  --label-color: #f1f1f1;
  --neural-bg-color: #010a16;
  --neural-color: #ffffff;
}


/* =========================
   APPLY THEME VARIABLES
   ========================= */

/* Global */
html, body {
  background-color: var(--bg-color) !important;
  color: var(--text-color) !important;
}


body {
  overflow-x: hidden;
}

/* Smooth transition */
body, .navbar, .section, .card {
transition: background-color 0.2s ease, color 0.2s ease;
}


.navbar {
    background-color: var(--bg-color) !important;
    backdrop-filter: blur(8px);
}

.navbar-brand, #navMenu{
  background-color: var(--bg-color);  
}

.navbar-menu{
  background-color: var(--bg-color);
  color:var(--text-color);
}

.navbar-item, .navbar-link{
    background-color: var(--bg-color) !important;
    color:var(--text-color) !important;
}


.navbar-item a{
    background-color: var(--bg-color) !important;
    color:var(--text-color) !important;
}

.navbar-item:hover {
  background-color: var(--bg-color) !important;
  color: var(--text-color)!important;
}

.navbar-item a:hover{
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
}

.dropdown .navbar-dropdown, .navbar-item a{
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
}


/* Hide dropdown content by default on mobile */
@media screen and (max-width: 1023px) {
.navbar-item.has-dropdown .navbar-dropdown {
    display: none;
}
.navbar-item.has-dropdown.is-active .navbar-dropdown {
    display: block;
}
}

/* course scroll bar */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

#course-sections-wrapper{
    background:var(--bg-color) !important;
    border-top: 1px solid var(--text-color) !important;
    border-bottom: 1px solid var(--text-color) !important;
    margin-top:1px;
}

@media screen and (max-width: 768px) {
    #course-sections-wrapper {
    top:51px !important;
    }
}

#scrollLeft, #scrollRight{
    color: var(--text-color) !important;
    background: var(--bg-color) !important;    
}

.category-link {
color: var(--text-color) !important;
background: var(--bg-color) !important;
padding-top:0.4rem;
padding-bottom:0.4rem;
padding-left:0.2rem;
padding-right:0.2rem;
border-right:1px solid;
}

.category-link:hover {
background: var(--bg-color);
color: var(--text-color);
}

.category-link.active {
background: var(--bg-color);
color: var(--text-color);
font-weight: 600;
}


/* Bulma Section, Box, Card */
.section,
.box,
.card,
.article {
  background-color: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-color) !important;
  transition: background-color 0.3s, color 0.3s;
}

/* Texts */
.label,
.title,
.subtitle,
.content, th, td, strong {
  color: var(--text-color) !important;
}

pre, code {
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
}

pre{
  padding: 5px;
  border-radius: 3px;
  border:1px solid var(--border-color) !important;
}

.icon { 
    color: var(--text-color) !important;
}

/* Links */
a {
  color: var(--link-color) !important;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--link-hover) !important;
}

/*.button { */
/*  color: var(--text-color) !important;  */
/*}*/

strong{
    color: var(--text-color) !important;
}

/* Tags */
.tag {
  background-color: var(--tag-bg) !important;
  color: var(--text-color) !important;
}



/* Breadcrumb and Pagination */
.breadcrumb a,
.pagination-link {
  color: var(--link-color) !important;
}
.pagination-link.is-current {
  background-color: var(--link-color) !important;
  color: var(--text-color) !important;
}


.footer {
    position: relative;
    z-index: 3;
    background-color: var(--bg-color) !important;
}


/* Compact hero section */
.hero {
    background: radial-gradient(circle at center, var(--neural-bg-color) 0%, var(--neural-bg-color) 100%);
    /* background: radial-gradient(circle at center, #141414 0%, #0a0a0a 100%); */
    position: relative;
    overflow: hidden;
    height: 70vh; /* smaller than full height */
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top:51px;
}

@media screen and (max-width: 768px) {
    .hero {
    height: 60vh; /* slightly smaller for mobile */
    margin-top:40px;
    }
}

.hero .title span {
    color: #00d1b2;
}

/* Canvas neural background */
#neural-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: transparent;
}

.card, .box, .footer {
    background-color: var(--bg-color) !important;
    color:var(--text-color) !important;
}

.hero-body {
    position: relative;
    z-index: 2;
    padding-top: 5rem;
    padding-bottom: 5rem;
}

.signup-box {
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
  }

  .signup-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  }

/* Desktop Sticky Sidebar */
  @media screen and (min-width: 1024px) {
    .chapter-list {
        position: sticky;
        height: calc(100vh - 5rem);
        overflow-y: auto;
        border-right: 1px solid #ddd;
        background-color: var(--bg-color) !important;
        color: var(--text-color) !important;
    }
  }


  /* Mobile Styles */
  @media screen and (max-width: 1023px) {
    .section{
      margin-top: 0.5rem !important; /* smaller mt on mobile */
    }

    .chapter-toggle-wrapper {
      display: flex;
      justify-content: flex-end;
      margin-bottom: 1rem;
      position: relative;
      z-index: 100;
    }

    #chapterToggle {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
    }

    /* Mobile Chapter Dropdown */
    .chapter-list {
      position: absolute;
      left:5rem;
      top: 3rem;
      width: 80%;
      max-width: 320px;
      background: var(--bg-color);
      border-radius: 0.5rem;
      box-shadow: 0 5px 20px rgba(0,0,0,0.3);
      padding: 1rem;
      z-index: 2000;
      overflow-y: auto;
      display: none;
      max-height: 80vh;
      transition: all 0.3s ease;
    }

    .chapter-list.is-active {
      display: block;
      animation: fadeSlideIn 0.3s ease forwards;
      background: var(--bg-color);
    }

    @keyframes fadeSlideIn {
      0% { opacity: 0; transform: translateY(-10px); }
      100% { opacity: 1; transform: translateY(0); }
    }

    /* Background overlay */
    #overlay {
      display: none;
      position: fixed;
      right:0;
      inset: 0;
      background: rgba(0, 0, 0, 0.4);
      z-index: 1999;
    }

    #overlay.is-active {
      display: block;
    }
  }

  /* Active chapter link */
  #chapterLinks a.is-active {
    background: var(--bg-color);
    color: var(--text-color) !important;
    font-weight: 600;
  }

  .left-column {
      position: sticky;
      top: 0;
      height: 100vh; /* Lock to viewport height */
      overflow-y: auto; /* Independent vertical scroll */
      border-right: 1px solid #ddd;
      background: var(--bg-color);
      padding: 1rem;
    }

/* === BULMA STYLE OVERRIDES FOR DJANGO FORMS === */

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="number"],
form input[type="url"],
form input[type="tel"],
form select,
form textarea {
  width: 100%;
  border: 1px solid #dbdbdb;
  /*border-color: ;*/
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  font-size: 1rem;
  color: var(--text-color) !important;
  transition: all 0.2s ease;
  background-color: var(--bg-color) !important;
  box-sizing: border-box;
}

form input:focus,
form select:focus,
form textarea:focus {
  outline: none;
  border-color: #3273dc; /* Bulma primary color */
  box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25);
}

/* === LABELS === */
form label {
  font-weight: 600;
  margin-bottom: 5px;
  display: inline-block;
  color: var(--text-color) !important;
}

/* === CHECKBOXES === */
form input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.2);
}

/* === BUTTONS === */
form button[type="submit"],
form input[type="submit"] {
  color: var(--text-color) !important;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  font-weight: 500;
  width: 100%;
  transition: all 0.25s ease;
}

form button[type="submit"]:hover,
form input[type="submit"]:hover {
  background-color: var(--bg-color) !important;
  transform: scale(1.02);
}

/* === FIELD SPACING === */
form .field,
form p {
  margin-bottom: 1rem;
}

/* === ERROR STYLING === */
.errorlist {
  background-color: var(--bg-color) !important;
  color: #b91c1c;
  border-radius: 6px;
  padding: 0.6rem;
  margin-bottom: 1rem;
  list-style: none;
}

.errorlist li::before {
  content: "";
}
