/* ============================================================
   Bookworm — Jean's Book Club
   Warm cream palette, forest green, gold accents
   Large fonts, generous spacing — designed for Jean
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cream:        #fdf6e9;
  --cream-mid:    #f5e9d0;
  --card-bg:      #fff8f0;
  --green:        #2a6041;
  --green-dark:   #1d4530;
  --green-light:  #e8f3ec;
  --gold:         #c9973a;
  --gold-empty:   #d9c8a8;
  --gold-bg:      #fdf3e3;
  --text:         #2c1810;
  --text-muted:   #6b4c2a;
  --text-light:   #9a7a5a;
  --border:       #e4cfa8;
  --border-light: #eddfc0;
  --red:          #c0392b;
  --red-light:    #fdf0ef;
  --shadow:       0 2px 16px rgba(44,24,16,0.10);
  --shadow-card:  0 4px 24px rgba(44,24,16,0.13);
  --shadow-heavy: 0 8px 40px rgba(44,24,16,0.18);
  --radius:       16px;
  --radius-sm:    10px;
  --radius-xs:    6px;
}

html {
  font-size: 20px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background-color: var(--cream);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: Georgia, 'Times New Roman', serif;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */

.page-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.site-header {
  background: var(--green);
  color: white;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(42,96,65,0.35);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.55rem;
  font-weight: bold;
  line-height: 1.2;
  color: white;
  flex: 1;
  letter-spacing: -0.01em;
}

.logout-btn {
  background: rgba(255,255,255,0.18);
  color: white;
  border: 2px solid rgba(255,255,255,0.55);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.2s;
  min-height: 50px;
  letter-spacing: 0.02em;
}
.logout-btn:hover, .logout-btn:focus {
  background: rgba(255,255,255,0.30);
  outline: 3px solid rgba(255,255,255,0.7);
  outline-offset: 2px;
}

/* ── Login Page ─────────────────────────────────────────────────────────── */

.login-body {
  background: linear-gradient(160deg, #fdf6e9 0%, #f5e3c0 100%);
}

.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 20px;
}

.login-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-heavy);
  padding: 52px 44px 48px;
  width: 100%;
  max-width: 520px;
  text-align: center;
  border: 1px solid var(--border-light);
}

.login-emoji {
  font-size: 4.5rem;
  margin-bottom: 12px;
  line-height: 1;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(201,151,58,0.25));
}

.login-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 2.4rem;
  color: var(--green);
  margin-bottom: 12px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 1.15rem;
  margin-bottom: 40px;
  line-height: 1.5;
}

.login-btn {
  font-size: 1.35rem !important;
  padding: 20px 32px !important;
  margin-top: 8px;
  letter-spacing: 0.02em;
}

/* ── Forms ──────────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 28px;
  text-align: left;
}

label {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="email"],
textarea {
  display: block;
  width: 100%;
  font-family: inherit;
  font-size: 1.15rem;
  padding: 16px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.5;
}
input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(42,96,65,0.15);
}
input::placeholder,
textarea::placeholder {
  color: var(--text-light);
}

textarea {
  resize: vertical;
  min-height: 150px;
  font-size: 1.1rem;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: block;
  width: 100%;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 18px 28px;
  min-height: 60px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  line-height: 1.3;
  letter-spacing: 0.02em;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--green);
  color: white;
  box-shadow: 0 4px 14px rgba(42,96,65,0.35);
}
.btn-primary:hover:not(:disabled), .btn-primary:focus:not(:disabled) {
  background: var(--green-dark);
  box-shadow: 0 6px 20px rgba(42,96,65,0.45);
  outline: 3px solid rgba(42,96,65,0.4);
  outline-offset: 2px;
}

.btn-gold {
  background: var(--gold);
  color: white;
  box-shadow: 0 4px 14px rgba(201,151,58,0.35);
}
.btn-gold:hover:not(:disabled), .btn-gold:focus:not(:disabled) {
  background: #b8862e;
  box-shadow: 0 6px 20px rgba(201,151,58,0.45);
}

.btn-secondary {
  background: white;
  color: var(--green);
  border: 2px solid var(--green);
  box-shadow: none;
}
.btn-secondary:hover:not(:disabled), .btn-secondary:focus:not(:disabled) {
  background: var(--green-light);
  outline: 3px solid rgba(42,96,65,0.3);
  outline-offset: 2px;
}

.btn-yes-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 16px 32px;
  min-height: 60px;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}
.btn-yes-no.selected-yes {
  background: var(--green);
  color: white;
  border-color: var(--green);
  box-shadow: 0 4px 14px rgba(42,96,65,0.35);
}
.btn-yes-no.selected-no {
  background: #8B4513;
  color: white;
  border-color: #8B4513;
  box-shadow: 0 4px 14px rgba(139,69,19,0.35);
}
.btn-yes-no:hover {
  border-color: var(--green);
  background: var(--green-light);
}
.btn-yes-no.selected-yes:hover { background: var(--green-dark); }
.btn-yes-no.selected-no:hover { background: #7a3c10; }

/* ── Error Messages ─────────────────────────────────────────────────────── */

