/*---------------------------
       Global Variables
----------------------------*/
:root {
  --gradient-start: #6C63FF;
  --gradient-end: #4433FF;
  --dark-bg: #1c1c1c;
  --dark-text: #ddd;
  --light-bg: #fff;
  --light-text: #555;
  --footer-bg: #2e3a4e;
  --sidebar-width: 300px;
  --border-color: #ccc;
}

/*---------------------------
       Base & Layout
----------------------------*/
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: 'Roboto', sans-serif;
  transition: background 0.3s, color 0.3s;
  display: flex;
  flex-direction: column;
  padding-top: 60px; 
  padding-bottom: 40px;
}


body.light {
  background: var(--light-bg);
  color: var(--light-text);
}

body.dark {
  background: var(--dark-bg);
  color: var(--dark-text);
}

.wrapper {
  flex: 1;
}

/*---------------------------
       Top Navbar
----------------------------*/
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--footer-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}


.top-nav .logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: #fff;
  display: flex;
  align-items: center;
}

.top-nav .logo img {
  height: 40px;
  margin-right: 10px;
  vertical-align: middle;
}

.top-nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
}

.top-nav ul li .nav-btn {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  transition: background 0.3s, opacity 0.3s;
}

.top-nav ul li .nav-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  opacity: 0.9;
}

/* Mobile Navbar */
.navbar-toggle {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: #fff;
  cursor: pointer;
}

@media (max-width: 768px) {
  .top-nav ul {
    display: none;
    flex-direction: column;
    background-color: var(--footer-bg);
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    padding: 1.5rem;
    border-radius: 0;
    z-index: 999;
  }

  .top-nav ul.show {
    display: flex;
  }

  .top-nav ul li {
    margin: 1rem 0;
    text-align: center;
  }

  .navbar-toggle {
    display: block;
  }
}


/*---------------------------
       Hero Section with Background Image
----------------------------*/
.hero {
  position: relative;
  background: url("../images/backgroundr.jpg") center center / cover no-repeat;
  color: #fff;
  text-align: center;
  padding: 4rem 2rem;
  overflow: hidden;
  min-height: 40vh;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.7;
  z-index: 0;
}

.hero>* {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto;
}

/*---------------------------
       Lesson Wrapper & Sidebar
----------------------------*/
.lesson-wrapper {
  display: flex;
  min-height: calc(100vh - 80px);
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: #f0f0f0;
  border-right: 1px solid var(--border-color);
  padding: 1rem;
  transition: transform 0.3s ease;
}

body.dark .sidebar {
  background: #2c2c2c;
  border-color: #444;
}

.sidebar nav ul {
  list-style: none;
}

.sidebar nav ul li {
  margin: 0.5rem 0;
}

/* Responsive Sidebar for Mobile */
@media (max-width: 768px) {
  .lesson-wrapper {
    flex-direction: column;
  }

  .sidebar {
    position: absolute;
    top: 80px;
    left: 0;
    transform: translateX(-100%);
    z-index: 999;
  }

  .sidebar.show {
    transform: translateX(0);
  }
}

/*---------------------------
       Lesson Content (Slider)
----------------------------*/
.lesson-content {
  flex: 1;
  position: relative;
  padding: 1.5rem;
}

