:root {
  --primary: #2c3e50;
  --accent: #e67e22;
  --bg: #fdfaf6;
  --text: #333;
}

body {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  background-color: var(--bg);
  color: var(--text);
}

header {
  background: white;
  padding: 20px 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: "Playfair Display", serif;
  font-size: 28px;
  font-weight: bold;
  color: var(--primary);
}

.logo span {
  color: var(--accent);
}

.search-bar input {
  padding: 10px 20px;
  border-radius: 25px;
  border: 1px solid #ddd;
  width: 300px;
}

.cart-btn {
  cursor: pointer;
  background: var(--primary);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  transition: 0.3s;
}

.cart-btn:hover {
  background: var(--accent);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 30px;
  padding: 50px 5%;
}

.book-card {
  background: white;
  padding: 20px;
  border-radius: 15px;
  text-align: center;
  transition: 0.3s;
  position: relative;
}

.book-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.book-card img {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 15px;
}

.price {
  font-size: 20px;
  font-weight: bold;
  margin: 15px 0;
  color: var(--primary);
}

button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  width: 100%;
}

/* Модалка кошика */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: white;
  margin: 10% auto;
  padding: 30px;
  width: 400px;
  border-radius: 20px;
  position: relative;
}

.close {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 28px;
  cursor: pointer;
}

.item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}

.checkout-btn {
  background: var(--accent);
  margin-top: 20px;
  font-size: 16px;
}

.book-card img {
  width: 100%;
  height: 350px; /* Фіксована висота */
  object-fit: cover; /* Картинка заповнює область без деформації */
  border-radius: 10px;
  margin-bottom: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.book-card img {
  width: 100%;
  height: 350px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  /* Заглушка, якщо фото не завантажиться */
  background: linear-gradient(45deg, #2c3e50, #4ca1af);
  position: relative;
}

/* Додамо текст на випадок відсутності фото */
.book-card img:after {
  content: "📖 Обкладинка";
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #e0e0e0;
  color: #666;
  font-size: 14px;
}
