:root {
  --primary: #0f8b4f;
  --primary-light: #2ea66e;
  --primary-super-light: #e6f5ef;
  --text-dark: #2c3e50;
  --text-light: #7f8c8d;
  --background: #f4f7f6;
  --card-bg: #ffffff;
}

body {
  font-family: "Roboto", sans-serif;
  color: var(--text-dark);
  background-color: var(--background);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 10vh;
}

/* --- Header & Title --- */
header {
  text-align: center;
  padding: 3rem 1rem;
  background: linear-gradient(to right, #003332, #078f3e);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
}

.back-btn {
  position: absolute;
  top: 2rem;
  left: 2rem;
  font-size: 1.5rem;
  color: white;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.15);
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

@media (max-width: 600px) {
  .back-btn {
    top: 1rem;
    left: 1rem;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
  }
}

h1 {
  font-family: "Poppins", sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.5rem;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.author-name {
  font-style: italic;
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 0;
}

/* --- Main Layout --- */
.container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem;
  flex-grow: 1;
}

.main-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
}

@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
  .filter-sidebar {
    margin-bottom: 2rem;
  }
  .author-card {
    order: 3; 
  }
}

/* --- Sidebar & Filter --- */
.filter-sidebar {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  align-self: flex-start;
}

.sidebar-title {
  font-family: "Poppins", sans-serif;
  font-size: 1.5rem;
  color: var(--primary);
  margin-top: 0;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--primary-super-light);
  padding-bottom: 0.5rem;
}

.search-container {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-input {
  width: 75%;
  padding: 0.75rem 1rem;
  padding-left: 2.5rem;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 139, 79, 0.2);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

.filter-group {
  display: flex;
  flex-direction: column;
}

@media (max-width: 1024px) {
  .filter-sidebar {
    padding: 1rem;
  }
  .filter-group {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
  }
}

.filter-btn {
  background-color: transparent;
  color: var(--text-dark);
  border: 1px solid #ddd;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s ease;
  font-weight: 500;
}

.filter-btn:hover {
  background-color: var(--primary-super-light);
  border-color: var(--primary-light);
}

.filter-btn.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* --- Main Content --- */
.content-area {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

.book-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  list-style: none;
  padding: 0;
}

.book-item {
  display: flex;
  flex-direction: column;
  background-color: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.book-cover {
  width: 100%;
  height: 250px;
  background-color: #e0e0e0;
  border-bottom: 1px solid #f0f0f0;
  overflow: hidden;

  img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }
}

.book-details {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.book-title {
  font-family: "Poppins", sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.book-desc {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  flex-grow: 1; 
}

.book-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-top: 1rem;
}

.book-price {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--primary);
}

.book-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  font-weight: 500;
  border: 1px solid transparent;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 2px 6px rgba(15, 139, 79, 0.3);
}

.btn-primary:hover {
  background-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(15, 139, 79, 0.4);
}

.btn-outline {
  background-color: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background-color: var(--primary);
  color: white;
}

/* --- Author Card --- */
.author-card {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  text-align: center;
  align-self: flex-start;
}

.author-photo {
  width: 150px;
  height: 150px;
  background-color: #e0e0e0;
  border-radius: 50%;
  margin: 0 auto 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.author-photo img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  border-radius: 50%;
  display: block;
}

.author-bio {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.author-link {
  text-decoration: none;
}

/* --- Modal & Toast --- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1000;
}

.modal.is-visible {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: white;
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal.is-visible .modal-content {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-light);
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: var(--primary);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(100%);
  transition: all 0.3s ease-in-out;
  z-index: 1001;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Print Styles --- */
@media print {
  body {
    background-color: white;
    color: black;
  }
  .btn,
  .author-card .btn,
  .modal,
  .toast,
  .filter-sidebar {
    display: none;
  }
  .book-item {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
}

a {
  text-decoration: none;
  color: inherit;
  font-size: 15px;
}

/* Footer */
footer {
  background: linear-gradient(
    to right,
    #003332,
    #078f3e
  ); 
  color: white; 
  padding: 3rem 2rem 1.5rem;
  transition: background-color 0.3s ease;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.footer-col {
  padding-bottom: 1rem;
}

.footer-logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  color: white;
}

.footer-about {
  margin-bottom: 1rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

.footer-social {
  display: flex;
  gap: 0.8rem;
}

.footer-social a {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  transition: all 0.3s ease;
}

.footer-social a:hover {
  background-color: var(--primary-light);
  transform: translateY(-3px);
}

.footer-links h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: white;
}

.footer-links ul {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.footer-links a:hover {
  color: white;
  padding-left: 5px;
}

.newsletter h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: white;
}

.newsletter p {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.newsletter-form {
  display: flex;
}

.newsletter-input {
  flex: 1;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 4px 0 0 4px;
  font-family: inherit;
  font-size: 0.9rem;
  background-color: var(--background);
}

.newsletter-input:focus {
  outline: none;
}

.newsletter-btn {
  background-color: var(--primary-light);
  color: white;
  border: none;
  padding: 0 1rem;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.newsletter-btn:hover {
  background-color: var(--primary);
}

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.copyright {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
}

.footer-legal {
  display: flex;
  gap: 1rem;
}

.footer-legal a {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
  transition: all 0.3s ease;
}

.footer-legal a:hover {
  color: white;
}


/* Back to Top Button */
#backToTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: #0f8b4f; 
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: none; 
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 1000;
}

#backToTop:hover {
  background: #0b3a2a;
  transform: translateY(-3px);
}
#backToTop.show {
  display: flex; 
}