/* ===============================
   ブック詳細画面
================================ */
* {
  box-sizing: border-box;
}

body {
  background: #f5f8fb;
}

/* 全体レイアウト */
.book-detail-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;

  width: 100%;
  margin: 32px 0;
  padding: 0 24px 48px;

  box-sizing: border-box;
}

/* 左広告 */
.book-detail-ad {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  height: fit-content;
}

/* 広告枠 */
.ad-box {
  min-height: 600px;

  border: 2px dashed #ccc;
  border-radius: 12px;

  display: flex;
  align-items: center;
  justify-content: center;

  color: #999;
}

/* 詳細本体 */
.book-detail {
  max-width: none;
  padding: 0;
  color: #1f2937;
}

/* 戻るリンク */
.book-detail > a {
  display: block;
  margin-bottom: 12px;
  align-items: center;
  margin-bottom: 20px;
  color: #15936b;
  font-weight: bold;
}

.book-detail > a:hover {
  text-decoration: underline;
}

/* ブック情報カード */
.book-detail h2 {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: bold;
}

.book-detail input[readonly] {
  width: 100% !important;
  padding: 14px 16px;
  border: 1px solid #d9dee7;
  border-radius: 12px;
  background: #fff;
  font-size: 18px;
  font-weight: bold;
  color: #111827;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

/* 編集ボタン */
#open-edit-modal {
  display: block;
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #36b58b, #42c86b);
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
}

#open-edit-modal:hover {
  opacity: 0.9;
}

/* 見出し */
.book-detail h3 {
  margin: 32px 0 14px;
  padding-left: 12px;
  border-left: 5px solid #36b58b;
  font-size: 20px;
  font-weight: bold;
}

/* ブック説明 */
.book-detail h3 + div {
  background: #fff;
  border: 1px solid #e5e9f0 !important;
  border-radius: 16px;
  padding: 20px !important;
  line-height: 1.8;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* 合計 */
.book-detail p {
  display: inline-block;
  margin: 20px 0 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: #e4f7ef;
  color: #15936b;
  font-weight: bold;
}

/* ===============================
   テーブル
================================ */
.book-detail table {
  width: 100% !important;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  margin-bottom: 32px;
  background: #fff;
  border: 1px solid #e5e9f0 !important;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.book-detail table th {
  padding: 14px 12px;
  background: #eef8f4;
  color: #1f2937;
  font-size: 14px;
  text-align: left;
  border: none !important;
  border-bottom: 1px solid #dceee7 !important;
}

.book-detail table td {
  padding: 13px 12px;
  border: none !important;
  border-bottom: 1px solid #eef1f5 !important;
  font-size: 14px;
  line-height: 1.6;
  vertical-align: top;
}

.book-detail table tr:last-child td {
  border-bottom: none !important;
}

.book-detail table tr:hover td {
  background: #f8fcfb;
}

/* 枚数・ST・HPなど短い列 */
.book-detail table th:first-child,
.book-detail table td:first-child {
  width: 70px;
  text-align: center;
  font-weight: bold;
}

/* カード名 */
.book-detail table th:nth-child(2),
.book-detail table td:nth-child(2) {
  width: 180px;
  font-weight: bold;
}

/* ===============================
   パスワードモーダル
================================ */
#edit-password-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

#edit-password-modal .modal-content {
  position: relative;
  width: 420px;
  max-width: calc(100% - 32px);
  padding: 28px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

#close-edit-modal,
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  border-radius: 10%;
  background: #a7aaad !important;
  color: #000000;
  cursor: pointer;
}

#close-edit-modal:hover,
.modal-close:hover {
  background: #e5e7eb !important;
}

#edit-password-modal p {
  display: block;
  margin: 0 0 14px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #1f2937;
  font-weight: bold;
}

#edit-password {
  width: 100%;
  padding: 12px;
  border: 1px solid #d9dee7;
  border-radius: 10px;
  font-size: 15px;
}

#edit-password:focus {
  outline: none;
  border-color: #36b58b;
  box-shadow: 0 0 0 3px rgba(54, 181, 139, 0.15);
}

#edit-password-error {
  margin-top: 10px !important;
  color: #dc2626 !important;
  font-size: 14px;
}

#check-edit-password {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #36b58b, #42c86b);
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

#check-edit-password:hover {
  opacity: 0.9;
}

/* ===============================
   スマホ対応
================================ */
@media screen and (max-width: 900px) {

  .book-detail-layout {
    display: block;
    padding: 0 16px 40px;
  }

  .book-detail-ad {
    display: none;
  }

  .book-detail table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .book-detail h2 {
    font-size: 22px;
  }
}