@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@300;400;500;600;700&display=swap');

/* New styles for the randomly colored UGC category tags */
#ugc-category-list li.color-1 {
  background-color: #4BBDFF;
}

#ugc-category-list li.color-2 {
  background-color: #72CAF8;
}

#ugc-category-list li.color-3 {
  background-color: #ECC0FB;
}

html,
body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  font-family: 'IBM Plex Sans Thai', sans-serif;
  font-size: 16px;
}

.page-wrapper {
  overflow-x: hidden;
}

.navbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  position: sticky;
  /* This makes the navbar stick */
  top: 0;
  /* This positions it at the very top */
  z-index: 1000;
  /* This ensures it stays on top of other content */

  /* --- Glassmorphism Effect with Enhanced Shadow --- */
  background-color: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);

  /* 1. Enhanced the shadow for more depth and visibility */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);

  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.home-icon {
  height: 40px;
  cursor: pointer;
}

@media (max-width: 640px) {
  .home-icon {
    width: 140px;
  }
}

.nav-links {
  justify-content: space-between;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline: auto;
  width: 68%;
}

@media (max-width: 768px) {
  .nav-links {
    width: 100%;
  }
}

#profile-link,
#profile-link:visited,
#profile-link:hover,
#profile-link:active {
  display: flex;
  align-items: center;
  text-decoration: none !important;
  color: #242424;
  cursor: pointer;
  gap: 10px;
}

.profile-pic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
}

#username {
  font-weight: normal;
  color: #242424;
  text-decoration: none;
}

#signin-btn {
  background: #62c5ff;
  color: white;
  border: 1.5px solid #62c5ff;
  font-weight: normal;
  border-radius: 20px;
  padding: 3px 10px;
  cursor: pointer;
}

#signout-btn {
  background: none;
  color: #F37290;
  border: 1.5px solid #F37290;
  font-weight: normal;
  border-radius: 20px;
  padding: 3px 10px;
  cursor: pointer;
}

#admin-btn {
  background-color: #F2C54B;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  margin-left: auto;
}

/* =================================
   SWIPER BANNER STYLES
   ================================= */
.main-banner {
  width: 100%;
  height: 300px;
  margin: 0;
  /* Removed vertical margin for edge-to-edge */
}

@media (max-width: 640px) {
  .main-banner {
    height: 140px;
  }
}

.main-banner .swiper-slide {
  /* Removed scaling and opacity to make it full width */
  overflow: hidden;
}

.main-banner .swiper-slide-active {
  /* No special transform/opacity needed for the active slide anymore */
}

.main-banner .swiper-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.main-banner .swiper-button-next,
.main-banner .swiper-button-prev {
  color: #62c5ff;
}

.main-banner .swiper-pagination-bullet-active {
  background: #62c5ff;
}

h2 {
  display: flex;
  justify-content: space-between;
  text-align: left;
  font-weight: 600;
  color: black;
  margin-top: 0px;
  margin-bottom: 0px;
}

h3 {
  font-weight: bold;
  color: #242424;
  margin-top: 20px;
  margin-bottom: -5px;
  padding: 20px
}

.category-nav {
  /* padding: 20px 0 0 0; */
  margin-inline: auto;
  width: 68%;
}

@media (max-width: 768px) {
  .category-nav {
    width: 97%;
  }
}

#ugc-category-nav {
  border-radius: 10px;
  background-color: #D9E6EF;
}

#ugc-category-list {
  padding-bottom: 12px;
}

hr {
  margin-inline: auto;
  width: 67%;
  background-color: #62a7ff;
}

@media (max-width: 768px) {
  hr {
    width: 80%;
  }
}

.category-nav ul {
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  list-style: none;
  display: flex;
  gap: 5px;
  margin: 0;
  padding-left: 10px;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.category-nav ul::-webkit-scrollbar {
  display: none;
}

.category-nav li {
  justify-content: center;
  cursor: pointer;
  margin: 0;
  padding: 3px 10px;
  border-radius: 20px;
  background-color: #c4ddf8;
  color: white;
  transition: background 0.3s ease;
}

.category-nav li:hover,
.category-nav li.active {
  background: #62a7ff;
  color: #fff;
}

/* Container for articles */

#articles-container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 20px;
  margin-inline: auto;
  width: 67%;
}

