@font-face {
  font-family: "Kanit";
  src: url(Kanit-Regular.ttf) format("truetype");
  font-weight: normal;
}

@font-face {
  font-family: "Kanit";
  src: url(Kanit-Bold.ttf) format("truetype");
  font-weight: bold;
}

html,
body {
  scroll-behavior: smooth;
  scroll-padding-top: 120px;
}

body {
  padding-top: 56px;
  background-color: #f7fac4 !important;
  font-family: "Kanit", sans-serif !important;
  font-weight: normal !important;
  color: rgb(0, 0, 0);
}

h1,
h2 {
  font-family: "Kanit", sans-serif !important;
  font-weight: bold !important;
}

.vcontainer {
  padding: 0px !important;
  margin: 0px !important;
  width: 100%;
  overflow-x: visible !important;
}

.pcontainer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  overflow: visible;
  width: 100%;
  height: 100%;
}

.bordercontainer {
  width: 100%;
  border: 15px solid #787960;
  padding: 50px;
  margin: 20px;
}

@media (max-width: 767px) {
  .bordercontainer {
    border: 8px solid #9a9b79;
    padding: 20px;
    margin: 10px;
  }
}

/* Consistent typography for all pages */
p {
  font-size: 20px !important;
}

ul {
  font-size: 20px !important;
}

ol {
  font-size: 20px !important;
}

h1 {
  font-size: 30px !important;
}

h2 {
  font-size: 30px !important;
}

.page {
  margin: 50px 0px 50px 0px !important;
}

.left {
  margin-right: 20px;
}

/* callout */
.bd-callout {
  padding: 1.25rem;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  border: 1px solid #e9ecef;
  border-left-width: 0.25rem;
  border-radius: 0.25rem;
}
.bd-callout h4 {
  margin-bottom: 0.25rem;
}
.bd-callout p:last-child {
  margin-bottom: 0;
}
.bd-callout code {
  border-radius: 0.25rem;
}
.bd-callout + .bd-callout {
  margin-top: -0.25rem;
}
.bd-callout-info {
  border-left-color: #5bc0de;
}
.bd-callout-warning {
  border-left-color: #f0ad4e;
}
.bd-callout-danger {
  border-left-color: #d9534f;
}

/* menu */
nav {
  background-color: #c0f281 !important;
}

.navbar-collapse {
  flex-grow: unset !important;
}

.navbar-nav {
  align-items: end;
}

/* Mobile navbar improvements */
@media (max-width: 767px) {
  .navbar-collapse {
    background-color: #c0f281 !important;
    border-radius: 0 0 10px 10px;
    padding: 10px;
    margin-top: 5px;
  }
  
  .navbar-nav {
    align-items: center !important;
  }
  
  .dropdown-menu {
    background-color: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(0, 0, 0, 0.1);
  }
}

.nav-item,
.navbar-brand {
  margin: 0px 10px 0px 10px;
  font-size: 1.5rem !important;
  font-weight: bold;
  color: rgba(0, 0, 0, 0.8) !important;
}

.nav-item:hover {
  color: rgba(0, 0, 0, 0.55) !important;
}

.nav-link {
  padding: 16px 0px 16px 0px;
  font-weight: 600;
}

.dropdown-menu {
  border-radius: 0px 0px 16px 16px;
}

/* progress */
#progress-bar {
  width: 0;
  height: 7px;
  background-color: #43542d;
  position: fixed;
  top: 93px; 
  z-index: 9;
}

