
/* =========================================================
   IQRANIX — QURAN SURAH SELECTION
   Royal Sapphire + Champagne Gold
   Fixed viewport / independent Surah list scrolling
========================================================= */

:root {
  --navy: #091747;
  --navy-deep: #050d28;
  --navy-card: #0d2c8e;
  --blue: #1746a2;
  --blue-light: #3b82f6;
  --champagne: #f1d9a0;
  --gold: #d8b66d;
  --white: #f6f7ff;
  --muted: #aab7d8;
  --border: rgba(241, 217, 160, 0.2);
  --glass: rgba(255, 255, 255, 0.055);
}

/* RESET */

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  height: 100dvh;
  background: var(--navy-deep);
  color: var(--white);
  font-family: "DM Sans", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* MAIN PAGE */

.surahs-page {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 650px;
  height: 100%;
  height: 100dvh;
  margin: 0 auto;

  padding:
    max(10px, env(safe-area-inset-top))
    17px
    max(8px, env(safe-area-inset-bottom));

  display: flex;
  flex-direction: column;
  overflow: hidden;

  background:
    radial-gradient(
      ellipse at 50% 20%,
      rgba(23, 70, 162, 0.32),
      transparent 55%
    ),
    radial-gradient(
      ellipse at 100% 85%,
      rgba(59, 130, 246, 0.13),
      transparent 45%
    ),
    linear-gradient(
      155deg,
      #091747 0%,
      #071234 55%,
      #050d28 100%
    );
}

/* BACKGROUND LIGHTS */

.surahs-page::before,
.surahs-page::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  filter: blur(85px);
  pointer-events: none;
}

.surahs-page::before {
  top: 25%;
  left: -110px;
  background: rgba(59, 130, 246, 0.25);
}

.surahs-page::after {
  right: -110px;
  bottom: 15%;
  background: rgba(23, 70, 162, 0.3);
}

/* HEADER */

.surahs-header {
  flex: 0 0 auto;
  min-height: 62px;

  display: grid;
  grid-template-columns: 43px 1fr 43px;
  align-items: center;
  gap: 10px;

  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.surahs-back,
.surahs-header-icon {
  width: 41px;
  height: 41px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--glass);
  color: var(--champagne);
}

.surahs-back {
  text-decoration: none;
}

.surahs-back svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.surahs-header-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linejoin: round;
}

.surahs-brand {
  text-align: center;
}

.surahs-brand h1 {
  color: var(--champagne);
  font-family: "Playfair Display", serif;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 3px;
}

.surahs-brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 3px;
}

/* RECITER INFORMATION */

.selected-reciter {
  flex: 0 0 auto;

  display: flex;
  align-items: center;
  gap: 15px;

  margin-top: 13px;
  padding: 12px;

  border: 1px solid var(--border);
  border-radius: 19px;

  background:
    linear-gradient(
      115deg,
      rgba(23, 70, 162, 0.28),
      rgba(255, 255, 255, 0.035)
    );

  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.selected-reciter-image {
  flex: 0 0 auto;
  width: 67px;
  height: 67px;

  padding: 3px;
  border-radius: 50%;

  background: linear-gradient(
    140deg,
    #fff0c6,
    #c49a50,
    #f6e4b6,
    #9b7438
  );

  box-shadow:
    0 0 0 3px rgba(241, 217, 160, 0.08),
    0 0 18px rgba(216, 182, 109, 0.12);

  overflow: hidden;
}

.selected-reciter-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
  background: #10265d;
}

#reciterImageFallback {
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #10265d;
  color: var(--champagne);
  font-family: "Playfair Display", serif;
  font-size: 24px;
  font-weight: 700;
}

.selected-reciter-details {
  min-width: 0;
  flex: 1;
}

.section-eyebrow {
  display: block;
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2.5px;
}

.selected-reciter-details h2 {
  margin-top: 4px;
  color: var(--white);
  font-family: "Playfair Display", serif;
  font-size: clamp(16px, 4.5vw, 21px);
  line-height: 1.25;
}

.selected-reciter-details > p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 1.2px;
}

