/*
 * Theme: theme-Serenity
 * Author: Serenity
 * Build: 2026-07-05 00:01:15
 * Fingerprint: 1a93cc3686d739b8
 * Copyright (c) 2026 Serenity. All rights reserved.
 */

/* =========================================================
   WeRead
   ========================================================= */

.weread-page {
  padding-top: calc(var(--header-height) + var(--space-8));
  padding-bottom: var(--space-10);
  min-height: 100vh;
}


/* =========================================================
   Header（复用主题通用 page-title 空心标题）
   ========================================================= */

.weread-page .page-header {
  text-align: center;
  margin-bottom: var(--space-8);
}


/* =========================================================
   Statistics
   ========================================================= */

.weread-stats {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.weread-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  min-width: 64px;
}

.weread-stat-num {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.weread-stat-label {
  font-size: 11px;
  color: var(--color-text-muted);
}


/* =========================================================
   Toolbar
   ========================================================= */

.weread-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.weread-search {
  display: flex;
  align-items: center;

  width: 326px;
  max-width: 100%;

  height: 40px;

  padding: 0 var(--space-3);

  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);

  transition: all var(--duration-fast);
}

.weread-search:focus-within {
  border-color: var(--color-accent);

  box-shadow:
    0 0 0 3px
    color-mix(in srgb, var(--color-accent) 10%, transparent);
}

.weread-search i {
  flex: 0 0 auto;

  margin-right: var(--space-2);

  color: var(--color-text-muted);

  font-size: 12px;
}

.weread-search input {
  width: 100%;

  border: 0;
  outline: 0;

  color: var(--color-text);
  background: transparent;

  font: inherit;
  font-size: 13px;
}

.weread-search input::placeholder {
  color: var(--color-text-muted);
}


/* filters */

.weread-filter {
  display: flex;
  align-items: center;

  gap: var(--space-1);

  padding: var(--space-1);

  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.weread-filter-btn {
  height: 30px;

  padding: 0 var(--space-3);

  border: 0;
  border-radius: var(--radius-sm);

  color: var(--color-text-muted);
  background: transparent;

  cursor: pointer;

  font: inherit;
  font-size: 12px;

  transition: all var(--duration-fast);
}

.weread-filter-btn:hover {
  color: var(--color-text);
}

.weread-filter-btn.is-active {
  color: var(--color-accent);

  background: color-mix(
    in srgb,
    var(--color-accent) 12%,
    transparent
  );

  font-weight: 600;
}


/* =========================================================
   Loading / Empty
   ========================================================= */

.wr-loading {
  min-height: 300px;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  gap: var(--space-3);

  color: var(--color-text-muted);

  font-size: 13px;
}

.wr-loading-spinner {
  width: 40px;
  height: 40px;

  border: 3px solid var(--color-border);

  border-top-color: var(--color-accent);

  border-radius: 50%;

  animation: weread-spin 0.8s linear infinite;
}

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

/* 空状态复用主题 plugin-notice 组件（由 weread.js 渲染） */

.weread-page .plugin-notice {
  margin: 0 auto;
}

.weread-page .plugin-notice-icon i {
  font-size: 30px;
}

.wr-retry {
  margin-top: var(--space-4);

  padding: var(--space-2) var(--space-4);

  border: 0;
  border-radius: var(--radius-md);

  color: #fff;
  background: var(--color-accent);

  cursor: pointer;

  font: inherit;
  font-size: 12px;

  transition: all var(--duration-fast);
}

.wr-retry:hover {
  background: var(--color-accent-secondary);

  transform: translateY(-1px);
}


/* =========================================================
   Year
   ========================================================= */

.wr-year-group {
  margin-bottom: var(--space-10);
}

.wr-year-group:last-child {
  margin-bottom: 0;
}

.wr-year-title {
  display: flex;
  align-items: center;

  margin: 0 0 var(--space-4);

  color: var(--color-text);

  font-size: 1rem;
  line-height: 1.4;
  font-weight: 800;
}

.wr-year-title::before {
  content: '';

  width: 3px;
  height: 18px;

  flex-shrink: 0;

  margin-right: var(--space-2);

  border-radius: var(--radius-full);

  background: linear-gradient(
    180deg,
    var(--color-accent),
    var(--color-accent-secondary)
  );
}

.wr-year-title::after {
  content: '';

  height: 1px;

  flex: 1;

  margin-left: var(--space-3);

  background: var(--color-border);
}

.wr-year-count {
  margin-left: var(--space-2);

  padding: 2px 8px;

  border-radius: var(--radius-full);

  color: var(--color-accent);

  background: color-mix(
    in srgb,
    var(--color-accent) 10%,
    transparent
  );

  font-size: 11px;
  font-weight: 500;
}


/* =========================================================
   Book Grid
   ========================================================= */

.wr-grid {
  display: grid;

  grid-template-columns:
    repeat(auto-fill, minmax(245px, 1fr));

  gap: var(--space-4);
}


/* =========================================================
   Book Card
   ========================================================= */

.wr-card {
  display: flex;

  min-width: 0;
  width: 100%;

  padding: var(--space-3);

  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);

  color: inherit;

  cursor: pointer;

  text-align: left;

  transition: all var(--duration-fast);
}

