* {
  margin: 0;
  padding: 0;
}

:root {
  --ff-poppins: "Poppins", sans-serif;
  --ff-inter: "Inter", sans-serif;
  --ff-ibm-plex: "IBM Plex Sans", sans-serif;

  --white: #fff;
  --black: #000;
  --text-light: #d8b4fe;
  --text-dark: #374151;
  --ghost-white: #f9f9fb;
  --azure: #3f8dfd;
  --light-gray: #ecf3fe;
  --orange: #fd9c40;
  --btn-hover: #2576e8;
}

[dark-theme] {
  --ghost-white: #111827;
  --text-dark: #e5e7eb;
  --white: #1e293b;
}

body {
  background-color: var(--ghost-white);
  font-family: var(--ff-inter);
  transition: all 200ms ease-in-out;
}

body.h-100 {
  height: 100vh;
  overflow: hidden;
}

a {
  text-decoration: none;
  font-family: inherit;
  color: inherit;
}

li {
  list-style: none;
}

input,
textarea {
  outline: none;
  border: none;
}

button {
  background-color: transparent;
  outline: none;
  border: none;
}

.bx {
  pointer-events: none;
}

.msg-container {
  position: fixed;
  bottom: 0.5rem;
  left: 0;
  width: 100%;
}

.msg-container .container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.msg {
  gap: 0.5rem;
  background: var(--text-light);
  padding: 0.5rem;
  border-radius: 5px;
  transition: 150ms ease-in-out;
  display: flex;
  align-items: center;
  width: calc(100% - 2rem);
  max-width: 35rem;
  z-index: 13;
  user-select: none;
}

.visually-hidden {
  display: none;
}

.msg i {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background-color: var(--ghost-white);
  color: var(--text-dark);
  display: grid;
  place-content: center;
}

[dark-theme] .msg i {
  background-color: var(--text-dark);
  color: var(--black);
}