/* Header */
header {
  background-color: #b6e47a;
  width: 100%;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.no {
  padding: 0px !important;
  margin: 0px !important;
}

/* page */
.page {
  display: flex;
  align-items: center;
  height: fit-content;
  margin-top: 30px;
  margin-bottom: 30px;
  max-height: 600px;
  overflow: visible;
}

.left {
  order: 1;
  width: 50%;
}

.right {
  order: 2;
  width: 50%;
}

.home_page_font {
  margin-top: 40em;
  margin-bottom: 40em;
}

.home_page_first_font {
  margin-bottom: 40em;
}

.home_page_second_font {
  margin-top: 168em;
  margin-bottom: 150em;
}

.home_page_third_font {
  display: flex;
  align-items: center;
  height: fit-content;
  margin-top: 30px;
  margin-bottom: 30px;
  max-height: 419px;
  overflow: visible;
}

.members {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.members_row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
}

.member_img {
  flex: 1 1 calc(33.333% - 10px); /* Each image takes up 1/3 of the container width, minus some spacing */
  max-width: calc(
    33.333% - 10px
  ); /* Ensures images do not exceed 1/3 of the container width */
  margin-bottom: 30px; /* Adds spacing between rows */
  object-fit: cover; /* Ensures images cover the allocated space without distortion */
  max-height: 419px; /* Ensures images do not exceed this height */
}

.w30 {
  width: 30% !important;
}
.w70 {
  width: 70% !important;
}
.w40 {
  width: 40% !important;
}
.w60 {
  width: 60% !important;
}
.w80 {
  width: 80% !important;
}

@media (max-width: 767px) {
  .page .home_page_third_font {
    flex-direction: column;
    text-align: center;
    max-height: none;
    overflow: hidden;
  }

  /* Mobile home page font adjustments */
  .home_page_font {
    margin-top: 2em !important;
    margin-bottom: 2em !important;
  }

  .home_page_second_font {
    margin-top: 2em !important;
    margin-bottom: 2em !important;
  }

  #progress-bar {
    width: 0;
    height: 5px;
    background-color: rgb(255, 115, 0);
    position: fixed;
    top: 90px;
    z-index: 999;
  }

  .rcontainer {
    width: 100% !important;
    margin-left: 0 !important;
    padding: 0 5px;
  }

  .member_img {
    flex: 1 1 90%; /* Each image takes up 1/3 of the container width, minus some spacing */
    max-width: 90%; /* Ensures images do not exceed 1/3 of the container width */
    margin-bottom: 30px; /* Adds spacing between rows */
    object-fit: cover; /* Ensures images cover the allocated space without distortion */
    max-height: 419px; /* Ensures images do not exceed this height */
  }

  /* Mobile sidebar fixes */
  .sidebar {
    width: 100% !important;
    position: relative !important;
    height: auto !important;
    top: 0 !important;
    margin-bottom: 20px;
    overflow-y: visible !important;
  }

  /* Mobile container layout fixes */
  .pcontainer {
    flex-direction: column !important;
    align-items: center !important;
  }

  /* Mobile width classes */
  .w30, .w40, .w60, .w70, .w80 {
    width: 100% !important;
  }

  /* Mobile navigation improvements */
  .navbar-nav {
    align-items: center !important;
  }

  .nav-item, .navbar-brand {
    font-size: 1.2rem !important;
    margin: 0px 5px 0px 5px;
  }

  /* Mobile dropdown improvements */
  .dropdown-menu {
    border-radius: 8px;
    margin-top: 5px;
  }

  /* Mobile page layout fixes */
  .page {
    flex-direction: column !important;
    max-height: none !important;
  }

  .left, .right {
    order: unset !important;
    width: 100% !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  /* Mobile font size adjustments */
  .sidebar a {
    font-size: 16px !important;
    font-weight: bold !important;
    padding: 12px 15px !important;
  }

  /* Mobile submenu improvements */
  .submenu {
    position: static !important;
    width: 80% !important;
    margin-top: 10px;
    background-color: rgba(255, 255, 255, 0.9) !important;
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out !important;
  }

  .submenu a {
    margin: 3px 0px !important;
    padding: 8px 15px !important;
    font-size: 14px !important;
    font-weight: bold !important;
    transition: all 0.3s ease !important;
  }

  /* Mobile submenu hover/active states */
  .sidebar li:active > .submenu,
  .sidebar li:hover > .submenu {
    max-height: 500px !important;
    opacity: 1 !important;
  }

  /* Mobile back-to-top button */
  #back-to-top {
    width: 50px;
    height: 50px;
    line-height: 50px;
    font-size: 12px;
    bottom: 15px;
    right: 15px;
  }

  /* Mobile header adjustments */
  header {
    padding: 20px 0 !important;
  }

  /* Mobile body padding adjustment */
  body {
    padding-top: 70px !important;
  }

  /* Mobile callout improvements */
  .bd-callout {
    padding: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
  }

  /* Mobile footer improvements */
  footer {
    padding: 20px 10px !important;
  }
}

/* Additional mobile breakpoint for very small screens */
@media (max-width: 480px) {
  .navbar-brand span {
    font-size: 1rem !important;
  }

  .nav-item, .navbar-brand {
    font-size: 1rem !important;
    margin: 0px 3px 0px 3px;
  }

  .sidebar a {
    font-size: 15px !important;
    font-weight: bold !important;
    padding: 10px 12px !important;
  }

  .bd-callout {
    padding: 0.75rem;
  }

  .page {
    margin-top: 15px;
    margin-bottom: 15px;
  }
}

/* Sidebar */
/* Sidebar container */
.sidebar {
  width: 18%;
  position: sticky; /* Ensures the sidebar sticks on scroll */
  height: calc(100vh - 120px); 
  background-color: transparent;
  border-radius: 20px;
  top: 120px; /* Sticks 120px from the top */
  overflow-y: auto;
  z-index: 5;
  align-self: flex-start; /* Ensures proper alignment in flex container */
}

/* Unordered list styling */
.sidebar ul {
  list-style-type: none; 
  padding: 0; 
  margin: 0; 
}

/* List item styling */
.sidebar li {
  position: relative; 
  padding: 5px; 
  width: auto;
}

