
body {
  margin: 0;
  padding: 0;
  background: #f9f9f9;
  color: #333;
}

/*本一覧ページのCSS*/

.books-section {
  max-width: 1100px;
  padding: 90px 16px 0 16px;
  margin: 0 auto;
}

.books-section h2 {
  text-align: center;
  margin-bottom: 16px;
  font-size: 1.8em;
  color: #2c3e50;
}

.search-bar {
  text-align: center;
  margin-bottom: 0px auto;
}

#bookSearch {
  width: 100%;
  max-width: 500px;
  padding: 10px 14px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
}



.books-grid {
  display: grid;
  padding: 40px 0 0 0;
  gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 2fr));
}

.book-card {
  background: #fff;
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  transition: transform 0.2s, box-shadow 0.2s;
}

.book-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.book-card img {
  width: 100%;
  height: auto;
  object-fit: cover;
  aspect-ratio: 3/4;
}

.info {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.title {
  font-weight: bold;
  margin: 0 0 4px;
  font-size: 1.1em;
  line-height: 1.2;
  color: #222;
}

.author {
  margin: 0 0 8px;
  font-size: 0.9em;
  color: #555;
}

.summary {
  flex: 1;
  margin: 0 0 12px;
  font-size: 0.9em;
  color: #444;
  line-height: 1.4;
}

.read-button {
  align-self: start;
  padding: 10px 18px;
  background-color: #3498db;
  color: white;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: background-color 0.2s, transform 0.1s;

   align-self: center;
    margin-top: auto; /* 下に張り付きつつ中央 */
}

.read-button:hover {
  background-color: #287bb5;
  transform: translateY(-1px);
}

.no-results {
  text-align: center;
  margin-top: 20px;
  font-size: 1rem;
  color: #888;
}


.filters {
  display: flex;
  flex-flow: column;
  gap: 16px;
  margin-bottom: 24px;
  justify-content: center;
  font-size: 0.9rem;
  margin: 0 auto;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 3px;
}
.filter-label {
  font-weight: bold;
  margin-right: 4px;
}
.filters input[type="text"] {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
  min-width: 220px;
}

/* PC版で検索グループを中央揃えに */
@media (min-width: 801px) {
  .filters {
    align-items: center; /* 全体を中央寄せの基準に */
  }

  .filter-group:first-child {
    width: 100%;
    display: flex;
    justify-content: center; /* 検索欄を横中央に */
    gap: 8px;
  }

  .filter-group:first-child input[type="text"] {
    max-width: 400px; /* 伸びすぎ防止 */
    width: 100%;
  }
}


/*検索ボタン*/
.search-button {
  padding: 8px 14px;
  margin-left: 6px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.2s;
}
.search-button:hover {
  background-color: #287bb5;
}



/*更新順などのボタン*/

.sort-controls {
  text-align: center;
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.sort-button {
  padding: 8px 16px;
  background: #555;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}
.sort-button:hover {
  background: #444;
}
.sort-button.active {
  background: #3478db;
}


/* ハイライト */
mark {
  background-color: #ffe58a;
  padding: 0 2px;
  border-radius: 2px;
}

/* 1) 本の表紙画像を 縦:横 = 3:2 にぴったり表示（中央トリミング） */
.book-card img {
  width: 100%;
  aspect-ratio: 2 / 3;      /* 高さ:幅 = 3:2 */
  object-fit: cover;        /* ボックスを完全に埋める → はみ出しは中央でトリミング */
  object-position: center;  /* トリミングの基準を中央に */
  display: block;           /* 余計な隙間防止 */
}

/* 2) スマホ時は 2 列表示に（今1列になっている指定を上書き） */
@media (max-width: 768px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr); /* 2等分で必ず2列 */
    gap: 16px;                              /* 余白はお好みで */
  }

  /* カード幅の最小制約がある場合に備えて保険（あれば外してOK） */
  .book-card { min-width: 0; }
}