.reciter-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  margin-top: 8px;
  padding: 5px 9px;

  border: 1px solid rgba(241, 217, 160, 0.17);
  border-radius: 20px;

  background: rgba(255, 255, 255, 0.045);
  color: var(--champagne);

  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #70dfad;
  box-shadow: 0 0 8px rgba(112, 223, 173, 0.7);
}

/* SURAH INTRODUCTION */

.surahs-intro {
  flex: 0 0 auto;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding: 17px 2px 12px;
}

.surahs-intro h2 {
  margin-top: 4px;
  color: var(--white);
  font-family: "Playfair Display", serif;
  font-size: 24px;
  font-weight: 600;
}

.surahs-intro p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.surah-total {
  flex: 0 0 auto;

  min-width: 57px;
  padding: 9px 10px;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;

  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--glass);
}

.surah-total strong {
  color: var(--champagne);
  font-family: "Playfair Display", serif;
  font-size: 21px;
}

.surah-total span {
  color: var(--muted);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

/* SEARCH */

.surah-search-container {
  flex: 0 0 auto;
  padding-bottom: 11px;
}

.surah-search-box {
  width: 100%;
  height: 44px;

  display: flex;
  align-items: center;
  gap: 10px;

  padding: 0 13px;

  border: 1px solid rgba(241, 217, 160, 0.18);
  border-radius: 13px;

  background: rgba(255, 255, 255, 0.06);

  transition: border-color 0.2s ease;
}

.surah-search-box:focus-within {
  border-color: var(--gold);
}

.surah-search-box svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;

  fill: none;
  stroke: var(--gold);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.surah-search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;

  border: none;
  outline: none;

  background: transparent;
  color: var(--white);

  font-family: inherit;
  font-size: 12px;
}

.surah-search-box input::placeholder {
  color: #91a1c8;
}

.surah-search-box input::-webkit-search-cancel-button {
  display: none;
}

.clear-search {
  width: 25px;
  height: 25px;

  border: none;
  border-radius: 50%;

  background: rgba(241, 217, 160, 0.12);
  color: var(--champagne);

  font-size: 19px;
  cursor: pointer;
}

.clear-search[hidden] {
  display: none;
}

/* SURAH LIST
   Only this section scrolls.
*/

.surah-list {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;

  display: flex;
  flex-direction: column;
  gap: 8px;

  overflow-y: auto;
  overflow-x: hidden;

  padding: 2px 3px 12px 0;

  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(216, 182, 109, 0.5) transparent;
}

.surah-list::-webkit-scrollbar {
  width: 3px;
}

.surah-list::-webkit-scrollbar-track {
  background: transparent;
}

.surah-list::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: rgba(216, 182, 109, 0.5);
}

/* SURAH CARD
   These classes are ready for the JavaScript renderer.
*/