.wr-card:hover {
  transform: translateY(-2px);

  border-color: var(--color-accent);

  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.wr-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}


/* cover */

.wr-card-cover {
  width: 68px;
  height: 96px;

  flex: 0 0 auto;

  border-radius: var(--radius-md);

  object-fit: cover;

  background: var(--color-bg-mute);

  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}


/* content */

.wr-card-content {
  display: flex;
  flex-direction: column;

  min-width: 0;
  flex: 1;

  padding: 2px 2px 1px var(--space-3);
}

.wr-card-title {
  overflow: hidden;

  color: var(--color-text);

  font-size: 0.86rem;
  line-height: 1.45;
  font-weight: 650;

  text-overflow: ellipsis;
  white-space: nowrap;

  transition: color var(--duration-fast);
}

.wr-card:hover .wr-card-title {
  color: var(--color-accent);
}

.wr-card-author {
  overflow: hidden;

  margin-top: var(--space-1);

  color: var(--color-text-secondary);

  font-size: 0.72rem;

  text-overflow: ellipsis;
  white-space: nowrap;
}


/* tags */

.wr-tag-row {
  display: flex;
  flex-wrap: wrap;

  gap: var(--space-1);

  margin-top: auto;
  padding-top: var(--space-2);
}

.wr-tag {
  padding: 2px 6px;

  border-radius: var(--radius-sm);

  color: var(--color-text-secondary);
  background: var(--color-bg-mute);

  font-size: 10px;
}

.wr-tag--done {
  color: var(--color-accent);

  background: rgba(var(--color-accent-rgb), 0.1);
}


/* metadata */

.wr-meta {
  margin: var(--space-2) 0 0;

  color: var(--color-text-muted);

  font-size: 10px;
  line-height: 1.5;
}


/* =========================================================
   Modal
   ========================================================= */

.wr-modal {
  position: fixed;

  z-index: 10000;

  inset: 0;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: var(--space-5);

  background: rgba(0, 0, 0, 0.6);

  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);

  animation: weread-modal-fade 0.25s ease;
}

.wr-modal[hidden] {
  display: none;
}

@keyframes weread-modal-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.wr-modal-content {
  position: relative;

  width: min(520px, 100%);
  max-height: 80vh;

  overflow-y: auto;

  padding: var(--space-6);

  background: var(--color-bg);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-xl);

  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);

  animation: weread-modal-in 0.25s ease;
}

@keyframes weread-modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.wr-close {
  position: absolute;

  top: var(--space-3);
  right: var(--space-3);

  display: flex;

  align-items: center;
  justify-content: center;

  width: 32px;
  height: 32px;

  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);

  color: var(--color-text-muted);
  background: transparent;

  cursor: pointer;

  transition: all var(--duration-fast);
}

.wr-close:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.wr-modal-book {
  display: flex;

  align-items: flex-start;

  gap: var(--space-4);

  padding-right: var(--space-5);
}

.wr-modal-book img {
  width: 92px;
  height: 130px;

  flex: 0 0 auto;

  border-radius: var(--radius-md);

  object-fit: cover;

  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.wr-modal-book h3 {
  margin: 4px 0 6px;

  color: var(--color-text);

  font-size: 1.15rem;
}

.wr-modal-book p {
  margin: 0;

  color: var(--color-text-secondary);

  font-size: 0.82rem;
}

.wr-modal-note {
  margin: var(--space-4) 0 0;
  padding-top: var(--space-4);

  border-top: 1px solid var(--color-border);

  color: var(--color-text-muted);

  font-size: 0.78rem;
  line-height: 1.7;
}


/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 800px) {

  .weread-stats {
    gap: var(--space-4);
  }

  .weread-toolbar {
    align-items: stretch;
    flex-direction: column;

    gap: var(--space-3);
  }

  .weread-search {
    width: 100%;
  }

  .weread-filter {
    justify-content: center;
  }

}

@media (max-width: 560px) {

  .wr-grid {
    grid-template-columns: 1fr;
  }

  .wr-modal-book img {
    width: 76px;
    height: 108px;
  }

}
