/* ========================================
   KANZ — The Hadith Collection
   A second jewelry box. Same shop, different display case.
   Spinel cards, Pearl chrome.
   ======================================== */

/* ---- Shared values ---- */
:root {
  --spinel-hover-shadow: 0 0 30px rgba(74, 10, 58, 0.4);
  --spinel-hover-shadow-strong: 0 0 30px rgba(74, 10, 58, 0.5);
}

/* ================================================================
   HOME ENTRY CARD — Pearl-toned shelf
   ================================================================ */
.hadith-entry {
  display: block;
  width: 100%;
  text-align: center;
  padding: var(--space-lg) var(--space-md);
  background: var(--spinel-bg);
  border: 2px solid var(--spinel-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: var(--font-body);
}

.hadith-entry:hover {
  background: var(--spinel-bg-hover);
  box-shadow: var(--spinel-hover-shadow);
  transform: translateY(-2px);
}

.hadith-entry__text {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: #fff;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
}

.hadith-entry__subtitle {
  display: block;
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
  font-style: italic;
}


/* ================================================================
   DOWNLOAD SCREEN — First launch experience
   ================================================================ */
.hadith-download {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  max-width: 700px;
  margin: 0 auto;
}

.hadith-download__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text);
  margin-bottom: var(--space-md);
}

.hadith-download__status {
  font-size: var(--text-sm);
  color: var(--text-light);
  margin-bottom: var(--space-lg);
  min-height: 1.5em;
}

.hadith-download__progress-track {
  width: 100%;
  height: 6px;
  background: var(--pearl-bg);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.hadith-download__progress-fill {
  height: 100%;
  background: var(--spinel);
  border-radius: 3px;
  transition: width 300ms ease;
  width: 0%;
}

.hadith-download__book-count {
  font-size: var(--text-xs);
  color: var(--text-lighter);
}


/* ================================================================
   LIBRARY HEADER — Back button + title at each level
   ================================================================ */
.hadith-header {
  margin-bottom: var(--space-lg);
}

.hadith-header__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text);
  margin-top: var(--space-sm);
}

.hadith-header__subtitle {
  font-size: var(--text-sm);
  color: var(--text-lighter);
  font-style: italic;
  margin-top: 2px;
}

.hadith-header__arabic {
  font-family: var(--font-arabic);
  font-size: var(--text-2xl);
  color: var(--chip-spinel);
  direction: rtl;
  text-align: center;
  margin-bottom: var(--space-xs);
}


/* ================================================================
   SEARCH — Library search bar
   ================================================================ */
.hadith-search {
  margin-bottom: var(--space-md);
}

.hadith-search input {
  width: 100%;
  padding: 10px 16px;
  font-size: 16px; /* Prevent iOS zoom */
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}

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

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


/* ================================================================
   BOOKS GRID — 9 collection cards
   ================================================================ */
.hadith-books-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}

@media (min-width: 640px) {
  .hadith-books-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.hadith-book-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-lg) var(--space-md);
  background: var(--spinel-bg);
  border: 2px solid var(--spinel-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: var(--font-body);
  animation: gemReveal 300ms ease-out both;
  will-change: opacity, transform;
}

.hadith-book-card:hover {
  background: var(--spinel-bg-hover);
  box-shadow: var(--spinel-hover-shadow-strong);
  transform: translateY(-2px);
}

.hadith-book-card__arabic {
  font-family: var(--font-arabic);
  font-size: var(--text-lg);
  color: #fff;
  direction: rtl;
  line-height: 1.6;
  margin-bottom: var(--space-xs);
}

.hadith-book-card__english {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.85);
  font-weight: var(--weight-medium);
}

.hadith-book-card__count {
  font-size: var(--text-xxs);
  color: rgba(255, 255, 255, 0.45);
  margin-top: var(--space-xs);
}


/* ================================================================
   CHAPTER LIST — Book > Chapters
   ================================================================ */
.hadith-chapter-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.hadith-chapter-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-section);
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast);
  font-family: var(--font-body);
  text-align: left;
  width: 100%;
  animation: gemReveal 300ms ease-out both;
  will-change: opacity, transform;
}

.hadith-chapter-item:hover {
  background: var(--bg-aside);
}

.hadith-chapter-item__left {
  flex: 1;
  min-width: 0;
}

.hadith-chapter-item__number {
  font-size: var(--text-xxs);
  color: var(--text-lighter);
  margin-bottom: 2px;
}

.hadith-chapter-item__arabic {
  font-family: var(--font-arabic);
  font-size: var(--text-base);
  color: var(--chip-spinel);
  direction: rtl;
  line-height: 1.5;
}