@media (max-width: 768px) {
  #articles-container {
    width: auto;
  }
}

.article-item {
  padding: 8px;
  box-shadow: 4px;
  border-radius: 10px;
  overflow: hidden;
  object-position: center;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.article-item img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
  border-radius: 5px;
}

@media (max-width: 767px) {
  .article-item img {
    border-radius: 5px;
    height: 160px;
  }
}

.article-item .content {
  padding: 10px;
  flex: 1;
  max-width: 100%;
}

.article-item h2 {
  font-size: 16px;
  margin: 6px 0 0 0;
  color: #242424;
  text-align: left;
  font-weight: bold;
  max-width: 100%;
}

.article-item h1 {
  font-size: 18px;
  margin: 0 0 0 0;
  color: #242424;
  text-align: left;
  font-weight: bold;
  max-width: 100%;
}

.article-item p {
  font-size: 14px;
  margin: 0 0 0 0;
  line-height: 1.4;
  color: #555;
  max-width: 100%;
}

.article-item a {
  display: block;
  text-align: right;
  text-decoration: none;
  color: #62c5ff;
  font-style: italic;
  font-size: 13px;
  margin-top: 0px;
}



.tag-container span {
  display: inline-block;
  background: #4bbdff;
  color: white;
  padding: 3px 10px;
  margin: 0 0 0 0;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.3s;
  font-size: 10px;
}

@media (max-width: 1024px) {
  #articles-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #articles-container {
    grid-template-columns: 1fr;
  }
}

.view-more-link{
  text-decoration: none;
  color: #000;
}

/* Footer */
.footer {
  background-color: white;
  color: #242424;
  text-align: center;
  padding: 20px 0;
  margin-top: 0;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
}