.msg span {
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.msg.show {
  transform: translateY(10px);
}

body::-webkit-scrollbar {
  width: 6px;
  height: 2px;
}

body::-webkit-scrollbar-track {
  background-color: var(--white);
}

body::-webkit-scrollbar-thumb {
  border: 3px solid var(--azure);
  background-color: var(--azure);
  border-radius: 50px;
}

.book-info .desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.p-1 {
  padding: 1rem;
}

.py-1 {
  padding: 1rem 0;
}

.px-1 {
  padding: 0 1rem;
}

.truncate {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tracking-tight {
  letter-spacing: -0.025em;
}

.container {
  padding-inline: 1rem;
  margin: 0 auto;
}

.title-sec {
  padding-block-start: 1rem;
  margin: 1rem;
}

[dark-theme] .title-sec .text h1 {
  text-shadow: 0 2px #000;
}

.title-sec .container {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: 200ms ease-in-out;
  background-color: var(--white);
  transition: 200ms ease-in-out;
  position: relative;
}

.theme-toggler {
  position: fixed;
  /* bottom: 1.5rem;
  left: 1rem; */
  top: 0.8rem;
  left: 0.8rem;
  display: flex;
  max-width: 3rem;
  overflow: hidden;
  box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
  border-radius: 50%;
  background-color: var(--white);
  z-index: 100;
}

.theme-toggler button {
  width: 3rem;
  height: 3rem;
  /* border-radius: 50%; */
  cursor: pointer;
  background-color: var(--white);
  flex-shrink: 0;
  transition: all 200ms ease-in-out;
}

.theme-toggler.dark button {
  transform: translateX(-100%);
}

[dark-theme] .theme-toggler button {
  box-shadow: none;
}

.theme-toggler button i {
  font-size: 1.7rem;
  color: var(--text-dark);
}

.bg-img {
  background-image: url("images/bg.png");
}

.title-text {
  font-family: var(--ff-poppins);
  color: var(--text-dark);
  font-size: 1.7rem;
  font-weight: 600;
  padding-block-start: 2rem;
}

[dark-theme] .title-text {
  color: #fff;
}

.search-box {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 7px;
  background-color: var(--white);
  box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
  transition: 200ms ease-in-out;
}

.search-box:is(:focus-visible, :focus-within) {
  border: 2px solid var(--azure);
}

.input-search {
  display: block;
  width: 100%;
  padding: 1.2rem 0;
  padding-inline-start: 2.5rem;
  border-radius: 7px;
  background-color: transparent;
  font-size: 1.2rem;
  font-family: var(--ff-inter);
  color: var(--text-dark);
}

.search-box i {
  position: absolute;
  top: 50%;
  left: 0.5rem;
  transform: translateY(-50%);
  color: var(--text-dark);
  font-size: 1.5rem;
}

/* categories */
.categories {
  padding: 1rem 0;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  max-height: 100vh;
  overflow-y: auto;
  background-color: var(--white);
  z-index: 100;
  box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
  transition: 200ms ease-in-out;
  transform: translateY(100%);
  opacity: 0;
  visibility: hidden;
}

.categories.category-show {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  /* bottom: 4.96875rem; */
  bottom: 11.5%;
}

.categories-list {
  display: flex;
  overflow-x: unset;
  overflow-y: auto;
  flex-direction: column;
  border-bottom: none;
  gap: 0.5rem;
  max-height: 67vh;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.category-item {
  padding: 1rem;
  font-weight: 500;
  color: var(--black);
  position: relative;
  cursor: pointer;
  transition: 150ms ease-in-out;
  border-radius: 5px;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}

.category-item:hover,
.category-item.active {
  background-color: var(--text-light);
}

.category-item.active {
  padding-left: 2.5rem;
}

.category-item.active::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background-color: var(--azure);
  display: block;
}

.category-item .has-click {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 101;
}

[dark-theme] .category-item {
  color: var(--text-light);
}

[dark-theme] .categories .category-item.active,
[dark-theme] .categories .category-item:hover {
  background-color: var(--ghost-white);
}

[dark-theme] .categories .category-item.active::before {
  background-color: var(--text-light);
}

[dark-theme] .category-item:hover,
[dark-theme] .category-item.active {
  background-color: var(--white);
  color: var(--text-light);
}

.filter-categories-mob {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 10vh;
  background-color: var(--white);
  box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
  user-select: none;
  padding: 0.5rem 0;
  z-index: 100;
}

.filter-categories-mob .container {
  gap: 0.5rem;
  height: 100%;
}

.filter-categories-mob .filter-btn {
  background-color: var(--text-light);
  width: calc(100% - 1rem);
  height: 100%;
  display: flex;
  /* justify-content: flex-start;
  align-items: center; */
  justify-content: space-between;
  align-items: center;
  padding-inline: 0.5rem;
  cursor: pointer;
  border-radius: 5px;
}

.filter-categories-mob .filter-btn .left {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.filter-categories-mob .filter-btn span {
  font-weight: 500;
}

.filter-sm-text {
  padding: 0.4rem 0.7rem;
  border-radius: 5px;
  background-color: var(--azure);
}

.filter-sm-text span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  text-overflow: ellipsis;
  max-width: 6rem;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--ff-poppins);
  color: var(--black);
}

[dark-theme] .filter-categories-mob .filter-btn {
  background-color: var(--ghost-white);
  color: var(--text-light);
}
.filter-categories-mob .filter-btn i {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: var(--light-gray);
  color: var(--text-dark);
  display: grid;
  place-content: center;
}

[dark-theme] .filter-categories-mob .filter-btn i {
  background-color: var(--white);
}

/* mobile categories */
/* .mobile-categories {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  max-height: 100vh;
  overflow-y: auto;
  background-color: var(--white);
  z-index: 100;
  box-shadow: rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px;
  box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
  display: none;
}

[dark-theme] .mobile-categories {
  background-color: var(--white);
}

.mobile-categories .categories-list {
  display: flex;
  overflow-x: unset;
  flex-direction: column;
  border-bottom: none;
  padding-top: 0.5rem;
  padding-right: 0;
  gap: 0.5rem;
}

.mobile-categories .categories-list li {
  padding: 1rem;
  padding-left: 2.5rem;
  font-weight: 500;
  color: var(--black);
  position: relative;
}

.mobile-categories .categories-list li:hover {
  background-color: var(--text-light);
}

.mobile-categories .categories-list li.active::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background-color: var(--azure);
}

.mobile-categories .categories-list li {
  display: none;
}

[dark-theme] .mobile-categories .categories-list li {
  color: var(--text-light);
}

[dark-theme] .mobile-categories .categories-list li.active,
[dark-theme] .mobile-categories .categories-list li:hover {
  background-color: var(--ghost-white);
}

[dark-theme] .mobile-categories .categories-list li.active::before {
  background-color: var(--text-light);
} */

/* books */
.books {
  padding-block-end: 6rem;
}

.books-list {
  display: flex;
  /* flex-direction: column; */
  /* grid-gap: 1.5rem; */
  gap: 3rem;
  padding: 2rem 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

/* .book {
  user-select: none;
  border-radius: 7px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  overflow: hidden;
  padding: 3px;
  background-color: yellow;
} */

.book {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 7px;
  padding: 3px;
  overflow: hidden;
  user-select: none;
  transition: 200ms ease-in-out;
  width: 300px;
}

[dark-theme] .book {
  /* border: none; */
  /* background-color: var(--white); */
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.book .book-image-container {
  position: relative;
  border-radius: 7px;
  overflow: hidden;
}

.book .image-overlay {
  isolation: isolate;
  position: absolute;
  bottom: 0;
  left: 0;
  width: calc(100% - 2rem);
  height: 10vh;
  padding: 0.5rem 1rem;
}

.book .image-overlay::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 0;
  width: 100%;
  height: 20vh;
  border-radius: 7px;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.25));
  z-index: -1;
}

