/* ============================================
   PEAKPOINT SAT PREP — Resource Library
   Styles for resources.html (extends style.css)
   ============================================ */

.library {
  padding: 40px 0 120px;
  position: relative;
}

/* ---------- Toolbar (search + filters) ---------- */
.lib-toolbar {
  max-width: 1080px;
  margin: 0 auto 40px;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: 20px;
  padding: 24px;
  position: sticky;
  top: 84px;
  z-index: 30;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

/* Search */
.lib-search {
  position: relative;
  margin-bottom: 18px;
}

.lib-search svg {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

.lib-search input {
  width: 100%;
  padding: 15px 46px 15px 50px;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: all 0.25s ease;
}

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

.lib-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow-soft);
}

.lib-search .lib-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1;
}

.lib-search .lib-clear:hover { background: var(--surface-2); color: var(--text-primary); }
.lib-search.has-value .lib-clear { display: flex; }

/* Filter selects */
.lib-filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.lib-field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.lib-field select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.92rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239090B0' stroke-width='2.4'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  transition: all 0.25s ease;
}

.lib-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow-soft);
}

.lib-field select option { background: var(--surface-1); color: var(--text-primary); }

/* Quick category pills */
.lib-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 1080px;
  margin: 0 auto 28px;
}

.lib-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: var(--surface-1);
  color: var(--text-secondary);
  transition: all 0.25s ease;
}

.lib-pill:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.lib-pill.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 20px rgba(74, 63, 191, 0.4);
}

/* ---------- Result meta ---------- */
.lib-meta {
  max-width: 1080px;
  margin: 0 auto 22px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.lib-count {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.lib-count strong { color: var(--highlight); font-weight: 600; }

.lib-reset {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  padding: 7px 16px;
  transition: all 0.2s ease;
  display: none;
}
.lib-reset:hover { color: var(--highlight); border-color: var(--accent); }
.lib-reset.show { display: inline-block; }

/* ---------- Cards grid ---------- */
.lib-grid {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.res-card {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 26px 24px 22px;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s var(--easing), border-color 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.res-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.res-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-hover);
  box-shadow: 0 0 34px rgba(108, 99, 255, 0.16);
}
.res-card:hover::before { opacity: 1; }

/* Section-coloured left accent via badge */
.res-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.res-badge {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.res-badge.sec-math      { background: rgba(108, 99, 255, 0.14); color: #b6aaff; border-color: rgba(108, 99, 255, 0.35); }
.res-badge.sec-reading   { background: rgba(59, 130, 246, 0.14); color: #86b6ff; border-color: rgba(59, 130, 246, 0.35); }
.res-badge.sec-writing   { background: rgba(52, 211, 153, 0.12); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.32); }
.res-badge.sec-reading-writing { background: rgba(236, 130, 200, 0.12); color: #f0a6d8; border-color: rgba(236, 130, 200, 0.32); }

.res-type {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.res-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex-shrink: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.16), rgba(59, 130, 246, 0.1));
  border: 1px solid rgba(108, 99, 255, 0.22);
  color: var(--highlight);
}
.res-icon svg { width: 18px; height: 18px; }

.res-card h3 {
  font-size: 1.12rem;
  line-height: 1.3;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.res-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 18px;
  flex-grow: 1;
}

.res-topic {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--highlight);
  margin-bottom: 18px;
  font-weight: 500;
}

.res-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.res-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.25s var(--easing);
  white-space: nowrap;
}
.res-btn svg { width: 15px; height: 15px; }

.res-btn.view {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(74, 63, 191, 0.3);
}
.res-btn.view:hover { filter: brightness(1.15); transform: translateY(-2px); }

.res-btn.download {
  border: 1px solid var(--accent);
  color: var(--highlight);
  background: transparent;
  flex: 0 0 auto;
  padding: 11px 15px;
}
.res-btn.download:hover { background: rgba(108, 99, 255, 0.1); border-color: var(--highlight); transform: translateY(-2px); }

/* ---------- Empty state ---------- */
.lib-empty {
  max-width: 560px;
  margin: 40px auto;
  text-align: center;
  padding: 60px 30px;
  border: 1px dashed var(--border-default);
  border-radius: 20px;
  display: none;
}
.lib-empty.show { display: block; }
.lib-empty svg { width: 48px; height: 48px; color: var(--text-muted); margin: 0 auto 20px; }
.lib-empty h3 { font-size: 1.3rem; margin-bottom: 10px; }
.lib-empty p { font-size: 0.95rem; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .lib-grid { grid-template-columns: repeat(2, 1fr); }
  .lib-toolbar { top: 76px; }
}

@media (max-width: 640px) {
  .lib-grid { grid-template-columns: 1fr; }
  .lib-filters { grid-template-columns: 1fr; }
  .lib-toolbar { position: static; padding: 18px; }
  .library { padding: 24px 0 90px; }
}