.footer p {
  font-size: 14px;
  margin-bottom: 0px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 5px 0 0 0;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.footer-links li {
  display: inline;
}

.footer-links a {
  color: #62c5ff;
  text-decoration: underline;
  font-size: 14px;
  transition: color 0.3s ease-in-out;
}

.footer-links a:hover {
  color: #129eef;
}

.loader {
  width: 50px;
  --b: 8px;
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 1px;
  background: conic-gradient(#0000 10%, #62c5ff) content-box;
  -webkit-mask:
    repeating-conic-gradient(#0000 0deg, #000 1deg 20deg, #0000 21deg 36deg),
    radial-gradient(farthest-side, #0000 calc(100% - var(--b) - 1px), #000 calc(100% - var(--b)));
  -webkit-mask-composite: destination-in;
  mask-composite: intersect;
  animation: l4 1s infinite steps(10);
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-top: 100px;
}

@keyframes l4 {
  to {
    transform: rotate(1turn)
  }
}

/*------------------
section class novel
------------------*/
.novel {
  position: relative;
  background: #fff;
  margin-top: 0px;
  margin-inline: auto;
  width: 68%;

  /* Consistent padding with extra space on the right for the button */
  padding: 20px 0 20px 0;
}

/* This media query should be separate if not using Sass/SCSS */
@media (max-width: 768px) {
  .novel {
    width: 90%;
    position: unset;
  }
}

.wrapper_h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.novel h2 {
  display: flex;
  justify-content: space-between;
  text-align: left;
  font-weight: 600;
  color: black;
  margin-top: 0px;
  margin-bottom: 0px;

}

.novel .ugc-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 10px 0;
  scroll-snap-type: x mandatory;
  cursor: grab;
  user-select: none;
}

.novel .ugc-scroll.active {
  cursor: grabbing;
  cursor: -webkit-grabbing;
}

/* Hides scrollbar for Firefox */
.novel .ugc-scroll {
  scrollbar-width: none;
  /* Hides scrollbar for IE, Edge */
  -ms-overflow-style: none;
}

/* Hides scrollbar for Chrome, Safari, and Opera */
.novel .ugc-scroll::-webkit-scrollbar {
  display: none;
}

.scroll-btn {
  position: absolute;
  top: 50%;
  right: -2%;
  transform: translateY(-50%);
  z-index: 10;
  background-color: rgba(255, 255, 255, 0.8);
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 24px;
  font-weight: bold;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: opacity 0.3s, transform 0.3s;
}

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

/* For screens 768px and smaller */
@media (max-width: 768px) {
  .scroll-btn {
    top: 68%;
    right: 3%;
  }
}

/* For screens 640px and smaller */
@media (max-width: 640px) {
  .scroll-btn {
    display: none;
  }

  .ugc-scroll .ugc-card {
    width: 118px;
  }

  .ugc-card-content .ugc-title {
    font-size: 12px;
  }

  .ugc-card-content .ugc-author {
    font-size: 12px;
  }

  .ugc-card-content .ugc-views {
    font-size: 12px;
  }
}


.scroll-btn:hover {
  transform: translateY(-50%) scale(1.1);
}

/* A class to hide the button when it's not needed */
.scroll-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

.ugc-card {
  cursor: pointer;
  flex-shrink: 0;
  width: 240px;
  background: white;
  border-radius: 12px;
  overflow: hidden;
}


.ugc-card-image img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}


.ugc-card-content {
  padding: 0 10px 10px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
  gap: 2px;
  background: white;
}

.ugc-title {
  margin-top: 0;
  padding: 0px;
  font-size: 16px;
  font-weight: bold;
  text-align: left;
  color: #333;
  word-break: break-word;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ugc-footer {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 14px;
  color: #777;
}

/* Styling for the new Top Novels section */
.top-novel .ugc-card-image {
  position: relative;
  /* This is necessary to position the rank inside */
}

.ugc-rank-container {
  position: absolute;
  margin-bottom: 9px;
  bottom: 0px;
  left: 0px;
  top: 4px;
  display: flex;
  align-items: flex-end;
  /* Aligns the box and number to the bottom edge */
  pointer-events: none;
  /* Allows clicks to go through to the card */
}

.ugc-rank-box {
  border-radius: 0 12px 0 12px;
  width: 40px;
  height: 47px;
  background-color: #4BBDFF;
  /* A strong blue */
}

.ugc-rank-number {
  position: absolute;
  font-weight: 900;
  font-size: 72px;
  color: white;
  -webkit-text-stroke: 2px #4BBDFF;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  margin-left: 12px;
  line-height: 0.6;
}


a:has(.ugc-card),
a:has(.ugc-card):hover {
  color: inherit;
  text-decoration: none;
}



.ugc-author {
  font-size: 14px;
  color: #666;
}

.ugc-views {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: #999;
  gap: 4px;
  color: #62a7ff;
}

.ugc-card a {
  text-decoration: none !important;
  color: inherit;
}

.emoji {
  display: flex;


}

#profile-dropdown {
  position: relative;
  display: flex;
}

.profile-pic-trigger {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #ddd;
  object-fit: cover;
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 55px;
  background-color: white;
  min-width: 180px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 100;
  border-radius: 8px;
  overflow: hidden;
}

.dropdown-menu a,
.dropdown-menu button {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
  background-color: #f1f1f1;
}

.dropdown-menu.show {
  display: block;
}

.article-image-container {
  position: relative;
}

.view-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: #ffffffc2;
  color: black;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.view-count svg {
  width: 14px;
  height: 14px;
  color: #62a7ff;
}

.load-more-button {
  display: block;
  margin: 20px auto 40px;
  padding: 12px 30px;
  font-size: 16px;
  font-weight: 600;
  font-family: 'IBM Plex Sans Thai', sans-serif;
  color: #555;
  background-color: transparent;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.load-more-button:hover {
  background-color: #fafafa;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}