@charset "UTF-8";

:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef1ff;
  --text: #1f2330;
  --text-muted: #6b7280;
  --border: #e6e7ee;
  --radius-lg: 1.25rem;
  --radius-md: 0.85rem;
  --radius-sm: 0.55rem;
  --shadow-sm: 0 1px 2px rgba(20, 22, 40, 0.06);
  --shadow-md: 0 12px 28px -14px rgba(20, 22, 40, 0.25);
  --success: #16a34a;
  --success-soft: #ecfdf3;
  --warning: #d97706;
  --warning-soft: #fffaeb;
  --info: #2563eb;
  --info-soft: #eff4ff;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", YuGothic, "Segoe UI", Verdana, Meiryo, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, #7c6cf0 100%);
  color: #fff;
  padding: 2.25rem 0 2.75rem;
  margin-bottom: -1.75rem;
}

.app-header h1 {
  font-weight: 700;
  font-size: 1.75rem;
  margin: 0;
  letter-spacing: 0.02em;
}

.app-header p {
  margin: 0.35rem 0 0;
  opacity: 0.85;
  font-size: 0.95rem;
}

.page-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

/* ---------- Buttons ---------- */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-pill {
  border-radius: 999px;
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ---------- Empty state ---------- */
.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.empty-state .icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.empty-state h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ---------- Book cards ---------- */
.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.book-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.book-card__header {
  padding: 1.25rem 1.4rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
}

.book-card__title-group {
  min-width: 0;
}

.book-card__index {
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.book-card__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0.15rem 0 0.2rem;
  color: var(--text);
  word-break: break-word;
}

.book-card__author {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.book-card__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.status-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge--unread {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-badge--reading {
  background: var(--info-soft);
  color: var(--info);
}

.status-badge--finished {
  background: var(--success-soft);
  color: var(--success);
}

.star-rating {
  color: #f5a524;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.star-rating .star-empty {
  color: #e2e4ee;
}

.book-card__chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  font-size: 0.85rem;
}

.book-card__header[aria-expanded="true"] .book-card__chevron {
  transform: rotate(180deg);
}

.book-card__body {
  border-top: 1px solid var(--border);
  padding: 1.1rem 1.4rem 1.4rem;
  background: #fbfbfe;
}

.detail-row {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.detail-row__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.2rem;
}

.detail-row__value {
  color: var(--text);
  white-space: pre-line;
}

.action-pair {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
}

.action-pair__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 0.5rem;
}

/* ---------- Form ---------- */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.form-section__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-section__title .badge-step {
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 50%;
  width: 1.65rem;
  height: 1.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.form-floating > .form-control,
.form-floating > textarea.form-control {
  border-radius: var(--radius-sm);
}

.form-control,
.form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}

.status-toggle {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.status-toggle .btn-check + label.btn {
  border-radius: 999px;
  border-color: var(--border);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.5rem 1.1rem;
}

.status-toggle .btn-check:checked + label.btn {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.action-habit-pair {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.9rem;
  background: #fbfbfe;
}

.error-summary {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.error-summary ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.field-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}
