/* Reset & dasar */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f7f9fc;
  color: #333;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background-color: #34495e;
  color: white;
  padding: 2rem 1rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

header h1 {
  font-size: 2.2rem;
  margin-bottom: 0.3rem;
}

header .subtitle {
  font-weight: 300;
  font-size: 1.1rem;
  color: #d1d9e6;
  margin-bottom: 1.5rem;
}

/* Form Pencarian */
.search-form {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.search-form .form-group {
  flex: 1 1 220px;
  min-width: 150px;
}

.search-form input[type="text"],
.search-form select {
  width: 100%;
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  border: 1.5px solid #ccc;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.search-form input[type="text"]:focus,
.search-form select:focus {
  border-color: #2980b9;
  outline: none;
  box-shadow: 0 0 6px rgba(41, 128, 185, 0.5);
}

.btn-primary {
  background-color: #2980b9;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
  flex-shrink: 0;
  min-width: 120px;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: #1f6391;
  outline: none;
}

/* Main container */
.container {
  flex-grow: 1;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Buku - Katalog Grid */
/* Fixed 4 kolom desktop */
.books {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

/* Card Buku */
.book-card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-card:hover,
.book-card:focus-within {
  transform: translateY(-6px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  outline: none;
}

/* Gambar buku */
.book-card img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 10px 10px 0 0;
  user-select: none;
  pointer-events: none;
}

.no-image {
  height: 300px;
  background-color: #dfe6e9;
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-style: italic;
  font-size: 1.1rem;
  user-select: none;
}

/* Judul */
.book-card h3 {
  font-size: 1.2rem;
  padding: 1rem;
  padding-bottom: 0.3rem;
  color: #2c3e50;
  flex-grow: 0;
}

/* Meta info */
.book-meta {
  padding: 0 1rem 1rem;
  flex-grow: 1;
  font-size: 0.9rem;
  color: #444;
  display: grid;
  grid-template-columns: auto 1fr;
  row-gap: 0.5rem;
  column-gap: 0.6rem;
  align-items: center;
}

.book-meta div {
  display: contents;
}

.book-meta .label {
  font-weight: 700;
  color: #2c3e50;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.book-meta span.value {
  font-weight: 500;
  color: #555;
  overflow-wrap: break-word;
}

.book-meta span.value.stok-low {
  color: #c0392b; /* merah stok rendah */
  font-weight: 700;
}

.book-meta span.value.stok-available {
  color: #27ae60; /* hijau stok cukup */
  font-weight: 600;
}


/* Tombol detail */
.btn-detail {
  margin: 0 1rem 1rem;
  padding: 0.5rem 0;
  background-color: #2980b9;
  color: white;
  font-weight: 600;
  text-align: center;
  border-radius: 6px;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.btn-detail:hover,
.btn-detail:focus {
  background-color: #1f6391;
  outline: none;
}

/* Pesan tidak ditemukan */
.not-found {
  text-align: center;
  font-size: 1.3rem;
  color: #888;
  padding: 3rem 1rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.page-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: #e4e6eb;
  color: #333;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  user-select: none;
  transition: background-color 0.3s ease;
}

.page-link:hover,
.page-link:focus {
  background-color: #2980b9;
  color: white;
  outline: none;
}

.page-link.active,
.page-link[aria-current="page"] {
  background-color: #2980b9;
  color: white;
  cursor: default;
}

/* Footer */
footer {
  background-color: #34495e;
  color: white;
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 900px) {
  .books {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  header h1 {
    font-size: 1.6rem;
  }
  header .subtitle {
    font-size: 1rem;
  }
  .search-form {
    flex-direction: column;
    max-width: 100%;
    gap: 0.75rem;
  }
  .search-form .form-group,
  .btn-primary {
    width: 100%;
    min-width: unset;
  }
  .books {
    grid-template-columns: 1fr;
  }
  .book-card img,
  .no-image {
    height: 220px;
  }
  .btn-detail {
    margin: 0 0 1rem 0;
  }
}
