/* ========================================
   Explore Page
   ======================================== */

/* Bookmark button */
.bookmark-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
  line-height: 1;
}

.bookmark-btn:hover {
  color: var(--accent);
  transform: scale(1.2);
}

.bookmark-btn--saved {
  color: var(--accent);
}

/* Search bar */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-input:focus {
  border-color: var(--accent);
}

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

/* Filter controls */
.explore-controls {
  margin-bottom: 24px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 8px;
}

.filter-select {
  padding: 8px 12px;
  font-size: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease;
  appearance: auto;
}

.filter-select:focus {
  border-color: var(--accent);
}

.filter-select--sm {
  padding: 8px 10px;
  min-width: 90px;
}

.threshold-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.threshold-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.search-count {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Root list */
.root-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.root-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
}

.root-item:hover {
  border-color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.root-item.expanded {
  border-color: var(--accent);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: none;
}

.root-item--added.expanded {
  border-color: var(--btn-good);
}

.root-item__arabic {
  font-family: var(--arabic-font);
  font-size: calc(var(--arabic-size) * 0.85);
  direction: rtl;
  min-width: 80px;
  text-align: center;
}

.root-item__info {
  flex: 1;
}

.root-item__latin {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.root-item__stats {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.root-item__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.root-item__status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.root-item__status--new {
  background: #dbeafe;
  color: #1d4ed8;
}

.root-item__status--learning {
  background: #fef3c7;
  color: #92400e;
}

.root-item__status--review {
  background: #d1fae5;
  color: #059669;
}

.add-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.add-btn:hover {
  background: var(--accent-hover);
}

.add-btn:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: default;
}

.remove-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.remove-btn:hover {
  color: var(--btn-again);
  border-color: var(--btn-again);
}

.remove-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Root detail (expanded view) */
.root-detail {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-md);
  margin-top: -1px;
  margin-bottom: 8px;
}

.root-detail--added {
  border-color: var(--btn-good);
}

/* Meaning shown inline in root item header */
.root-item__meaning {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 1px;
}

/* Sections */
.root-detail__section {
  margin-bottom: 20px;
}

.root-detail__section:last-child {
  margin-bottom: 0;
}

.root-detail__section-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* Lemma cards grid */
.lemma-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.lemma-card {
  padding: 10px 12px;
  background: var(--bg-accent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.lemma-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.lemma-card__arabic {
  font-family: var(--arabic-font);
  font-size: calc(var(--arabic-size) * 0.6);
  color: var(--accent);
  font-weight: 700;
  direction: rtl;
}

.lemma-card__meaning {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.lemma-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lemma-card__pos {
  font-size: 11px;
  padding: 1px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
}

.lemma-card__freq {
  font-size: 11px;
  color: var(--text-muted);
}

/* Verse cards */
.verse-card {
  padding: 14px 16px;
  background: var(--bg-accent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.verse-card:last-child {
  margin-bottom: 0;
}

.verse-card__ref {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}

.verse-card__arabic {
  font-family: var(--arabic-font);
  font-size: var(--arabic-size);
  direction: rtl;
  text-align: right;
  line-height: 2;
  margin-bottom: 8px;
}

.verse-card__translation {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
}

.arabic-highlight {
  color: var(--accent);
  font-weight: 700;
  background: rgba(var(--accent-rgb, 59, 130, 246), 0.08);
  padding: 2px 4px;
  border-radius: 4px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.pagination__btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pagination__btn:hover {
  background: var(--bg-accent);
}

.pagination__btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.pagination__info {
  font-size: 13px;
  color: var(--text-muted);
}

/* Batch select checkbox */
.root-item__checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* Added state — green border */
.root-item--added {
  border-color: var(--btn-good);
}

/* Batch action bar */
.batch-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--bg-card);
  border-top: 2px solid var(--accent);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(100%);
  transition: transform 0.25s ease;
  z-index: 100;
}

.batch-bar--visible {
  transform: translateY(0);
}

.batch-bar__count {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.batch-bar__add {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease;
}

.batch-bar__add:hover {
  background: var(--accent-hover);
}

.batch-bar__add:disabled {
  opacity: 0.5;
  cursor: default;
}

.batch-bar__clear {
  padding: 8px 16px;
  font-size: 13px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
}

.batch-bar__clear:hover {
  color: var(--text-primary);
}

/* Toast notification */
.batch-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--text-primary);
  color: var(--bg-card);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  z-index: 101;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.batch-toast--visible {
  opacity: 1;
}

@media (max-width: 640px) {
  .root-item {
    flex-wrap: wrap;
    gap: 8px;
  }

  .root-item__arabic {
    min-width: 60px;
  }

  .root-item__actions {
    width: 100%;
    justify-content: flex-end;
  }

  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    flex-direction: column;
  }

  .filter-select {
    width: 100%;
  }

  .threshold-control {
    flex-wrap: wrap;
  }
}
