/* ============================================================
   Blog Filter Pro — Stylesheet
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bfp-primary:        #1a1a2e;
  --bfp-accent:         #e94560;
  --bfp-accent-light:   #ff6b81;
  --bfp-surface:        #ffffff;
  --bfp-surface-2:      #f7f8fc;
  --bfp-border:         #e5e8f0;
  --bfp-text:           #1a1a2e;
  --bfp-text-muted:     #6b7280;
  --bfp-radius:         12px;
  --bfp-radius-sm:      8px;
  --bfp-shadow:         0 2px 12px rgba(0,0,0,.07);
  --bfp-shadow-hover:   0 8px 32px rgba(233,69,96,.18);
  --bfp-transition:     0.22s cubic-bezier(.4,0,.2,1);
  --bfp-font:           system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ── Filter Bar Container ───────────────────────────────── */
.bfp-filter-bar {
  font-family: var(--bfp-font);
  background: var(--bfp-surface);
  border: 1px solid var(--bfp-border);
  border-radius: var(--bfp-radius);
  padding: 28px 28px 20px;
  margin: 0 0 40px;
  box-shadow: var(--bfp-shadow);
}

/* ── Search ─────────────────────────────────────────────── */
.bfp-search-wrap {
  margin-bottom: 28px;
}

.bfp-search-form {
  display: block;
}

.bfp-search-inner {
  position: relative;
  display: flex;
  align-items: center;
}

.bfp-search-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--bfp-text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.bfp-search-input {
  width: 100%;
  padding: 14px 48px 14px 48px;
  font-size: 15px;
  font-family: var(--bfp-font);
  color: var(--bfp-text);
  background: var(--bfp-surface-2);
  border: 2px solid var(--bfp-border);
  border-radius: 50px;
  outline: none;
  transition: border-color var(--bfp-transition), box-shadow var(--bfp-transition);
  box-sizing: border-box;
}

.bfp-search-input:focus {
  border-color: var(--bfp-accent);
  box-shadow: 0 0 0 4px rgba(233,69,96,.12);
  background: var(--bfp-surface);
}

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

.bfp-search-clear {
  position: absolute;
  right: 14px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bfp-border);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--bfp-text-muted);
  transition: background var(--bfp-transition), color var(--bfp-transition);
  padding: 0;
}
.bfp-search-clear svg { width: 14px; height: 14px; }
.bfp-search-clear:hover { background: var(--bfp-accent); color: #fff; }

/* ── Section Labels ─────────────────────────────────────── */
.bfp-section { margin-bottom: 24px; }

.bfp-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--bfp-text-muted);
  margin: 0 0 14px;
}

/* ── Category Grid ──────────────────────────────────────── */
.bfp-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.bfp-cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 10px 14px;
  background: var(--bfp-cat-bg, var(--bfp-surface-2));
  border: 2px solid transparent;
  border-radius: var(--bfp-radius);
  cursor: pointer;
  transition: all var(--bfp-transition);
  font-family: var(--bfp-font);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.bfp-cat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bfp-accent);
  opacity: 0;
  transition: opacity var(--bfp-transition);
}

.bfp-cat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--bfp-shadow-hover);
  border-color: var(--bfp-accent);
}

.bfp-cat-card.is-active {
  border-color: var(--bfp-accent);
  background: var(--bfp-accent);
  color: #fff;
}

.bfp-cat-icon {
  font-size: 22px;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.bfp-cat-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--bfp-text);
  position: relative;
  z-index: 1;
  line-height: 1.3;
}

.bfp-cat-card.is-active .bfp-cat-name { color: #fff; }

.bfp-cat-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--bfp-text-muted);
  background: rgba(0,0,0,.06);
  border-radius: 20px;
  padding: 1px 8px;
  position: relative;
  z-index: 1;
}

.bfp-cat-card.is-active .bfp-cat-count {
  background: rgba(255,255,255,.25);
  color: rgba(255,255,255,.9);
}

/* ── Tag Cloud ──────────────────────────────────────────── */
.bfp-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bfp-tag {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--bfp-font);
  color: var(--bfp-text-muted);
  background: var(--bfp-surface-2);
  border: 1.5px solid var(--bfp-border);
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--bfp-transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.bfp-tag:hover {
  border-color: var(--bfp-accent);
  color: var(--bfp-accent);
  background: rgba(233,69,96,.05);
}

.bfp-tag.is-active {
  background: var(--bfp-accent);
  border-color: var(--bfp-accent);
  color: #fff;
}

.bfp-tag-count {
  font-size: 11px;
  opacity: .65;
}

/* ── Active Filters ─────────────────────────────────────── */
.bfp-active-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--bfp-border);
  margin-top: 4px;
}

.bfp-active-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--bfp-text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.bfp-active-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }

.bfp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 12px;
  background: var(--bfp-primary);
  color: #fff;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 500;
}

.bfp-chip-remove {
  width: 16px;
  height: 16px;
  background: rgba(255,255,255,.2);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 10px;
  line-height: 1;
  transition: background var(--bfp-transition);
}
.bfp-chip-remove:hover { background: var(--bfp-accent); }

