/* ==========================================================================
   quran-tajweed-tab.css — Вкладка «Таджвид»
   4 блока: Алфавит + Правила + Вакф + Сыфат
   ========================================================================== */

#tab-tajweed {
  overflow-y: auto;
  padding: 24px 32px;
}

/* --- Заголовок страницы --- */
.tajweed-page-header {
  text-align: center;
  margin-bottom: 28px;
}

.tajweed-page-title-ar {
  font-family: var(--font-arabic, 'Amiri', serif);
  font-size: 1.8rem;
  color: var(--emerald, #059669);
  margin: 0 0 4px;
}

.tajweed-page-title-ru {
  font-size: 1rem;
  font-weight: 500;
  color: var(--medium-gray, #888);
  margin: 0;
}

/* --- Секции --- */
.tajweed-section {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid #e5e7eb;
}

.tajweed-section-header {
  margin-bottom: 16px;
}

.tajweed-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--quran-text, #333);
  margin: 0 0 2px;
}

.tajweed-section-title-ar {
  font-family: var(--font-arabic, 'Amiri', serif);
  font-size: 0.95rem;
  color: var(--medium-gray, #888);
  margin: 0;
}

/* ==========================================================================
   Сетка букв алфавита
   ========================================================================== */

.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.letter-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1.5px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
}

.letter-card:hover {
  border-color: var(--emerald, #059669);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.letter-ar {
  font-family: var(--font-arabic, 'Amiri', serif);
  font-size: 2.5rem;
  line-height: 1.2;
  color: var(--quran-text, #333);
}

.letter-translit {
  font-size: 0.68rem;
  color: var(--medium-gray, #888);
  margin-top: 4px;
}

/* ==========================================================================
   Карточки правил (общие для блоков 2, 3, 4)
   ========================================================================== */

.tajweed-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.rule-card {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1.5px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
}

.rule-card:hover {
  border-color: var(--emerald, #059669);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.rule-color-bar {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  margin-inline-end: 12px;
  flex-shrink: 0;
}

.rule-info {
  min-width: 0;
}

.rule-name-ru {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--quran-text, #333);
}

.rule-name-ar {
  font-family: var(--font-arabic, 'Amiri', serif);
  font-size: 0.8rem;
  color: var(--medium-gray, #888);
}

.rule-count {
  font-size: 0.7rem;
  color: var(--medium-gray, #aaa);
  margin-top: 2px;
}

.waqf-sign {
  font-family: var(--font-arabic, 'Amiri', serif);
  font-size: 1rem;
  color: var(--emerald, #059669);
  margin-inline-end: 4px;
}

/* ==========================================================================
   Модалка
   ========================================================================== */

.tajweed-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.tajweed-modal-content {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.tajweed-modal-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  color: var(--medium-gray, #888);
  font-size: 1.4rem;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tajweed-modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* --- Модалка буквы --- */
.letter-modal-big {
  font-family: var(--font-arabic, 'Amiri', serif);
  font-size: 5rem;
  text-align: center;
  color: var(--quran-text, #333);
  line-height: 1.3;
}

.letter-modal-name {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--quran-text, #333);
  margin-bottom: 2px;
}

.letter-modal-translit {
  text-align: center;
  font-size: 0.82rem;
  color: var(--medium-gray, #888);
  margin-bottom: 16px;
}

.letter-modal-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 14px 0;
}

.letter-modal-section h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--quran-text, #333);
  margin: 0 0 4px;
}

.letter-modal-section p {
  font-size: 0.82rem;
  color: #555;
  margin: 0 0 4px;
  line-height: 1.5;
}

.letter-modal-ar {
  font-family: var(--font-arabic, 'Amiri', serif);
  color: var(--emerald, #059669);
  font-size: 0.9rem;
}

.letter-forms-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.letter-form {
  text-align: center;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.letter-form-ar {
  font-family: var(--font-arabic, 'Amiri', serif);
  font-size: 1.5rem;
  color: var(--quran-text, #333);
  display: block;
}

.letter-form-label {
  font-size: 0.65rem;
  color: var(--medium-gray, #888);
}

/* --- Модалки правил/вакф/сыфат --- */
.rule-modal h3, .waqf-modal h3, .sifa-modal h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.rule-modal-ar, .waqf-modal-ar, .sifa-modal-ar {
  font-family: var(--font-arabic, 'Amiri', serif);
  color: var(--emerald, #059669);
  font-size: 1rem;
  margin-bottom: 16px;
}

.rule-modal-stub {
  text-align: center;
  padding: 24px;
  background: color-mix(in srgb, var(--emerald) 3%, transparent);
  border-radius: 10px;
  border: 1px dashed #d1fae5;
  color: var(--medium-gray, #888);
  font-size: 0.85rem;
}

.waqf-modal-sign {
  font-family: var(--font-arabic, 'Amiri', serif);
  font-size: 3rem;
  text-align: center;
  color: var(--emerald, #059669);
  margin-bottom: 8px;
}

.waqf-modal-desc, .sifa-modal-desc {
  font-size: 0.88rem;
  color: #555;
  line-height: 1.6;
}

.sifa-modal-letters {
  font-family: var(--font-arabic, 'Amiri', serif);
  font-size: 1.2rem;
  color: var(--emerald, #059669);
  letter-spacing: 4px;
  margin-top: 12px;
}

/* ==========================================================================
   Ночной режим
   ========================================================================== */

.night-mode .tajweed-section {
  background: #1e293b;
  border-color: var(--quran-border);
}

.night-mode .letter-card {
  border-color: var(--quran-border);
}

.night-mode .letter-card:hover {
  border-color: #065f46;
}

.night-mode .letter-ar {
  color: #e0e0e0;
}

.night-mode .rule-card {
  border-color: var(--quran-border);
}

.night-mode .rule-card:hover {
  border-color: #065f46;
}

.night-mode .rule-name-ru {
  color: #e0e0e0;
}

.night-mode .tajweed-modal-content {
  background: #1e293b;
}

.night-mode .letter-modal-big {
  color: var(--quran-arabic, #f0e6d3);
}

.night-mode .letter-modal-divider {
  background: var(--quran-border);
}

.night-mode .letter-form {
  border-color: var(--quran-border);
}

.night-mode .letter-form-ar {
  color: #e0e0e0;
}

/* ==========================================================================
   Мобильный
   ========================================================================== */

@media (max-width: 767px) {
  #tab-tajweed { padding: 16px; }
  .tajweed-section { padding: 16px; }
  .alphabet-grid { grid-template-columns: repeat(5, 1fr); }
  .letter-ar { font-size: 1.8rem; }
  .letter-forms-grid { grid-template-columns: repeat(2, 1fr); }
}

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