/* ========== CSS Custom Properties ========== */
:root {
  --primary-color: #1a365d;
  --secondary-color: #fafafa;
  --accent-color: #f6ad55;
  --text-color: #2d3748;
  --text-light: #4a5568;
  --border-color: #e2e8f0;
  --white: #ffffff;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ========== Reset and Base Styles ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--secondary-color);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}


/* ========== Search Bar ========== */
.search-bar {
  width: 100%;
  max-width: 500px;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 1rem;
  margin: 2rem auto;
  display: block;
  transition: all 0.3s ease;
  background: var(--white);
  color: var(--text-color);
}

.search-bar:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(246, 173, 85, 0.1);
}

.search-bar::placeholder {
  color: var(--text-light);
}

/* ========== Page Header ========== */
.page-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, #2c5282 100%);
  color: var(--white);
  padding: 3rem 0;
  text-align: center;
  margin-bottom: 2rem;
}

.page-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-header p {
  font-size: 1.125rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

/* ========== Books Catalog ========== */
.books-catalog {
  padding: 2rem 0 4rem;
}

.books-catalog h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--primary-color);
}

/* ========== Books Grid ========== */
.books-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2rem;
  padding: 0;
  max-width: 1200px;
  margin: 0 auto;
}

/* ========== Book Card ========== */
.book-item {
  background: var(--white);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.book-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-color), #ed8936);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.book-item:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.book-item:hover::before {
  transform: scaleX(1);
}

/* ========== Book Image ========== */
.book-item img {
  width: 100%;
  max-width: 150px;
  height: 200px;
  object-fit: cover;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.book-item:hover img {
  transform: scale(1.05);
}

/* ========== Book Details ========== */
.book-details {
  text-align: center;
}

.book-author {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.book-name {
  display: block;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.4;
  transition: color 0.3s ease;
  font-style: italic;
}

.book-name:hover {
  color: var(--accent-color);
  text-decoration: none;
}

/* ========== Footer (Consistent with index.html) ========== */
footer {
  background: var(--primary-color);
  color: var(--white);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
}

.footer-content {
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.footer-links ul {
  list-style: none;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-links ul li a {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.footer-links ul li a:hover {
  color: var(--accent-color);
}

.footer-copyright {
  opacity: 0.8;
  font-size: 0.9rem;
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
  .header {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
  }

  .logo {
    font-size: 1.5rem;
  }

  .page-header h1 {
    font-size: 2rem;
  }

  .page-header p {
    font-size: 1rem;
  }

  .books-catalog h2 {
    font-size: 2rem;
  }

  .books-list {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    padding: 0 1rem;
  }

  .book-item {
    padding: 1.25rem;
  }

  .search-bar {
    max-width: 100%;
    margin: 1.5rem auto;
  }

  .footer-links ul {
    flex-direction: column;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }

  .page-header {
    padding: 2rem 0;
  }

  .page-header h1 {
    font-size: 1.75rem;
  }

  .books-catalog {
    padding: 1.5rem 0 3rem;
  }

  .books-catalog h2 {
    font-size: 1.75rem;
    margin-bottom: 2rem;
  }

  .books-list {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }

  .book-item {
    padding: 1rem;
  }

  .book-item img {
    height: 180px;
  }

  .book-author {
    font-size: 0.9rem;
  }

  .book-name {
    font-size: 0.85rem;
  }
}

/* ========== Animations ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.book-item {
  animation: fadeInUp 0.6s ease-out;
}

/* ========== Loading States ========== */
.book-item img {
  background: var(--border-color);
}

.book-item img:not([src]) {
  background: linear-gradient(90deg, var(--border-color) 25%, transparent 50%, var(--border-color) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ========== Utility Classes ========== */
.text-center {
  text-align: center;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-4 {
  margin-bottom: 2rem;
}

/* ========== Enhanced Hover Effects ========== */
.book-item {
  position: relative;
  overflow: hidden;
}

.book-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(246, 173, 85, 0.1), transparent);
  transition: left 0.5s ease;
}

.book-item:hover::after {
  left: 100%;
}

/* ========== Focus States for Accessibility ========== */
.book-item:focus-within {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.book-name:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
  border-radius: 0.25rem;
}
