@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
  color: #3c3431;
}
html {
  height: 100%;
  scrollbar-color: #3c3431 transparent;
  scrollbar-width: thin;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}
body {
  min-height: 100%;
  background-color: #e1c391;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 30px 0;
  flex-direction: column;
  overflow-x: hidden;
  transition: all 0.3s;
}
body.modal-open {
  overflow: hidden;
}
.close-modal {
  outline: none !important;
  box-shadow: none !important;
}
.close-modal:focus {
  outline: none !important;
  box-shadow: none !important;
}
a {
  text-decoration: none;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #3c3431;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.container-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fdf4e3;
  border-radius: 16px;
  padding: 10px 40px 40px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: 60%;
  max-width: 1000px;
  min-width: 320px;
  height: 100%;
  min-height: 600px;
}
.container {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: #fdf4e3;
  border-radius: 16px;
  padding: 60px 40px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: auto;
  max-width: 100%;
  min-width: 450px;
}
.container-index {
  text-align: center;
}
.index-text {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.index-p,
.login-register-text p {
  font-weight: 500;
  color: rgba(60, 52, 49, 0.7);
}
.login-register-text {
  margin-top: 60px;
  text-align: center;
}
.login-register-text a {
  color: #3c3431;
  font-weight: 600;
}
.login-text {
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
}
.input-group {
  margin-bottom: 20px;
}
.input-group input {
  width: 100%;
  padding: 10px 30px;
  border-radius: 12px;
  border: 2px solid rgba(60, 52, 49, 0.3);
  background-color: #fdf4e3;
  outline: none;
  font-size: 1rem;
  text-align: left;
}
.input-group input:focus {
  border-color: #3c3431;
}
.btn,
.btn-profile {
  display: inline-block;
  width: auto;
  padding: 12px 24px;
  background: #3c3431;
  color: #fdf4e3;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  cursor: pointer;
  margin: 5px;
  transition: 0.3s;
  text-align: center;
}
.btn:hover,
.btn-profile:hover {
  background: #2c2724;
}
.profile-info {
  text-align: center;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 90px;
  flex-wrap: wrap;
}
header .logo {
  font-weight: 700;
  font-size: 2rem;
}
.nav-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
}
.nav-links a {
  text-decoration: none;
  color: #3c3431;
  font-weight: 500;
  transition: opacity 0.3s;
}
.nav-links a:hover {
  opacity: 0.7;
}
.search-title {
  margin-top: 60px;
  margin-bottom: 20px;
}
.search-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin-bottom: 40px;
}
#search-box {
  background: #fdf4e3;
  width: 100%;
  padding: 12px 45px 12px 15px;
  border-radius: 25px;
  border: 2px solid #3c3431;
  font-size: 1rem;
  outline: none;
}
#search-box:focus {
  border-color: #2c2724;
}
.search-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  cursor: pointer;
  fill: none;
  stroke: #3c3431;
  stroke-width: 2;
  transition: opacity 0.3s;
}
.search-icon:hover {
  opacity: 0.7;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
input[type="search"]::-ms-clear,
input[type="search"]::-ms-reveal {
  display: none;
  width: 0;
  height: 0;
}

.book-list {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
}
.book-card {
  border-radius: 16px;
  flex: 0 0 280px;
  max-width: 280px;
  min-width: 240px;
  height: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  transition: transform 0.3s;
  padding: 18px;
  gap: 12px;
}
.book-card:hover {
  transform: translateY(-5px);
}
.book-card .img-wrap {
  flex: 1 1 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.book-card img {
  width: 170px;
  height: 230px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
}
.img-wrap {
  border-radius: 12px;
}
.book-info {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  width: 100%;
  padding: 18px;
  gap: 8px;
}
.book-info .title,
.book-info h3,
.book-info h2 {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.6rem;
}
.book-info .author,
.book-info p.author,
.book-info .byline {
  font-size: 0.95rem;
  color: rgba(60, 52, 49, 0.75);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1.4rem;
}
.book-info p {
  font-size: 0.95rem;
  color: rgba(60, 52, 49, 0.75);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
  justify-content: center;
  width: 100%;
  padding-top: 8px;
}
.book-card .btn {
  width: fit-content;
  padding: 8px 14px;
  font-size: 0.95rem;
}
.book-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}
.modal-content {
  background: #fdf4e3;
  border-radius: 16px;
  padding: 28px;
  width: 50%;
  max-height: 90vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  text-align: left;
  padding: 60px 20px 40px;
}
.modal-inner {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}
.modal-inner img,
.modal-content img {
  max-width: 42%;
  width: 100%;
  height: auto;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  max-height: 68vh;
}
.modal-details {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
  line-height: 1.6;
  font-size: 1rem;
  max-height: 68vh;
  overflow-y: auto;
  padding-right: 8px;
  -webkit-overflow-scrolling: touch;
}
.modal-details .title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.15;
}
.modal-details .meta {
  font-weight: 600;
  color: rgba(60, 52, 49, 0.85);
}
.modal-details p,
.modal-details .description {
  text-align: justify;
  margin: 0;
}
.modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.close-modal {
  position: absolute;
  top: 12px;
  right: 28px;
  font-size: 1.6rem;
  cursor: pointer;
  font-weight: bold;
  background: transparent;
  border: none;
  color: #3c3431;
  padding: 0;
  line-height: 1;
}
.close-modal:focus {
  outline: 2px solid rgba(60, 52, 49, 0.12);
  border-radius: 4px;
}
.confirm-modal {
  position: fixed;
  left: 50%;
  top: 20%;
  transform: translateX(-50%);
  background: #fdf4e3;
  color: #3c3431;
  border-radius: 10px;
  padding: 12px 18px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  z-index: 1200;
  min-width: 220px;
  text-align: center;
  font-weight: 600;
}
@media (max-width: 1024px) {
  .book-card {
    flex: 0 0 240px;
    max-width: 240px;
    height: 440px;
  }
  .book-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .container-home {
    width: 75%;
    padding: 50px 18px;
  }
  .modal-content {
    max-width: 860px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .modal-content::-webkit-scrollbar {
    display: none;
  }
  .modal-inner img {
    max-width: 40%;
    max-height: 64vh;
  }
  .modal-details {
    max-height: 64vh;
  }
}
@media (max-width: 768px) {
  .book-card {
    flex: 1 1 100%;
    max-width: 420px;
    min-width: 200px;
    height: auto;
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
  }
  .book-card img {
    width: 110px;
    height: 150px;
    flex-shrink: 0;
    object-fit: cover;
  }
  .book-info {
    text-align: left;
    align-items: flex-start;
    padding-left: 0;
    flex: 1 1 auto;
  }
  .book-info .title {
    -webkit-line-clamp: 3;
    line-clamp: 3;
    min-height: 3.6rem;
  }
  .book-card .btn {
    align-self: flex-end;
    margin-top: 8px;
  }
  .search-container {
    max-width: 100%;
  }
  header {
    flex-direction: column;
    gap: 10px;
    align-items: center;
  }
  .nav-links {
    flex-direction: column;
    gap: 10px;
  }
  .container-home {
    width: 90%;
    max-width: 450px;
    padding: 40px 15px;
  }
  .container {
    display: flex;
    width: calc(100% - 40px);
    max-width: 720px;
    min-width: auto;
    padding: 20px;
  }
  .modal-inner {
    flex-direction: column;
  }
  .modal-inner img,
  .modal-content img {
    max-width: 100%;
    width: 100%;
  }
  .modal-details {
    max-height: none;
    overflow: visible;
    padding-top: 10px;
  }
}
.modal-details {
  padding-right: 22px;
}
.modal-details::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.modal-details::-webkit-scrollbar-track {
  background: transparent;
}
.modal-details::-webkit-scrollbar-thumb {
  background: #3c3431;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.modal-details::-webkit-scrollbar-button,
.modal-details::-webkit-scrollbar-corner {
  display: none;
}
.modal-details {
  scrollbar-width: thin;
  scrollbar-color: #3c3431 transparent;
}
.close-modal {
  right: 28px;
}
.book-actions .btn {
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1rem;
  margin: 0;
}
.book-actions {
  justify-content: center;
  gap: 10px;
  padding-top: 6px;
}
::placeholder {
  color: #7a7068;
  opacity: 0.75;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.number-spinner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.number-spinner input[type="number"] {
  padding-right: 36px;
  width: 100%;
}
.number-spinner .spinner-controls {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.spinner-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 6px;
  color: #3c3431;
  background: #fdf4e3;
  border: none;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  padding: 0;
}
.spinner-btn:active {
  transform: translateY(1px);
}
.spinner-btn:focus {
  outline: 2px solid rgba(60, 52, 49, 0.12);
}
.rating-stars {
  display: flex;
  gap: 8px;
  font-size: 28px;
  cursor: pointer;
  user-select: none;
}
.rating-stars .star {
  color: rgba(0, 0, 0, 0.14);
  transition: color 0.12s;
}
.rating-stars .star.active {
  color: #2c2724;
}
.rating-textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  border-radius: 10px;
  padding: 10px;
  border: 2px solid rgba(60, 52, 49, 0.16);
  font-family: inherit;
  background: #fdf4e3;
}
.rating-textarea:focus {
  border-color: #3c3431;
  outline: none;
}
.rating-actions .btn {
  padding: 10px 18px;
}
.hamburger {
  display: none;
  font-size: 28px;
  cursor: pointer;
}
.btn-group {
  margin-top: 30px;
}
@media (max-width: 768px) {
  body {
    justify-content: center;
  }
  .modal-details {
    max-height: none;
    overflow: visible;
    padding-top: 10px;
    padding-right: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    text-align: center;
    justify-content: center;
  }
  .rating-stars {
    justify-content: center;
  }
  .modal-details::-webkit-scrollbar {
    display: none;
  }
  .close-modal {
    right: 18px;
  }
  .nav {
    flex-direction: column;
    align-items: center;
  }
  .hamburger {
    display: block;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
  }
  .nav-links.active {
    display: flex;
  }
}
@media (max-width: 480px) {
  .btn,
  .btn-profile {
    width: 100%;
  }
  .container-home {
    padding: 40px 15px;
  }
  .modal-content {
    width: 100%;
  }
  .container {
    padding: 40px 15px;
  }
  .index-text {
    margin-bottom: 30px;
  }
  .book-card {
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
  }
  .book-card img {
    width: 140px;
    height: 190px;
  }
  .book-info {
    text-align: center;
    align-items: center;
  }
  .search-title {
    margin-top: -30px;
    margin-bottom: 30px;
    text-align: center;
  }
}
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  bottom: 12px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  z-index: 10001;
  opacity: 0;
  transition: opacity 220ms, transform 220ms;
  pointer-events: none;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px;
}
.spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 6px solid rgba(60, 52, 49, 0.12);
  border-top-color: #3c3431;
  animation: spin 1s linear infinite;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
.spinner-text {
  font-size: 14px;
  color: rgba(60, 52, 49, 0.8);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#list-output p.loading {
  font-style: italic;
  color: #666;
  text-align: center;
  padding: 12px 0;
}