.slider-container {
  max-width: 1150px;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

body.dark .slider-container {
  border-color: #444;
}

.slider {
  display: flex;
  transition: transform 0.5s ease;
}

.slide {
  min-width: 100%;
  padding: 1rem;
  height: auto;
}

.slide h2 {
  margin-bottom: 0.5rem;
}

.slide p {
  margin-bottom: 1rem;
}

/* Function Sections */
.function-section {
  margin-bottom: 2rem;
}

.function-section h3 {
  margin-bottom: 0.5rem;
}

/* Code Blocks */
.slide pre {
  margin-top: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  max-width: 100%;
}

.slide pre code {
  display: block;
  white-space: pre;
}

/* Custom Highlight.js Styling */
.hljs {
  background: #2b2b2b !important;
  color: #f8f8f2 !important;
  padding: 1em;
  border-radius: 4px;
}

.hljs-comment,
.hljs-quote {
  color: #75715e;
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
  color: #f92672;
}

.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-template-variable,
.hljs-tag .hljs-attr {
  color: #ae81ff;
}

.hljs-string,
.hljs-doctag {
  color: #e6db74;
}

.hljs-title,
.hljs-section,
.hljs-selector-id {
  color: #a6e22e;
}

.hljs-type,
.hljs-class .hljs-title {
  color: #66d9ef;
}

.hljs-tag,
.hljs-name,
.hljs-attribute {
  color: #f8f8f2;
}

.hljs-regexp,
.hljs-link {
  color: #e6db74;
}

.hljs-symbol,
.hljs-bullet {
  color: #ae81ff;
}

.hljs-built_in,
.hljs-builtin-name {
  color: #66d9ef;
}

.hljs-meta {
  color: #f8f8f2;
  font-weight: bold;
}

.hljs-deletion {
  background: #f92672;
}

.hljs-addition {
  background: #a6e22e;
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: bold;
}

/*---------------------------
       Prev/Next Buttons
----------------------------*/
.slide-nav {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
}

.slide-nav button {
  background: #444;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.3s, opacity 0.3s;
}

.slide-nav button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.slide-nav button:hover:enabled {
  background: #666;
}

body.light .slide-nav button {
  background: #bbb;
  color: #333;
}

body.light .slide-nav button:hover:enabled {
  background: #999;
}

/*---------------------------
       Footer (Solid Background)
----------------------------*/
.footer-widget {
  background-color: var(--footer-bg);
  padding: 40px 20px;
  text-align: center;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-bottom: 20px;
}

/* Desktop: items side-by-side */
.footer-logo,
.footer-touch,
.footer-social {
  flex: 1;
  margin: 10px 0;
}

.footer-logo img {
  width: 80px;
  margin-bottom: 10px;
}

.footer-touch p {
  font-size: 16px;
  margin: 0;
}

.footer-touch a {
  color: #ffffff;
  text-decoration: underline;
  font-size: 18px;
}

.footer-social {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

.footer-social a {
  font-size: 25px;
  width: 60px;
  height: 60px;
  line-height: 64px;
  text-align: center;
  border-radius: 50%;
  margin: 10px 14px;
  color: #ffffff;
  background-color: transparent;
  transition: all 0.3s ease-out;
  text-decoration: none;
}

@media (max-width: 767px) {
  .footer-social a {
    width: 52px;
    height: 50px;
    line-height: 50px;
    font-size: 20px;
    margin: 10px 7px;
  }
}

/* Mobile: Stack footer items vertically */
@media (max-width: 767px) {
  .footer-content {
    flex-direction: column;
  }

  .footer-logo,
  .footer-touch,
  .footer-social {
    flex: 0;
    width: 100%;
    margin: 10px 0;
  }
}

.footer-social a:hover {
  transform: scale(1.2);
}

.footer-copyright {
  padding: 10px 0;
}

.footer-copyright p {
  color: #fff;
  font-size: 16px;
}

/*---------------------------
       Back-to-Top
----------------------------*/
.back-to-top {
  font-size: 20px;
  color: #fff;
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 50px;
  height: 50px;
  line-height: 46px;
  border-radius: 50%;
  border: 2px solid #586376;
  background-color: #152136;
  text-align: center;
  z-index: 99;
  transition: all 0.3s ease-out;
  display: none;
}

.back-to-top:hover {
  background-color: #754ef9;
  border-color: #754ef9;
}

/*---------------------------
       Light/Dark Toggle
----------------------------*/
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #bbb;
  color: #333;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  transition: background 0.3s;
}

.theme-toggle:hover {
  background: #999;
}

body.dark .theme-toggle {
  background: #444;
  color: #fff;
}

body.dark .theme-toggle:hover {
  background: #666;
}

/* Sidebar Toggle Button (positioned lower-left) */
.sidebar-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: #2e3a4e;
  color: #fff;
  border: none;
  font-size: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle:hover {
  background: #4e586a;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 250px;
  height: 100%;
  background: #2e3a4e;
  padding: 1rem;
  transform: translateX(-100%);
  /* hidden off-screen */
  transition: transform 0.3s ease;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
  z-index: 999;
}

.sidebar.show {
  transform: translateX(0);
}

/* Sidebar Nav */
.sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 80px 0 0 0;
}

.sidebar nav ul li {
  margin: 0.5rem 0;
}

.sidebar nav ul li a {
  display: block;
  text-decoration: none;
  padding: 0.5rem;
  border-radius: 4px;
  color: #fff;
  transition: background 0.3s, color 0.3s;
}

.sidebar nav ul li a:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar nav ul li a.active {
  background: rgba(255, 255, 255, 0.3);
}

.top-nav ul li .nav-btn.active {
  font-weight: bold;
}



.copy-btn {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: linear-gradient(90deg, #474343, #474343);
  /* New gradient colors */
  color: #f5f5f5;
  border: none;
  border-radius: 4px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.3s, transform 0.2s;
}

.copy-btn:hover {
  opacity: 1;
  transform: scale(1.04);
}

.sidebar ul li a.active {
  background-color: #2d3748;
  color: #90cdf4;
  font-weight: bold;
  border-left: 3px solid #63b3ed;
}



.btn1 {
  background: var(--gradient-start);
  color: #fff;
  padding: 0.5rem 1rem;
  text-decoration: none;
  border-radius: 20px;
  transition: background 0.3s;
}
.btn1:hover {
  background: #5a54d1;
}