/* =============================================================================
   Sermon Manager Group Filter — sm-group-filter.css
   ============================================================================= */

:root {
  --smgf-primary:      #1a4480;
  --smgf-primary-light:#e8eef7;
  --smgf-accent:       #c8973a;
  --smgf-surface:      #ffffff;
  --smgf-bg:           #f5f6f8;
  --smgf-border:       #dde1e9;
  --smgf-text:         #1c2333;
  --smgf-muted:        #6b7280;
  --smgf-radius:       8px;
  --smgf-shadow:       0 2px 8px rgba(0,0,0,.08);
  --smgf-transition:   .2s ease;
}

/* Wrapper */
.smgf-wrapper {
  font-family: inherit;
  color: var(--smgf-text);
  margin-bottom: 1.5rem;
}

/* ---- Filter Bar ---- */
.smgf-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  background: var(--smgf-surface);
  border: 1px solid var(--smgf-border);
  border-radius: var(--smgf-radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--smgf-shadow);
  margin-bottom: 1rem;
}

.smgf-field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  flex: 1 1 160px;
  min-width: 140px;
}

.smgf-field label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--smgf-muted);
  display: flex;
  align-items: center;
  gap: .3rem;
}

.smgf-field input,
.smgf-field select {
  width: 100%;
  padding: .55rem .75rem;
  font-size: .9rem;
  border: 1px solid var(--smgf-border);
  border-radius: 6px;
  background: var(--smgf-bg);
  color: var(--smgf-text);
  transition: border-color var(--smgf-transition), box-shadow var(--smgf-transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .65rem center;
  padding-right: 2rem;
  cursor: pointer;
}

.smgf-field input {
  background-image: none;
  padding-right: .75rem;
}

.smgf-field input:focus,
.smgf-field select:focus {
  outline: none;
  border-color: var(--smgf-primary);
  box-shadow: 0 0 0 3px rgba(26,68,128,.12);
  background-color: #fff;
}

/* Search field */
.smgf-search { flex: 2 1 220px; }

/* Actions */
.smgf-actions {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  padding-bottom: 1px;
}

.smgf-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .55rem 1.1rem;
  font-size: .85rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all var(--smgf-transition);
  white-space: nowrap;
}

.smgf-btn-reset {
  background: var(--smgf-bg);
  color: var(--smgf-muted);
  border: 1px solid var(--smgf-border);
}
.smgf-btn-reset:hover {
  background: #e5e7eb;
  color: var(--smgf-text);
}

/* ---- Active filter chips ---- */
.smgf-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .75rem;
}

.smgf-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--smgf-primary-light);
  color: var(--smgf-primary);
  border: 1px solid #c5d5ea;
  border-radius: 20px;
  padding: .25rem .75rem;
  font-size: .78rem;
  font-weight: 600;
}

.smgf-chip button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--smgf-primary);
  line-height: 1;
  display: flex;
  align-items: center;
  opacity: .7;
}
.smgf-chip button:hover { opacity: 1; }

/* ---- Results meta ---- */
.smgf-results-meta {
  font-size: .82rem;
  color: var(--smgf-muted);
  margin-bottom: .75rem;
  min-height: 1.2em;
}
.smgf-results-meta strong { color: var(--smgf-text); }

/* ---- Cards Grid ---- */
.smgf-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* ---- Single Card ---- */
.smgf-card {
  background: var(--smgf-surface);
  border: 1px solid var(--smgf-border);
  border-radius: var(--smgf-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--smgf-shadow);
  transition: transform var(--smgf-transition), box-shadow var(--smgf-transition);
}
.smgf-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.smgf-card-thumb {
  display: block;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--smgf-primary-light);
}
.smgf-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.smgf-card:hover .smgf-card-thumb img { transform: scale(1.04); }

.smgf-card-thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--smgf-primary);
  opacity: .5;
}

.smgf-card-body {
  padding: 1rem 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.smgf-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .5rem;
}

.smgf-badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: .2rem .6rem;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.smgf-badge--series {
  background: var(--smgf-primary-light);
  color: var(--smgf-primary);
}

.smgf-card-date {
  font-size: .75rem;
  color: var(--smgf-muted);
  white-space: nowrap;
}

.smgf-card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 .5rem;
}
.smgf-card-title a {
  color: var(--smgf-text);
  text-decoration: none;
  transition: color var(--smgf-transition);
}
.smgf-card-title a:hover { color: var(--smgf-primary); }

.smgf-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .6rem;
}

.smgf-card-preacher,
.smgf-card-book {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  color: var(--smgf-muted);
}

.smgf-card-excerpt {
  font-size: .82rem;
  color: var(--smgf-muted);
  line-height: 1.55;
  margin: 0 0 .75rem;
  flex: 1;
}

.smgf-card-link {
  display: inline-block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--smgf-primary);
  text-decoration: none;
  letter-spacing: .02em;
  margin-top: auto;
  transition: color var(--smgf-transition);
}
.smgf-card-link:hover { color: var(--smgf-accent); }

/* ---- No Results ---- */
.smgf-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--smgf-muted);
}
.smgf-no-results svg { margin-bottom: 1rem; opacity: .3; }
.smgf-no-results p { margin: .25rem 0; font-size: .95rem; }
.smgf-no-results-sub { font-size: .82rem; }

/* ---- Pagination ---- */
.smgf-pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: 1.75rem;
}

.smgf-page-btn {
  min-width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 .65rem;
  border: 1px solid var(--smgf-border);
  border-radius: 6px;
  background: var(--smgf-surface);
  color: var(--smgf-text);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--smgf-transition);
}
.smgf-page-btn:hover {
  background: var(--smgf-primary-light);
  border-color: var(--smgf-primary);
  color: var(--smgf-primary);
}
.smgf-page-btn.is-active {
  background: var(--smgf-primary);
  border-color: var(--smgf-primary);
  color: #fff;
  cursor: default;
}
.smgf-page-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ---- Loading overlay ---- */
.smgf-results-wrapper {
  position: relative;
}
.smgf-loading {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: var(--smgf-radius);
}
.smgf-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--smgf-border);
  border-top-color: var(--smgf-primary);
  border-radius: 50%;
  animation: smgf-spin .7s linear infinite;
}
@keyframes smgf-spin { to { transform: rotate(360deg); } }

/* ---- Disabled filter field (no options available) ---- */
.smgf-field--disabled label {
  opacity: .45;
}
.smgf-field--disabled select {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .smgf-filter-bar { padding: 1rem; }
  .smgf-field { flex: 1 1 100%; }
  .smgf-actions { width: 100%; }
  .smgf-btn { width: 100%; justify-content: center; }
  .smgf-cards-grid { grid-template-columns: 1fr; }
}