.image-overlay .statistics {
  float: right;
}

.image-overlay .statistics .total-downloads i {
  color: var(--white);
}

.image-overlay .statistics .download-link i {
  color: var(--text-dark);
  font-size: 1.6rem;
  font-weight: 500;
}

.image-overlay .statistics .total-downloads .download-num {
  color: var(--white);
}

[dark-theme] .image-overlay .statistics .total-downloads i,
[dark-theme] .image-overlay .statistics .total-downloads .download-num,
[dark-theme] .image-overlay .statistics .download-link i {
  color: #fff;
}

.book .img-cover {
  width: 100%;
  overflow: hidden;
}

.book img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 7px;
}

.book-name {
  padding: 0.5rem 0.3rem;
  text-align: center;
}

.book-name h3 {
  font-size: 1.5rem;
  font-family: var(--ff-poppins);
  font-weight: 600;
  color: var(--text-dark);
  padding-bottom: 3px;
}

[dark-theme] .book-name h3 {
  color: #fff;
}

.statistics {
  padding: 0.4rem 0.3rem;
  display: flex;
  justify-content: space-between;
}

.statistics i {
  font-size: 1.2rem;
  color: var(--azure);
}

.statistics .total-downloads,
.statistics .download-link a {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2px;
}

.statistics .total-downloads {
  gap: 5px;
}

.total-downloads .download-num,
.statistics .download-link a {
  font-size: 1.1rem;
  font-family: var(--ff-inter);
  font-weight: 500;
}

.total-downloads .download-num {
  color: var(--black);
  font-size: 1rem;
}

[dark-theme] .total-downloads .download-num {
  color: #fff;
}

/* .statistics .download-link a {
  color: var(--azure);
} */

.download-link .download-btn {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--light-gray);
  font-size: 1.2rem;
  color: var(--white);
  box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
}

[dark-theme] .download-link .download-btn {
  background-color: var(--white);
}

.download-link .download-btn i {
  color: var(--white);
}

.no-data,
.container.loading {
  grid-column: 1/-1;
  width: 100%;
  color: var(--text-dark);
  font-size: 1.3rem;
  font-weight: 500;
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

[dark-theme] .no-data,
[dark-theme] .container.loading {
  color: var(--text-light);
}

@media (min-width: 575px) {
  .container {
    max-width: 480px;
    padding-inline: 0;
  }

  .theme-toggler {
    position: fixed;
    bottom: 1.5rem;
    left: 1rem;
    top: unset;
  }

  .categories {
    all: unset;
    /* padding: 2rem 0; */
    margin-top: 1rem;
  }

  .categories-list {
    all: unset;
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
  }

  .category-item {
    padding: 1rem;
  }

  .category-item.active {
    padding: 0;
    padding: 1rem;
  }

  .category-item.active::before {
    display: none;
  }

  [dark-theme] .categories .category-item.active,
  [dark-theme] .categories .category-item:hover {
    background-color: var(--white);
  }

  .filter-categories-mob {
    display: none;
  }

  .mobile-categories {
    display: none;
  }

  .books-list {
    /* display: grid;
    grid-template-columns: repeat(2, 1fr); */
  }

  .title-sec {
    padding-block-start: 0.5rem;
  }

  .title-sec .container {
    height: 35vh;
    padding-block-start: 0;
  }

  .title-text {
    font-size: 2rem;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }

  .books-list {
    /* display: grid;
    grid-template-columns: repeat(3, 1fr); */
    justify-content: flex-start;
  }

  .title-text {
    font-size: 2.5rem;
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }

  .title-text {
    font-size: 3rem;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1150px;
  }
}

@media (min-width: 1500px) {
  /* .books-list {
    grid-template-columns: repeat(4, 1fr);
  } */

  .title-text {
    font-size: 4rem;
  }
}

/* Skeleton Loader Styles */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

[dark-theme] .skeleton {
  background: linear-gradient(90deg, #2d3748 25%, #1a202c 50%, #2d3748 75%);
  background-size: 200% 100%;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Category Skeleton */
.category-skeleton {
  display: flex;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  margin-top: 1rem;
  overflow: hidden;
}

[dark-theme] .category-skeleton {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.category-skeleton-item {
  min-width: 120px;
  height: 48px;
  border-radius: 5px;
  flex-shrink: 0;
}

/* Book Skeleton */
.book-skeleton {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 7px;
  padding: 3px;
  overflow: hidden;
  width: 300px;
}

[dark-theme] .book-skeleton {
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.book-skeleton-image {
  width: 100%;
  height: 350px;
  border-radius: 7px;
}

.book-skeleton-title {
  margin: 0.5rem 0.3rem;
  height: 24px;
  border-radius: 4px;
}

/* Hide skeleton when content is loaded */
.skeleton-hidden {
  display: none;
}

/* Fade in animation for loaded content */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
