/* ===================================================================
   bookspice · reading calendar styles
   =================================================================== */

/* 🆕 log modal: บันทึกอ่านจบ */
.log-book-list {
  max-height: 60vh;
  overflow-y: auto;
  margin-top: 12px;
}
.log-book {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-family: var(--sans);
}
.log-book:hover {
  background: var(--bg-3);
  border-color: var(--spice);
  transform: translateX(4px);
}
.log-book-done {
  background: var(--bg-3);
  border-color: var(--sage);
  cursor: default;
}
.log-book-done:hover { transform: none; }
.log-book > div { flex: 1; min-width: 0; }
.log-book strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log-book p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log-book small {
  font-size: 11px;
  color: var(--ink-3);
  font-style: italic;
}
.log-plus {
  font-size: 24px;
  color: var(--spice);
  font-weight: 700;
  flex-shrink: 0;
}
.log-undo {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-3);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: all 0.15s;
}
.log-undo:hover {
  background: var(--bg);
  color: var(--spice);
  border-color: var(--spice);
}

/* 🆕 cal-action-btn (บันทึกอ่านจบ) */
.cal-actions { display: flex; align-items: center; gap: 12px; }
.cal-action-btn {
  background: var(--paper);
  border: 1.5px solid var(--sage);
  color: var(--sage);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--sans);
  white-space: nowrap;
}
.cal-action-btn:hover {
  background: var(--sage);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(122, 140, 110, 0.3);
}
.cal-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 720px) {
  .cal-actions { width: 100%; }
  .cal-action-btn { flex: 1; }
}

.cal-header {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  border-bottom: 1px solid var(--line);
  padding: 48px 24px 24px;
  text-align: center;
}
.cal-header h1 {
  font-family: var(--serif);
  font-size: 36px;
  color: var(--ink);
  margin-bottom: 8px;
}
.cal-header p { color: var(--ink-3); font-size: 15px; }

.cal-stats {
  max-width: 1100px; margin: 32px auto 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all 0.15s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--line-2);
}
.stat-card strong {
  display: block;
  font-family: var(--serif);
  font-size: 32px;
  color: var(--spice);
  font-weight: 600;
  margin-bottom: 4px;
}
.stat-card span {
  font-size: 12px;
  color: var(--ink-3);
}

.cal-toolbar {
  max-width: 1100px; margin: 32px auto 16px;
  padding: 0 24px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-nav h2 {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink);
  font-weight: 600;
  min-width: 200px;
  text-align: center;
}
.cal-nav-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 18px;
  color: var(--ink-2);
  transition: all 0.15s;
}
.cal-nav-btn:hover { background: var(--spice); color: #fff; border-color: var(--spice); }
.cal-today {
  padding: 8px 14px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 18px;
  font-size: 13px;
  color: var(--ink-2);
  margin-left: 8px;
}
.cal-today:hover { background: var(--spice); color: #fff; border-color: var(--spice); }

.cal-view-toggle {
  display: flex; gap: 4px;
  background: var(--bg-3);
  padding: 4px;
  border-radius: 20px;
  border: 1px solid var(--line);
}
.cal-view-toggle button {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 13px;
  color: var(--ink-3);
  transition: all 0.15s;
}
.cal-view-toggle button.active {
  background: var(--spice);
  color: #fff;
}
.cal-view-toggle button:hover:not(.active) {
  color: var(--spice);
}

/* ====== month grid ====== */
.cal-main {
  max-width: 1100px; margin: 0 auto;
  padding: 0 24px 60px;
}
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  background: var(--bg-3);
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.cal-dow {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cal-day {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 100px;
  padding: 6px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
}
.cal-day:hover:not(.cal-day-empty) {
  border-color: var(--spice);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.cal-day-empty {
  background: transparent;
  border: none;
  cursor: default;
}
.cal-day-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 4px;
}
.cal-day-today {
  background: linear-gradient(135deg, rgba(201, 100, 66, 0.05), rgba(217, 119, 87, 0.05));
  border-color: var(--spice);
}
.cal-day-today .cal-day-num {
  background: var(--spice);
  color: #fff;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.cal-day-books {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  flex: 1;
}
.cal-day-book {
  aspect-ratio: 2/3;
  border-radius: 3px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--spice), var(--spice-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.cal-day-book img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.cal-day-book-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.cal-day-more {
  font-size: 10px;
  color: var(--spice);
  font-weight: 700;
  text-align: center;
  padding: 2px 0;
}

/* ====== list view ====== */
.list-view { display: flex; flex-direction: column; gap: 32px; }
.list-month h3 {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line-2);
}
.list-books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.list-book {
  display: flex; gap: 12px;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  color: var(--ink);
}
.list-book:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: var(--spice);
}
.list-book-info { flex: 1; min-width: 0; }
.list-book-info strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 2px;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.list-book-info p {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.list-book-date { font-size: 11px; color: var(--ink-3); margin-right: 8px; }

/* ====== day modal ====== */
.day-book {
  display: flex; gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: background 0.15s;
  color: var(--ink);
}
.day-book:hover { background: var(--bg-2); }
.day-book > div:not(.book-cover-fallback):not(.book-cover-img) {
  flex: 1; min-width: 0;
}
.day-book strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}
.day-book p {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.day-book .rating { font-size: 13px; letter-spacing: 1px; }

@media (max-width: 700px) {
  .cal-stats { grid-template-columns: repeat(2, 1fr); }
  .month-grid { gap: 3px; padding: 4px; }
  .cal-day { min-height: 70px; padding: 3px; }
  .cal-day-num { font-size: 11px; }
  .cal-day-books { grid-template-columns: 1fr; }
  .cal-day-book-fallback { font-size: 10px; }
  .cal-nav h2 { min-width: auto; font-size: 18px; }
}