.hadith-chapter-item__english {
  font-size: var(--text-sm);
  color: var(--text-light);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hadith-chapter-item__count {
  font-size: var(--text-xxs);
  color: var(--text-lighter);
  white-space: nowrap;
}


/* ================================================================
   GRADING BADGES
   ================================================================ */
.hadith-grading {
  display: inline-block;
  font-size: var(--text-xxs);
  font-weight: var(--weight-medium);
  padding: 2px 8px;
  border-radius: 50px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.hadith-grading--sahih {
  color: var(--chip-emerald);
  border: 1px solid rgba(61, 184, 142, 0.3);
}

.hadith-grading--hasan {
  color: var(--chip-topaz);
  border: 1px solid rgba(212, 160, 80, 0.3);
}

.hadith-grading--daif {
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
}


/* ================================================================
   NARRATOR LINE — Inside hadith cards
   ================================================================ */
.gem-card__narrator {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.55);
  font-style: italic;
  margin-top: var(--space-xs);
  margin-bottom: var(--space-sm);
}


/* ================================================================
   CROSS-REFERENCE LINK
   ================================================================ */
.hadith-crossref {
  font-size: var(--text-xs);
  color: var(--chip-spinel);
  cursor: pointer;
  transition: opacity var(--transition-fast);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.hadith-crossref:hover {
  opacity: 0.8;
  text-decoration: underline;
}


/* ================================================================
   SEARCH RESULTS — Grouped by book
   ================================================================ */
.hadith-search-group {
  margin-bottom: var(--space-lg);
}

.hadith-search-group__label {
  font-size: var(--text-xs);
  color: var(--chip-spinel);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-sm);
  font-weight: var(--weight-medium);
}


/* ================================================================
   BOOK SELECTION — First launch + manage collections
   ================================================================ */
.hadith-select-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  margin: var(--space-md) 0;
}

@media (min-width: 640px) {
  .hadith-select-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.hadith-select-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-lg) var(--space-sm);
  background: var(--bg-section);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.hadith-select-item:hover {
  background: var(--bg-aside);
  border-color: var(--spinel-border);
}

/* Selected state — Spinel border + subtle bg */
.hadith-select-item:has(.hadith-select-check:checked) {
  border-color: var(--spinel-border);
  background: rgba(74, 10, 58, 0.15);
}

.hadith-select-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  accent-color: var(--spinel);
}

.hadith-select-item__info {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hadith-select-item__name {
  display: block;
  font-size: var(--text-sm);
  color: var(--text);
  font-weight: var(--weight-medium);
  margin-top: var(--space-xs);
}

.hadith-select-item__arabic {
  display: block;
  font-family: var(--font-arabic);
  font-size: var(--text-base);
  color: var(--chip-spinel);
  direction: rtl;
  line-height: 1.6;
}

.hadith-select-item__meta {
  font-size: var(--text-xxs);
  color: var(--text-lighter);
  margin-top: 4px;
}

.hadith-select-item--downloaded {
  border-color: rgba(61, 184, 142, 0.3);
}

.hadith-select-item--downloaded .hadith-select-item__meta {
  color: var(--chip-emerald);
}

.hadith-select-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
  padding-bottom: 100px;
}

.hadith-select-all {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-light);
  cursor: pointer;
  padding: 8px 0;
  transition: color var(--transition-fast);
}

.hadith-select-all:hover {
  color: var(--text);
}


/* ================================================================
   GRID ACTION BUTTONS — Random + Manage
   ================================================================ */
.hadith-grid-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.hadith-action-btn {
  background: var(--spinel-bg);
  border: 1.5px solid var(--spinel-border);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  padding: 8px 20px;
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.hadith-action-btn:hover {
  background: var(--spinel-bg-hover);
  box-shadow: 0 0 20px rgba(74, 10, 58, 0.3);
}

.hadith-action-btn--subtle {
  background: none;
  border-color: var(--border);
  color: var(--text-lighter);
  font-size: var(--text-xs);
}

.hadith-action-btn--subtle:hover {
  border-color: var(--text-lighter);
  color: var(--text-light);
  box-shadow: none;
}

.hadith-action-btn--glow {
  background: rgba(74, 10, 58, 0.35);
  border-color: var(--spinel-border);
  color: var(--chip-spinel);
  font-size: var(--text-xs);
}

.hadith-action-btn--glow:hover {
  background: rgba(74, 10, 58, 0.5);
  box-shadow: 0 0 16px rgba(74, 10, 58, 0.25);
}