.bfp-clear-all {
  font-size: 12px;
  font-weight: 600;
  color: var(--bfp-accent);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--bfp-font);
  padding: 4px 8px;
  border-radius: var(--bfp-radius-sm);
  transition: background var(--bfp-transition);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.bfp-clear-all:hover { background: rgba(233,69,96,.08); }

/* ── Loading ─────────────────────────────────────────────── */
.bfp-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--bfp-text-muted);
  font-size: 15px;
}

.bfp-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--bfp-border);
  border-top-color: var(--bfp-accent);
  border-radius: 50%;
  animation: bfp-spin .7s linear infinite;
  flex-shrink: 0;
}

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

/* ── No Results ─────────────────────────────────────────── */
.bfp-no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--bfp-text-muted);
}

.bfp-no-results svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  display: block;
  opacity: .35;
}

.bfp-no-results p {
  font-size: 16px;
  margin: 0;
}

/* ── Post Cards Grid ─────────────────────────────────────── */
.bfp-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
  margin-bottom: 40px;
}

.bfp-post-card {
  background: var(--bfp-surface);
  border: 1px solid var(--bfp-border);
  border-radius: var(--bfp-radius);
  overflow: hidden;
  box-shadow: var(--bfp-shadow);
  transition: transform var(--bfp-transition), box-shadow var(--bfp-transition);
  display: flex;
  flex-direction: column;
}

.bfp-post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,.12);
}

.bfp-card-thumb {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/9;
  background: var(--bfp-surface-2);
}

.bfp-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
  display: block;
}

.bfp-post-card:hover .bfp-card-thumb img {
  transform: scale(1.04);
}

.bfp-card-cat-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--bfp-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.bfp-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.bfp-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--bfp-text-muted);
  margin-bottom: 10px;
}

.bfp-dot { opacity: .4; }

.bfp-card-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 10px;
  color: var(--bfp-text);
}

.bfp-card-title a {
  color: inherit;
  text-decoration: none;
}

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

.bfp-card-excerpt {
  font-size: 14px;
  color: var(--bfp-text-muted);
  line-height: 1.6;
  margin: 0 0 14px;
  flex: 1;
}

.bfp-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 16px;
}

.bfp-card-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--bfp-text-muted);
  background: var(--bfp-surface-2);
  border: 1px solid var(--bfp-border);
  padding: 2px 9px;
  border-radius: 50px;
}

.bfp-read-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--bfp-accent);
  text-decoration: none;
  margin-top: auto;
  transition: gap var(--bfp-transition);
}

.bfp-read-more svg { width: 16px; height: 16px; }
.bfp-read-more:hover { gap: 10px; }

/* ── Pagination ─────────────────────────────────────────── */
.bfp-pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 0 40px;
}

.bfp-page-list,
.bfp-pagination ul {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
  justify-content: center;
}

.bfp-page-btn,
.bfp-pagination .page-numbers {
  min-width: 40px;
  height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--bfp-font);
  color: var(--bfp-text);
  background: var(--bfp-surface);
  border: 1.5px solid var(--bfp-border);
  border-radius: var(--bfp-radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--bfp-transition);
}

.bfp-page-btn:hover,
.bfp-pagination .page-numbers:hover {
  border-color: var(--bfp-accent);
  color: var(--bfp-accent);
  background: rgba(233,69,96,.05);
}

.bfp-page-btn.is-current,
.bfp-pagination .page-numbers.current {
  background: var(--bfp-accent);
  border-color: var(--bfp-accent);
  color: #fff;
}

.bfp-page-btn.bfp-page-prev,
.bfp-page-btn.bfp-page-next,
.bfp-pagination .prev.page-numbers,
.bfp-pagination .next.page-numbers {
  padding: 0 18px;
  font-weight: 500;
}

.bfp-page-info {
  font-size: 12px;
  color: var(--bfp-text-muted);
  margin: 0;
}

.bfp-pagination .page-numbers.dots {
  border: none;
  background: none;
  cursor: default;
  color: var(--bfp-text-muted);
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes bfp-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bfp-post-card {
  animation: bfp-fade-up .35s ease both;
}

.bfp-posts-grid .bfp-post-card:nth-child(1) { animation-delay: .04s; }
.bfp-posts-grid .bfp-post-card:nth-child(2) { animation-delay: .08s; }
.bfp-posts-grid .bfp-post-card:nth-child(3) { animation-delay: .12s; }
.bfp-posts-grid .bfp-post-card:nth-child(4) { animation-delay: .16s; }
.bfp-posts-grid .bfp-post-card:nth-child(5) { animation-delay: .20s; }
.bfp-posts-grid .bfp-post-card:nth-child(6) { animation-delay: .24s; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .bfp-filter-bar { padding: 20px 16px; }

  .bfp-category-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }

  .bfp-cat-card { padding: 12px 8px; }
  .bfp-cat-icon { font-size: 18px; }
  .bfp-cat-name { font-size: 11px; }

  .bfp-posts-grid {
    grid-template-columns: 1fr;
  }

  .bfp-active-filters {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .bfp-category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
