@font-face {
  font-family: 'Uthmanic';
  src: url('../fonts/uthmanic_warsh_v21.ttf') format('truetype');
}

@font-face {
  font-family: 'Amiri';
  src: url('../fonts/Amiri Quran Regular.ttf') format('truetype');
}

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

body {
  font-family: 'Amiri', Arial, sans-serif;
  background-color: #f4ecd8;
  color: #3e2723;
  height: 100dvh;
  overflow: hidden;
}

html {
  height: 100%;
  overscroll-behavior: none;
}

html,
body {
  max-height: 100dvh;
}

.h-100 {
  height: 100% !important;
  max-height: 100dvh !important;
}

/* ── Offcanvas Sidebar ─────────────────────────────────────────────────────── */

.offcanvas {
  background-color: #e8dcc4;
  width: 320px !important;
  max-width: 85vw;
}

.offcanvas-header {
  background-color: #e8dcc4;
  border-bottom: 2px solid #d4c5a9;
  padding: 20px;
}

.offcanvas-title {
  color: #5d4037;
  font-size: 24px;
  font-weight: bold;
}

.offcanvas-body {
  padding: 20px;
  overflow-y: auto;
}

.btn-close {
  filter: invert(0.3) sepia(1) saturate(5) hue-rotate(-30deg);
}

/* ── Menu Button ───────────────────────────────────────────────────────────── */

.menu-btn {
  background-color: #8d6e63;
  color: white;
  border: none;
  border-radius: 8px;
  width: 45px;
  height: 45px;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-btn:hover {
  background-color: #6d4c41;
  transform: scale(1.05);
}

.menu-btn i {
  line-height: 1;
}

/* ── Form Controls ─────────────────────────────────────────────────────────── */

.form-label {
  font-weight: bold;
  color: #5d4037;
  font-size: 14px;
  margin-bottom: 6px;
}

.form-select {
  padding: 10px;
  border: 1px solid #c4b5a0;
  border-radius: 5px;
  background-color: #faf7f0;
  color: #3e2723;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.form-select:hover {
  border-color: #a89379;
  background-color: #ffffff;
}

.form-select:focus {
  border-color: #8d6e63;
  box-shadow: 0 0 5px rgba(141, 110, 99, 0.3);
  background-color: #faf7f0;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */

.btn-custom {
  padding: 12px;
  background-color: #8d6e63;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.btn-custom:hover {
  background-color: #6d4c41;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-custom:active {
  transform: translateY(0);
  background-color: #6d4c41;
  color: white;
}

/* ── Audio Player ──────────────────────────────────────────────────────────── */

.audio-player-container {
  margin-top: 15px;
}

#audio-player {
  border-radius: 5px;
}

/* ── Main Content ──────────────────────────────────────────────────────────── */

.main-content {
  display: flex;
  flex-direction: column;
  background-color: #f4ecd8;
  overflow: hidden;
  height: 100dvh;
  max-height: 100dvh;
}

.header {
  background-color: #e8dcc4;
  padding: 15px 10px;
  border-bottom: 2px solid #d4c5a9;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.nav-btn {
  background-color: #8d6e63;
  color: white;
  border: none;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-btn:hover {
  background-color: #6d4c41;
  transform: scale(1.1);
}

.nav-btn:disabled {
  background-color: #d4c5a9;
  cursor: not-allowed;
  transform: scale(1);
}

.page-info-wrapper {
  min-width: 200px;
  max-width: 500px;
}

#sura-title {
  font-size: 24px;
  color: #5d4037;
  font-weight: bold;
  margin: 0;
}

#page-info {
  font-size: 15px;
  color: #6d4c41;
  margin: 0;
}

/* ── Quran Text ────────────────────────────────────────────────────────────── */

.quran-text-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 30px 15px;
  background: linear-gradient(to bottom, #f4ecd8, #ede3cf);
}

.quran-text {
  background-color: #faf7f0;
  padding: 30px 20px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: 2px solid #d4c5a9;
  line-height: 2.5;
  font-size: 28px;
  font-family: 'Uthmanic', serif;
  text-align: justify;
  min-height: 400px;
}

/* ── Ayah Spans ────────────────────────────────────────────────────────────── */

.ayah {
  display: inline;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all 0.3s ease;
}

.ayah:hover {
  background-color: #ffe0b2;
}

.ayah.active {
  background-color: #ffb74d;
  color: #3e2723;
  font-weight: bold;
}

/* ── Surah / Basmala Headers ───────────────────────────────────────────────── */

.basmala {
  text-align: center;
  font-size: 28px;
  font-family: 'Amiri', serif;
  margin: 15px 0;
  color: #5d4037;
}

.sura-header {
  text-align: center;
  font-size: 32px;
  font-family: 'Amiri', serif;
  color: #5d4037;
  margin: 25px 0;
  padding: 15px;
  background-color: #e8dcc4;
  border-radius: 10px;
  border: 2px solid #d4c5a9;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #e8dcc4;
}

::-webkit-scrollbar-thumb {
  background: #8d6e63;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6d4c41;
}

/* ── Tablet ────────────────────────────────────────────────────────────────── */

@media (max-width: 991px) and (min-width: 768px) {
  .quran-text {
    font-size: 26px;
    padding: 30px;
  }

  .sura-header {
    font-size: 30px;
  }

  .basmala {
    font-size: 26px;
  }
}

/* ── Mobile ────────────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
  .header {
    padding: 10px 5px;
  }

  .nav-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .menu-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .page-info-wrapper {
    min-width: 150px;
    max-width: 100%;
  }

  #sura-title {
    font-size: 18px;
  }

  #page-info {
    font-size: 12px;
  }

  .quran-text-container {
    padding: 15px 10px;
    padding-bottom: 30px;
  }

  .quran-text {
    font-size: 20px;
    padding: 20px 15px;
    line-height: 2.2;
    min-height: 300px;
  }

  .sura-header {
    font-size: 24px;
    padding: 12px;
    margin: 15px 0;
  }

  .basmala {
    font-size: 20px;
    margin: 10px 0;
  }

  .offcanvas {
    width: 280px !important;
  }

  .form-label {
    font-size: 13px;
  }

  .form-select {
    font-size: 13px;
    padding: 8px;
  }

  .btn-custom {
    padding: 10px;
    font-size: 13px;
  }
}

/* ── Extra Small Mobile ────────────────────────────────────────────────────── */

@media (max-width: 374px) {
  #sura-title {
    font-size: 16px;
  }

  #page-info {
    font-size: 11px;
  }

  .quran-text {
    font-size: 18px;
    padding: 15px 10px;
  }

  .sura-header {
    font-size: 20px;
  }

  .basmala {
    font-size: 18px;
  }

  .nav-btn,
  .menu-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

/* ── Landscape Mobile ──────────────────────────────────────────────────────── */

@media (max-height: 500px) and (orientation: landscape) {
  .header {
    padding: 8px 5px;
  }

  .nav-btn,
  .menu-btn {
    width: 35px;
    height: 35px;
  }

  #sura-title {
    font-size: 16px;
  }

  #page-info {
    font-size: 12px;
  }

  .quran-text-container {
    padding: 10px;
  }

  .quran-text {
    padding: 15px;
    font-size: 18px;
    line-height: 2;
  }
}

/* ── Print ─────────────────────────────────────────────────────────────────── */

@media print {
  .offcanvas,
  .header,
  .nav-btn,
  .menu-btn {
    display: none !important;
  }

  .main-content {
    height: auto;
  }

  .quran-text-container {
    padding: 0;
  }

  .quran-text {
    box-shadow: none;
    border: none;
  }
}
