:root {
  font-size: 16px;
  font-family: 'Open Sans';
  --text-primary: #b6b6b6;
  --text-secondary: #ececec;
  --bg-primary: #23232e;
  --bg-secondary: #141418;
  --transition-speed: 600ms;
}

/* ---------------------------------------------------- */
/* Body & Main Content */
/* ---------------------------------------------------- */

/* Scrollbar Style */
body::-webkit-scrollbar {
  width: 0.25rem;
}

body::-webkit-scrollbar-track {
  background: #1e1e24;
}

body::-webkit-scrollbar-thumb {
  background: #6649b8;
}

/* Content Area offset by Sidebar width */
main {
  margin-left: 16rem; /* กำหนดให้เนื้อหาหลักเริ่มหลัง Sidebar */
  padding: 1rem;
}

/* ---------------------------------------------------- */
/* Sidebar (Navbar) */
/* ---------------------------------------------------- */

.navbar {
  position: fixed;
  background-color: var(--bg-primary);
  transition: width 600ms ease;
}

.navbar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.nav-item {
  width: 100%;
}

.nav-item:last-child {
  margin-top: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  height: 5rem;
  color: var(--text-primary);
  text-decoration: none;
  filter: grayscale(100%) opacity(0.7);
  transition: var(--transition-speed);
}

.nav-link:hover {
  filter: grayscale(0%) opacity(1);
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.nav-link svg {
  width: 3rem;
  min-width: 3rem;
  margin: 0 1.5rem;
}

/* Icons */
.fa-primary {
  color: #ff7eee;
}

.fa-secondary {
  color: #df49a6;
}

.fa-primary,
.fa-secondary {
  transition: var(--transition-speed);
}

/* Logo */
.logo {
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  font-size: 1.5rem;
  letter-spacing: 0.3ch;
  width: 100%;
}

.logo svg {
  transform: rotate(0deg);
  transition: var(--transition-speed);
}

.logo-text {
  display: inline;
  position: absolute;
  left: 95px;
  transition: var(--transition-speed);
}

.navbar:hover .logo svg {
  transform: rotate(-180deg);
}

/* ---------------------------------------------------- */
/* Media Queries */
/* ---------------------------------------------------- */

/* Small screens (Mobile) */
@media only screen and (max-width: 600px) {
  .navbar-nav {
    flex-direction: row;
  }
  .mobile-text {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.2rem;
    text-align: center;
    color: white;
  }
  .nav-link {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: auto;
    padding: 0.5rem 0;
  }

  .nav-link svg {
    width: 2rem !important;
    height: 2rem !important;
    margin: 0 auto;
  }

  .link-text {
    display: block !important;
    margin: 0.3rem 0 0;
    font-size: 0.75rem;
    text-align: center;
    color: var(--text-primary);
  }

  .logo {
    display: none;
  }

  .navbar {
    bottom: 0;
    width: 100vw;
    height: 5rem;
    position: fixed;
    z-index: 1000;
    display: block;
    transition: top 0s;
  }

  main {
    margin: 0;
    /* ในโหมดมือถือ main ควรมี margin-bottom เท่ากับความสูงของ navbar เพื่อไม่ให้เนื้อหาถูกบัง */
    padding-bottom: 5rem; 
  }
}

/* Medium to Large screens (Tablet & Desktop Sidebar) */
@media only screen and (min-width: 600px) {
  /* กำหนดค่าเริ่มต้นสำหรับจอใหญ่กว่า 600px */
  .navbar {
    top: 0;
    height: 100vh;
  }
  
  /* แก้ไข Navbar width สำหรับจอขนาดกลาง */
  .navbar {
    width: 16rem; /* Navbar มีความกว้าง 16rem ในสถานะปกติ */
  }

  /* ตั้งค่า Body สำหรับจอใหญ่กว่า 600px - ลบ width: 88%; ออกไปเพื่อให้เต็มจอ */
  body {
    color: black;
    background-color: white;
    margin: 0;
    padding: 0;
    /* ไม่ต้องใส่ width: 100%; เพราะเป็นค่าเริ่มต้นอยู่แล้ว */
  }
}

/* Specific Large screens (Desktop) */
@media only screen and (min-width: 900px) {
    /* Navbar Hover Effects (สำหรับ Desktop/Sidebar) */
    .navbar:hover {
        width: 16rem;
    }

    .navbar:hover .link-text {
        display: inline;
    }

    .navbar:hover .logo svg {
        margin-left: 13rem;
    }

    .navbar:hover .logo-text {
        left: 20px;
    }
}


/* ---------------------------------------------------- */
/* Theme Classes */
/* ---------------------------------------------------- */

.dark {
  --text-primary: #b6b6b6;
  --text-secondary: #ececec;
  --bg-primary: #23232e;
  --bg-secondary: #141418;
}

.light {
  --text-primary: #1f1f1f;
  --text-secondary: #000000;
  --bg-primary: #ffffff;
  --bg-secondary: #e4e4e4;
}

.solar {
  --text-primary: #576e75;
  --text-secondary: #35535c;
  --bg-primary: #fdf6e3;
  --bg-secondary: #f5e5b8;
}

.theme-icon {
  display: none;
}

.dark #darkIcon {
  display: block;
}

.light #lightIcon {
  display: block;
}

.solar #solarIcon {
  display: block;
}