.error-msg {
  background: var(--red-light);
  border: 2px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: none;
}

/* ── Stars ──────────────────────────────────────────────────────────────── */

.stars-row {
  display: flex;
  gap: 8px;
  margin: 8px 0 4px;
}

.star-btn {
  font-size: 2.8rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gold-empty);
  padding: 4px 2px;
  transition: color 0.1s, transform 0.12s;
  line-height: 1;
}
.star-btn:hover, .star-btn.active {
  color: var(--gold);
  transform: scale(1.15);
}
.star-btn:active {
  transform: scale(1.3);
}
.star-btn:focus {
  outline: 3px solid var(--gold);
  border-radius: 4px;
}

/* ── Book Cards — Library ────────────────────────────────────────────────── */

.library-header {
  padding: 24px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.book-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-top: 8px;
}

.book-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  border: 1px solid var(--border-light);
  transition: box-shadow 0.2s, transform 0.15s;
}
.book-card:hover {
  box-shadow: var(--shadow-heavy);
  transform: translateY(-2px);
}

/* Card top section: cover + metadata */
.book-card-top {
  display: flex;
  gap: 20px;
  padding: 24px;
  align-items: flex-start;
}

.book-cover-wrap {
  flex-shrink: 0;
}

.book-cover {
  width: 82px;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(44,24,16,0.2);
  display: block;
}

.book-cover-placeholder {
  width: 82px;
  height: 120px;
  background: var(--cream-mid);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--text-light);
  box-shadow: 0 2px 8px rgba(44,24,16,0.12);
}

.book-meta {
  flex: 1;
  min-width: 0;
}

.book-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.45rem;
  font-weight: bold;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.book-author {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 12px;
}

.book-stars-display {
  font-size: 1.6rem;
  margin-bottom: 10px;
  line-height: 1;
  letter-spacing: 2px;
  color: var(--gold);
}
.book-stars-display .star-empty { color: var(--gold-empty); }

.book-finished-badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.badge-finished {
  background: var(--green-light);
  color: var(--green-dark);
  border: 1.5px solid var(--green);
}
.badge-reading {
  background: var(--gold-bg);
  color: #7a5a10;
  border: 1.5px solid var(--gold);
}

.book-date {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* Card details section */
.book-card-body {
  padding: 0 24px 24px;
}

.book-divider {
  border: none;
  border-top: 1.5px solid var(--border-light);
  margin: 0 0 22px;
}

/* Jean's review section */
.review-section {
  background: white;
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin-bottom: 20px;
  border-left: 4px solid var(--gold);
  box-shadow: 0 2px 8px rgba(44,24,16,0.06);
}

.review-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.review-text {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.7;
  font-style: italic;
}

/* AI content sections */
.ai-section {
  margin-bottom: 18px;
}

.ai-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.ai-section-text {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.65;
}

.fun-facts-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.fun-facts-list li {
  font-size: 1rem;
  padding: 10px 0 10px 32px;
  position: relative;
  border-bottom: 1px solid var(--border-light);
  line-height: 1.55;
  color: var(--text);
}
.fun-facts-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.fun-facts-list li::before {
  content: '✨';
  position: absolute;
  left: 0;
  top: 10px;
  font-size: 1rem;
}

/* ── Add Book Button area ────────────────────────────────────────────────── */

.add-book-area {
  padding: 24px 0 16px;
}

/* ── Empty state ────────────────────────────────────────────────────────── */

.empty-library {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-library .big-icon {
  font-size: 5rem;
  margin-bottom: 20px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(201,151,58,0.2));
}
.empty-library p {
  font-size: 1.25rem;
  line-height: 1.5;
  max-width: 380px;
  margin: 0 auto;
}

/* ── Wizard ─────────────────────────────────────────────────────────────── */

.wizard-wrap {
  padding-top: 24px;
}

.step-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  margin: 0 0 32px;
}

.step-pill {
  display: flex;
  align-items: center;
  gap: 0;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-light);
  transition: background 0.25s, color 0.25s;
  flex-shrink: 0;
}
.step-circle.active {
  background: var(--green);
  color: white;
  box-shadow: 0 2px 12px rgba(42,96,65,0.4);
}
.step-circle.done {
  background: var(--green-light);
  color: var(--green);
  border: 2px solid var(--green);
}

.step-line {
  width: 48px;
  height: 3px;
  background: var(--border);
  transition: background 0.25s;
}
.step-line.done {
  background: var(--green);
}