.surah-card {
  position: relative;
  flex: 0 0 auto;

  width: 100%;
  min-height: 67px;

  display: flex;
  align-items: center;
  gap: 12px;

  padding: 9px 12px;

  border: 1px solid rgba(241, 217, 160, 0.13);
  border-radius: 15px;

  background:
    linear-gradient(
      110deg,
      rgba(23, 70, 162, 0.24),
      rgba(255, 255, 255, 0.045)
    );

  color: var(--white);
  text-decoration: none;
  text-align: left;

  cursor: pointer;

  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.surah-card:active {
  transform: scale(0.985);
  border-color: rgba(241, 217, 160, 0.5);
  background: rgba(23, 70, 162, 0.35);
}

/* NUMBER */

.surah-number {
  flex: 0 0 auto;

  width: 37px;
  height: 37px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(241, 217, 160, 0.3);
  border-radius: 11px;

  background: rgba(9, 23, 71, 0.7);
  color: var(--champagne);

  font-size: 11px;
  font-weight: 700;
}

/* SURAH NAME */

.surah-information {
  flex: 1;
  min-width: 0;
}

.surah-information h3 {
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.surah-information p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

/* ARABIC NAME */

.surah-arabic {
  flex: 0 0 auto;

  color: var(--champagne);
  font-family: "Amiri", serif;
  font-size: 21px;
  font-weight: 700;
  direction: rtl;
  white-space: nowrap;
}

/* PLAY ICON */

.surah-play-icon {
  flex: 0 0 auto;

  width: 30px;
  height: 30px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(241, 217, 160, 0.24);
  border-radius: 50%;

  background: rgba(241, 217, 160, 0.08);
  color: var(--champagne);
}

.surah-play-icon svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  stroke: currentColor;
}

/* LOADING */

.surah-loading {
  flex: 1;
  min-height: 120px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;

  color: var(--muted);
  text-align: center;
}

.surah-loading p {
  font-size: 11px;
}

.loading-spinner {
  width: 36px;
  height: 36px;

  border: 3px solid rgba(241, 217, 160, 0.15);
  border-top-color: var(--champagne);
  border-right-color: var(--blue-light);

  border-radius: 50%;

  animation: surahSpin 0.9s linear infinite;
}

@keyframes surahSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ERROR */

.surah-error {
  flex: 1;
  min-height: 140px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 20px;
  text-align: center;
}

.surah-error[hidden] {
  display: none;
}

.error-icon {
  width: 40px;
  height: 40px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(255, 130, 130, 0.4);
  border-radius: 50%;

  color: #ffaaaA;
  font-size: 22px;
}

.surah-error h3 {
  margin-top: 12px;
  color: var(--white);
  font-family: "Playfair Display", serif;
  font-size: 19px;
}

.surah-error p {
  max-width: 280px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.surah-error button {
  margin-top: 16px;
  padding: 11px 22px;

  border: 1px solid var(--gold);
  border-radius: 12px;

  background: linear-gradient(135deg, var(--blue), var(--navy-card));
  color: var(--champagne);

  font-family: inherit;
  font-size: 11px;
  font-weight: 700;

  cursor: pointer;
}

/* EMPTY SEARCH */

.surah-empty {
  flex: 1;
  min-height: 140px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 20px;
  text-align: center;
}

.surah-empty[hidden] {
  display: none;
}

.empty-icon {
  width: 44px;
  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--glass);
}

.empty-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--champagne);
  stroke-width: 1.6;
}

.surah-empty h3 {
  margin-top: 12px;
  color: var(--white);
  font-family: "Playfair Display", serif;
  font-size: 19px;
}

.surah-empty p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

/* FOOTER */

.surahs-footer {
  flex: 0 0 auto;

  min-height: 42px;
  padding-top: 7px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;

  border-top: 1px solid var(--border);
}

.surahs-footer span {
  color: var(--champagne);
  font-size: 13px;
  direction: rtl;
}

.surahs-footer p {
  color: var(--muted);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 2.5px;
}

/* HIDDEN ELEMENTS */

[hidden] {
  display: none !important;
}

/* SHORT PHONE SCREENS */

@media (max-height: 740px) {
  .surahs-header {
    min-height: 53px;
    padding-bottom: 7px;
  }

  .surahs-back,
  .surahs-header-icon {
    width: 36px;
    height: 36px;
  }

  .surahs-brand h1 {
    font-size: 22px;
  }

  .selected-reciter {
    margin-top: 8px;
    padding: 9px;
    gap: 11px;
  }

  .selected-reciter-image {
    width: 56px;
    height: 56px;
  }

  .surahs-intro {
    padding: 11px 2px 8px;
  }

  .surahs-intro h2 {
    font-size: 21px;
  }

  .surah-search-container {
    padding-bottom: 8px;
  }

  .surah-search-box {
    height: 40px;
  }

  .surah-card {
    min-height: 59px;
    padding: 7px 10px;
  }

  .surahs-footer {
    min-height: 34px;
    padding-top: 4px;
  }
}

/* NARROW PHONES */

@media (max-width: 350px) {
  .surahs-page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .selected-reciter-details h2 {
    font-size: 15px;
  }

  .surah-card {
    gap: 8px;
    padding: 8px;
  }

  .surah-number {
    width: 32px;
    height: 32px;
  }

  .surah-arabic {
    font-size: 18px;
  }

  .surah-play-icon {
    width: 27px;
    height: 27px;
  }
}

/* ACCESSIBILITY */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
