/* ========================================
   ISLAMIC WEB APP — MAIN STYLESHEET
   ======================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans Bengali', 'Segoe UI', sans-serif;
  background: #f4f6f8;
  color: #2c3e50;
  line-height: 1.6;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

/* ========================================
   HEADER
   ======================================== */
.main-header {
  background: linear-gradient(135deg, #0f5132, #1a7f5a);
  color: #fff;
  padding: 30px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.main-header h1 {
  font-size: 1.8rem;
  font-weight: 600;
}

.main-header p {
  opacity: 0.85;
  margin-top: 5px;
}

.header-flex {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 20px;
}

.back-btn {
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.15);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: 0.2s;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.section-title {
  font-size: 1.4rem;
  margin-bottom: 20px;
  color: #0f5132;
  border-left: 4px solid #1a7f5a;
  padding-left: 12px;
}

/* ========================================
   CATEGORY GRID (Home Page)
   ======================================== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.category-card {
  background: #fff;
  border-radius: 14px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 2px solid transparent;
}

.category-card:hover {
  transform: translateY(-5px);
  border-color: #1a7f5a;
  box-shadow: 0 8px 20px rgba(26, 127, 90, 0.2);
}

.category-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.category-card h3 {
  font-size: 1.3rem;
  color: #0f5132;
  margin-bottom: 5px;
}

.category-card .bn-name {
  color: #666;
  font-size: 0.95rem;
}

/* ========================================
   SURAH GRID (Quran Page)
   ======================================== */
.surah-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.surah-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: 0.2s;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.surah-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(26, 127, 90, 0.18);
}

.surah-number {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, #0f5132, #1a7f5a);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
}

.surah-meta h4 {
  font-size: 1.05rem;
  color: #0f5132;
  margin-bottom: 2px;
}

.surah-meta .bn {
  font-size: 0.9rem;
  color: #555;
}

.surah-meta .ar {
  font-family: 'Amiri', serif;
  font-size: 1.1rem;
  color: #1a7f5a;
  text-align: right;
  margin-left: auto;
}

/* ========================================
   SURAH DETAIL
   ======================================== */
.surah-info {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 24px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.surah-info .ar-name {
  font-family: 'Amiri', serif;
  font-size: 2.4rem;
  color: #0f5132;
  margin-bottom: 8px;
}

.surah-info .en-name {
  font-size: 1.3rem;
  color: #1a7f5a;
  margin-bottom: 4px;
}

.surah-info .bn-name {
  color: #666;
  margin-bottom: 12px;
}

.surah-info .meta {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: #555;
}

.surah-info .meta span {
  background: #eaf5f0;
  padding: 4px 12px;
  border-radius: 20px;
}

/* ========================================
   AYAH TABLE
   ======================================== */
.table-wrapper {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ayah-table {
  width: 100%;
  border-collapse: collapse;
}

.ayah-table thead {
  background: linear-gradient(135deg, #0f5132, #1a7f5a);
  color: #fff;
}

.ayah-table th {
  padding: 14px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.95rem;
}

.ayah-table tbody tr {
  border-bottom: 1px solid #eef1f0;
  transition: 0.15s;
}

.ayah-table tbody tr:hover {
  background: #f6fbf8;
}

.ayah-table td {
  padding: 16px 12px;
  vertical-align: top;
}

.ayah-table td.num {
  font-weight: 600;
  color: #1a7f5a;
  width: 50px;
}

.ayah-table td.arabic {
  font-family: 'Amiri', serif;
  font-size: 1.5rem;
  direction: rtl;
  text-align: right;
  color: #0f5132;
  line-height: 2;
  width: 35%;
}

.ayah-table td.english {
  font-size: 0.95rem;
  color: #333;
  width: 32%;
}

.ayah-table td.bangla {
  font-family: 'Noto Sans Bengali', sans-serif;
  font-size: 0.95rem;
  color: #444;
  width: 32%;
}

/* ========================================
   HADITH — FILTER SECTION
   ======================================== */
.filter-section {
  margin-bottom: 28px;
}

.filter-title {
  font-size: 1rem;
  color: #0f5132;
  margin-bottom: 12px;
  font-weight: 600;
}

.filter-bar {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.filter-bar::-webkit-scrollbar {
  height: 6px;
}

.filter-bar::-webkit-scrollbar-thumb {
  background: #c8ddd2;
  border-radius: 10px;
}

.filter-btn {
  flex-shrink: 0;
  background: #fff;
  border: 2px solid #e0efe7;
  border-radius: 12px;
  padding: 12px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  transition: 0.2s;
  font-family: inherit;
}

.filter-btn span {
  font-weight: 600;
  color: #0f5132;
  font-size: 0.95rem;
}

.filter-btn small {
  color: #777;
  font-size: 0.8rem;
}

.filter-btn:hover {
  border-color: #1a7f5a;
  transform: translateY(-2px);
}

.filter-btn.active {
  background: linear-gradient(135deg, #0f5132, #1a7f5a);
  border-color: #0f5132;
}

.filter-btn.active span,
.filter-btn.active small {
  color: #fff;
}

/* ========================================
   HADITH — LIST
   ======================================== */
.hadith-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.hadith-list-header .section-title {
  margin-bottom: 0;
}

.hadith-count {
  background: #eaf5f0;
  color: #0f5132;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.hadith-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.hadith-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #eef3f0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hadith-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(26, 127, 90, 0.15);
  border-color: #1a7f5a;
}

.hadith-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hadith-number {
  background: linear-gradient(135deg, #0f5132, #1a7f5a);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}

.hadith-grade {
  font-size: 0.75rem;
  color: #1a7f5a;
  background: #eaf5f0;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.hadith-preview {
  font-size: 0.92rem;
  color: #333;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hadith-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #777;
  border-top: 1px dashed #e0efe7;
  padding-top: 10px;
}

.view-btn {
  color: #1a7f5a;
  font-weight: 600;
}

/* ========================================
   MODAL (Hadith Detail)
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 81, 50, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 32px 30px 26px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: #f0f4f2;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  color: #0f5132;
  transition: 0.2s;
}

.modal-close:hover {
  background: #1a7f5a;
  color: #fff;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid #eaf5f0;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-book {
  font-weight: 600;
  color: #0f5132;
  font-size: 1.05rem;
}

.modal-hadith-no {
  background: #eaf5f0;
  color: #1a7f5a;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.modal-arabic {
  font-family: 'Amiri', serif;
  font-size: 1.6rem;
  direction: rtl;
  text-align: right;
  line-height: 2.2;
  color: #0f5132;
  background: #f6fbf8;
  padding: 22px 20px;
  border-radius: 12px;
  margin-bottom: 22px;
  border-right: 4px solid #1a7f5a;
}

.modal-section {
  margin-bottom: 18px;
}

.modal-section h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #1a7f5a;
  margin-bottom: 8px;
  font-weight: 700;
}

.modal-section p {
  font-size: 1rem;
  color: #2c3e50;
  line-height: 1.7;
}

.modal-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f4f6f8;
  padding: 16px 18px;
  border-radius: 10px;
  margin-top: 22px;
  font-size: 0.88rem;
  color: #444;
}

.modal-meta strong {
  color: #0f5132;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .main-header h1 { font-size: 1.3rem; }

  /* Ayah table → stacked cards */
  .ayah-table thead { display: none; }

  .ayah-table,
  .ayah-table tbody,
  .ayah-table tr,
  .ayah-table td {
    display: block;
    width: 100%;
  }

  .ayah-table tr {
    margin-bottom: 20px;
    background: #f9fdfb;
    border-radius: 10px;
    padding: 12px;
    border: 1px solid #e0efe7;
  }

  .ayah-table td {
    padding: 8px 0;
    width: 100% !important;
  }

  .ayah-table td.num {
    display: inline-block;
    background: #1a7f5a;
    color: #fff;
    width: 30px !important;
    height: 30px;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    padding: 0;
    margin-bottom: 8px;
  }

  .ayah-table td.arabic {
    font-size: 1.4rem;
    text-align: right;
    border-bottom: 1px dashed #cfe6da;
    padding-bottom: 12px;
  }
}

@media (max-width: 600px) {
  .modal-box {
    padding: 26px 20px 20px;
  }

  .modal-arabic {
    font-size: 1.35rem;
    padding: 16px;
  }

  .hadith-list {
    grid-template-columns: 1fr;
  }
}