/* ============================================================
 * Library browse page
 * ============================================================ */

.library-header {
  margin-bottom: 0.5rem;
}

.library-breadcrumb {
  font-size: 0.85rem;
  margin: 0 0 0.5rem;
}

.library-breadcrumb a {
  color: #666;
  text-decoration: none;
}

.library-breadcrumb a:hover {
  color: #1D9E75;
  text-decoration: underline;
}

.library-header h1 {
  margin-bottom: 0.25rem;
  border-bottom: none;
  padding-bottom: 0;
}

.library-summary {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 1.5rem;
  min-height: 1.2em;
}

/* ---- Filter tabs ------------------------------------------- */

.library-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.library-filter-tab {
  appearance: none;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 99px;
  padding: 6px 16px;
  font-size: 0.875rem;
  font-family: inherit;
  color: #333;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.library-filter-tab:hover:not(.library-filter-tab--active) {
  background: rgba(0, 0, 0, 0.04);
}

.library-filter-tab--active {
  background: #1D9E75;
  color: white;
  border-color: #1D9E75;
}

.library-filter-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 158, 117, 0.45);
}

/* ---- Cards grid -------------------------------------------- */

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.library-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease,
              box-shadow 0.2s ease;
}

.library-card:hover {
  border-color: rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.library-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 158, 117, 0.45);
}

.library-card--in_progress {
  border-color: #1D9E75;
}

.library-card--completed {
  border-color: #9FE1CB;
  background: #f0faf5;
}

/* ---- Card internals ---------------------------------------- */

.library-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.library-card-difficulty {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Difficulty badge colors — intentional hardcoded brand-aligned
   values. Kept in sync with puzzle.css's .puzzle-difficulty-badge. */
.library-card-difficulty--beginner { background: #1D9E75; }
.library-card-difficulty--easy     { background: #0F6E56; }
.library-card-difficulty--medium   { background: #BA7517; }
.library-card-difficulty--hard     { background: #D85A30; }
.library-card-difficulty--expert   { background: #E24B4A; }

.library-card-number {
  font-size: 0.75rem;
  color: #999;
}

.library-card-status {
  font-size: 0.8125rem;
  color: #666;
}

.library-card-progress-bar {
  height: 4px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 99px;
  margin: 6px 0;
  overflow: hidden;
}

.library-card-progress-fill {
  height: 100%;
  background: #1D9E75;
  border-radius: 99px;
  transition: width 0.3s ease;
}

.library-card-checkmark {
  color: #1D9E75;
  font-size: 1rem;
  font-weight: 500;
  display: block;
  margin-bottom: 2px;
}

.library-card-status-label {
  display: block;
}

/* ---- Skeleton ---------------------------------------------- */

.library-card-skeleton {
  height: 86px;
  border-radius: 12px;
  background-color: #ededed;
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: library-skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes library-skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Load more --------------------------------------------- */

.library-load-more {
  text-align: center;
  margin-top: 2rem;
}

.library-load-more-btn {
  appearance: none;
  background: white;
  color: #1D9E75;
  border: 1px solid #1D9E75;
  padding: 10px 24px;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.library-load-more-btn:hover {
  background: #1D9E75;
  color: white;
}

.library-load-more-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 158, 117, 0.45);
}

.library-load-more-btn[hidden] { display: none; }

.library-count-label {
  font-size: 0.8125rem;
  color: #888;
  margin-top: 8px;
}

/* ---- Empty / error states ---------------------------------- */

.library-state {
  text-align: center;
  padding: 2rem 1rem;
  color: #666;
  font-size: 0.95rem;
}

.library-state[hidden] { display: none; }