.step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  text-align: center;
  margin-top: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.step-indicator-full {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.step-track {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 8px;
}

.step-labels {
  display: flex;
  gap: 0;
}
.step-labels span {
  width: 36px;
  font-size: 0.72rem;
  text-align: center;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.step-labels .lbl-gap {
  width: 48px;
}
.step-labels .active-lbl {
  color: var(--green);
}

.wizard-step {
  display: none;
}
.wizard-step.active { display: block; }

.step-header {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.65rem;
  font-weight: bold;
  color: var(--green-dark);
  margin-bottom: 24px;
  line-height: 1.3;
}

/* ── Preview Card (Step 2) ──────────────────────────────────────────────── */

.preview-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 28px;
  border: 1px solid var(--border-light);
}

.preview-cover-row {
  display: flex;
  gap: 20px;
  padding: 24px;
  align-items: flex-start;
  background: white;
}

.preview-cover {
  width: 90px;
  min-width: 90px;
  height: 130px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(44,24,16,0.2);
}

.preview-cover-placeholder {
  width: 90px;
  min-width: 90px;
  height: 130px;
  background: var(--cream-mid);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.preview-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.preview-author {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-style: italic;
}

.preview-body {
  padding: 0 24px 24px;
}

.preview-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1.5px solid var(--border-light);
}
.preview-section:first-child {
  border-top: none;
}

.preview-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.preview-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.preview-section p {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.65;
}

/* ── Loading ─────────────────────────────────────────────────────────────── */

.loading-wrap {
  text-align: center;
  padding: 48px 20px;
  display: none;
}
.loading-wrap.visible { display: block; }

.spinner {
  display: inline-block;
  width: 52px;
  height: 52px;
  border: 5px solid var(--cream-mid);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin-bottom: 18px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1.15rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Finished toggle row ─────────────────────────────────────────────────── */

.finished-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── Quick-Glance List ─────────────────────────────────────────────────────── */

.quick-list-section {
  margin: 0 0 36px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.quick-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: var(--green);
  color: white;
}

.quick-list-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.1rem;
  font-weight: bold;
  color: white;
  letter-spacing: 0.01em;
}

.quick-list-count {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.quick-list-table {
  width: 100%;
  border-collapse: collapse;
}

.quick-list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
}
.quick-list-row:last-child {
  border-bottom: none;
}
.quick-list-row:hover {
  background: var(--cream);
}
.quick-list-row:focus {
  outline: 3px solid var(--green);
  outline-offset: -2px;
  background: var(--cream);
}

.ql-thumb {
  width: 38px;
  min-width: 38px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(44,24,16,0.18);
  display: block;
}

.ql-thumb-placeholder {
  width: 38px;
  min-width: 38px;
  height: 54px;
  background: var(--cream-mid);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.ql-book-info {
  flex: 1;
  min-width: 0;
}

.ql-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  font-weight: bold;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  margin-bottom: 2px;
}

.ql-author {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ql-stars {
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 1px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ql-stars .star-empty { color: var(--gold-empty); }

.ql-badge {
  display: none; /* hidden on mobile, shown on wider screens */
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ql-badge.badge-finished {
  background: var(--green-light);
  color: var(--green-dark);
  border: 1px solid var(--green);
}
.ql-badge.badge-reading {
  background: var(--gold-bg);
  color: #7a5a10;
  border: 1px solid var(--gold);
}

.ql-arrow {
  font-size: 1rem;
  color: var(--text-light);
  flex-shrink: 0;
  transition: transform 0.15s, color 0.15s;
}
.quick-list-row:hover .ql-arrow {
  transform: translateX(4px);
  color: var(--green);
}

/* Highlight effect when jumping to a full card */
@keyframes card-highlight {
  0%   { box-shadow: 0 0 0 4px var(--gold), var(--shadow-card); background: var(--gold-bg); }
  60%  { box-shadow: 0 0 0 4px var(--gold), var(--shadow-card); background: var(--gold-bg); }
  100% { box-shadow: var(--shadow-card); background: var(--card-bg); }
}

.book-card.highlighted {
  animation: card-highlight 1.8s ease-out forwards;
}

/* Show badge on wider screens */
@media (min-width: 480px) {
  .ql-badge { display: inline-block; }
}

/* ── Utility ─────────────────────────────────────────────────────────────── */

.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 440px) {
  html { font-size: 18px; }
  .login-card { padding: 36px 24px 32px; }
  .login-title { font-size: 2rem; }
  .stars-row { gap: 4px; }
  .star-btn { font-size: 2.4rem; }
  .book-card-top { gap: 14px; padding: 18px; }
  .book-cover { width: 68px; height: 100px; }
  .book-cover-placeholder { width: 68px; height: 100px; }
  .step-line { width: 32px; }
}

/* Genre + Notes */
.genre-badge {
  display: inline-block;
  background: #e8f4ec;
  color: #2a6041;
  border: 1px solid #b5d9c3;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
}