/* Link styling */
.sidebar a {
  border: 2px solid rgb(79, 178, 94); 
  height: auto; 
  width: calc(100% - 20px); 
  margin: 10px;
  border-radius: 30px; 
  color: #43542d;
  text-align: center;
  font-family: "Kanit", sans-serif;
  font-size: min(1.5vw, 21px); 
  transition: width 0.5s, color 0.5s; 
  cursor: pointer; 
  text-decoration: none; 
  display: inline-block; 
  overflow-wrap: break-word; 
  white-space: normal; 
  background-image: url(https://static.igem.wiki/teams/5627/design/sidebar.webp);
  background-position: center
}

/* Hover effect for links */
.sidebar li:hover > a {
  background-color: #e9ffb880; 
}

/* Touch-friendly active states for mobile */
@media (hover: none) and (pointer: coarse) {
  .sidebar li:active > a {
    background-color: #e9ffb8b3;
  }
  
  .sidebar li:active > .submenu {
    display: block;
  }
}

/* Submenu styling */
.submenu {
  max-height: 0;
  overflow: hidden;
  list-style-type: none; 
  padding: 0;
  margin: 0;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  position: relative; 
  top: 0; 
  z-index: 10;
  max-width: 100%;
  transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
  opacity: 0;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  margin-top: 5px;
}

/* Show submenu on hover */
.sidebar li:hover > .submenu {
  max-height: 500px;
  opacity: 1;
}

/* Submenu item styling */
.submenu li {
  margin: 0;
  width: auto;
}

/* Submenu link styling */
.submenu a {
  display: block; 
  height: auto; 
  border: 2px solid rgb(79, 178, 94);
  margin: 3px 8px;
  padding: 8px 12px; 
  white-space: normal; 
  overflow-wrap: break-word;
  border-radius: 20px;
  color: #43542d;
  text-align: center;
  font-family: "Kanit", sans-serif;
  font-size: min(1.2vw, 16px);
  transition: all 0.3s ease;
  background-color: rgba(233, 255, 184, 0.3);
  text-decoration: none;
}

/* Submenu link hover effect */
.submenu a:hover {
  background-color: #e9ffb8cc;
  border-color: rgb(108, 161, 222);
  transform: translateY(-1px);
}

/* Optional scrollbar styling */
.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: rgb(108, 161, 222); 
  border-radius: 10px; 
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

/* Page */

.rcontainer {
  width: 74%;
  margin-left: 40px;
}

.rcontainer h1 {
  margin-bottom: 20px;
  margin-top: 20px;
}

.rcontainer p {
  margin-bottom: 30px;
}

/* footer */
footer {
  padding: 0px !important;
  display: flex;
  align-items: center;
  align-content: center;
  justify-content: center;
  justify-items: center;
  text-align: center;
  background-color: #b6e47a;
}

footer a {
  color: rgb(0, 0, 0) !important;
  text-decoration: none;
}
footer a:hover {
  color: rgb(88, 117, 245) !important;
  text-decoration: underline;
}

small {
  color: black !important;
}

/* project */
.xcontainer {
  width: 100%;
}

.xcontainer h2 {
  margin-bottom: 20px;
  margin-top: 20px;
}

.xcontainer p {
  margin-bottom: 30px;
}

/* back-to-top */

#back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: none; 
  width: 40px;
  height: 40px;
  background-color: #333;
  color: #c0f281;
  border-radius: 50%;
  text-align: center;
  line-height: 40px;
  cursor: pointer;
}

/* center the image */
.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 50%;
}

/* PDF embed responsive styling */
.pdf-embed {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 90%;
  max-width: 1000px;
  height: 600px;
  border: 2px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Mobile PDF embed improvements */
@media (max-width: 767px) {
  .pdf-embed {
    width: 100% !important;
    max-width: 100% !important;
    height: 500px;
    margin: 20px 0;
    border-radius: 4px;
    min-width: 0;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .pdf-embed {
    width: 100% !important;
    max-width: 100% !important;
    height: 400px;
    margin: 15px 0;
    min-width: 0;
  }
}

/* Mobile-friendly PDF container */
.pdf-container {
  text-align: center;
  margin: 20px 0;
}

.pdf-container a {
  display: inline-block;
  padding: 12px 24px;
  background-color: #1976d2;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-weight: bold;
  margin-bottom: 15px;
  transition: background-color 0.3s ease;
}

.pdf-container a:hover {
  background-color: #1565c0;
  color: white;
  text-decoration: none;
}

/* Hide iframe on mobile devices */
@media (max-width: 767px) {
  .desktop-pdf {
    display: none !important;
  }
  
  .pdf-container a {
    padding: 15px 30px;
    font-size: 18px;
  }
}

/* Show iframe on desktop */
@media (min-width: 768px) {
  .desktop-pdf {
    display: block !important;
  }
}