/* ===================================================
   読みたい本リスト スタイルシート
   iPhone最適化・無駄な余白ゼロ・高密度シンプルUI
   =================================================== */

:root {
  --bg-app: #f4f6f8;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  
  --success: #16a34a;
  --success-light: #f0fdf4;
  --success-text: #15803d;
  
  --warning: #d97706;
  --warning-light: #fffbeb;
  --warning-text: #b45309;

  --danger: #dc2626;
  --danger-light: #fef2f2;
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 18px; /* 基本文字サイズを拡大 */
}

/* アプリコンテナ */
.app-container {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
}

/* 固定ヘッダー */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #ffffff;
  border-bottom: 2px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
}

.app-title {
  font-size: 1.5rem; /* タイトルを大きく */
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

/* タブナビゲーション */
.tab-nav {
  display: flex;
  background-color: #f8fafc;
  border-top: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 12px 6px; /* タップしやすく */
  font-size: 17px;   /* タブ文字を大きく */
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-bottom: 3px solid transparent;
  transition: all 0.15s ease;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background-color: #ffffff;
}

.badge {
  display: inline-block;
  font-size: 14px; /* バッジ文字を大きく */
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background-color: #e2e8f0;
  color: #334155;
}

.tab-btn.active .badge {
  background-color: var(--primary-light);
  color: var(--primary);
}

/* 新規登録 / 編集フォーム (開閉式・省スペース) */
.form-container {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
}

.form-container.collapsed {
  max-height: 0;
  padding: 0 12px;
}

.form-container:not(.collapsed) {
  max-height: 500px;
  padding: 10px 12px;
}

.book-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flex-1 { flex: 1; min-width: 140px; }
.flex-2 { flex: 2; min-width: 200px; }

label {
  font-size: 15px; /* ラベルを大きく */
  font-weight: 700;
  color: var(--text-main);
}

.req-note {
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 12px; /* タップしやすく */
  font-size: 17px;    /* 入力文字を大きく（iOSで自動ズームしない16px以上） */
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: #fff;
  color: var(--text-main);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.library-fields {
  background-color: #f8fafc;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 計算予測バナー */
.calc-banner {
  font-size: 15px; /* バナー文字を大きく */
  background-color: var(--warning-light);
  color: var(--warning-text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}

.calc-label {
  font-weight: 800;
  font-size: 14px;
}

.calc-value {
  font-weight: 700;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* ボタン共通 */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 16px; /* ボタン文字を大きく */
  transition: background-color 0.15s;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 15px;
}

.btn-xs {
  padding: 6px 12px; /* タップしやすく */
  font-size: 14px;   /* 操作ボタン文字を大きく */
  border-radius: 6px;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-secondary {
  background-color: #e2e8f0;
  color: #1e293b;
}
.btn-secondary:hover { background-color: #cbd5e1; }

.btn-success {
  background-color: var(--success);
  color: #fff;
}
.btn-success:hover { background-color: #15803d; }

.btn-danger {
  background-color: transparent;
  color: var(--danger);
  border: 1px solid #fca5a5;
}
.btn-danger:hover { background-color: var(--danger-light); }

/* 一覧コンテンツ */
.main-content {
  flex: 1;
  padding: 10px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.book-list {
  display: flex;
  flex-direction: column;
  gap: 8px; /* カード間の隙間 */
}

/* 本カード（見やすく大きな文字・余白はスリム） */
.book-card {
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.book-card-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.book-title {
  font-size: 20px; /* 本のタイトルをしっかり大きく！ */
  font-weight: 800;
  color: var(--text-main);
  word-break: break-word;
  line-height: 1.3;
}

.book-author {
  font-size: 16px; /* 作者名を大きく */
  color: var(--text-muted);
  font-weight: 600;
}

/* 確保状況タグ & 情報 */
.book-status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 15px; /* ステータス行を大きく */
  margin: 2px 0;
}

.tag {
  font-size: 13px; /* タグ文字を大きく */
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}

.tag-library {
  background-color: #e0f2fe;
  color: #0369a1;
}

.tag-purchase {
  background-color: #fef3c7;
  color: #92400e;
}

.status-detail {
  color: var(--text-muted);
  font-size: 14.5px;
}

/* 自動計算された貸出予定の強調バッジ */
.expected-highlight {
  color: #b45309;
  font-weight: 800;
  background-color: #fef3c7;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 15px; /* 強調表示を大きく */
}

/* 感想文表示（読了済みカード） */
.review-box {
  background-color: #f8fafc;
  border-left: 4px solid var(--success);
  padding: 8px 12px;
  font-size: 16px; /* 感想の文字を大きく読みやすく */
  line-height: 1.6;
  color: #1e293b;
  border-radius: 3px;
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

.review-date {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 700;
}

/* カード下部のアクションボタン */
.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.empty-state {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted);
  font-size: 13px;
}

/* モーダルダイアログ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 440px;
  padding: 14px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-title {
  font-size: 18px; /* モーダルタイトル拡大 */
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px; /* 閉じボタン拡大 */
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
