*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  max-width: 100%;
}

body {
  width: 100%;
}

.engine-wrapper,
.hero-shell,
.fiqh-insight {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  color: #eef4ff;
  background:
    radial-gradient(circle at 14% 12%, rgba(147, 197, 253, 0.22), transparent 28%),
    radial-gradient(circle at 86% 14%, rgba(125, 211, 252, 0.2), transparent 32%),
    linear-gradient(160deg, #081b36 0%, #0a2c55 40%, #0f3f79 72%, #0a2f5c 100%);
}

.navbar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(6, 17, 34, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

@media (max-width: 768px) {
  .navbar {
    position: static;
    top: auto;
  }
}

.nav-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}

.logo {
  text-decoration: none;
  color: #eaf4ff;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.nav-brand{
  text-decoration:none;
  color:inherit;
  display:flex;
  align-items:center;
  flex-shrink:0;
}

.nav-brand-glass{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  border-radius:16px;
  background:rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.12);
  box-shadow:0 12px 30px rgba(0,0,0,0.22);
}

.nav-brand-icon{
  width:22px;
  height:22px;
  border-radius:8px;
}

.nav-brand-text{
  font-weight:800;
  letter-spacing:0.01em;
  white-space:nowrap;
  color:#eaf4ff;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 8px 12px;
  flex-wrap: wrap;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  box-sizing: border-box;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  max-width: min(72vw, 720px);
}

.nav-menu a {
  color: #d3e8ff;
  text-decoration: none;
  font-size: 0.92rem;
}

.nav-menu a:hover {
  color: #fef08a;
}

.lang-switch {
  margin-left: auto;
  display: inline-flex;
  border-radius: 999px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  position: relative;
  z-index: 3;
}

.lang-switch button {
  border: none;
  background: transparent;
  color: #dbeafe;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
}

.lang-switch button.active {
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
  color: #081527;
}

.hero {
  max-width: 980px;
  margin: 0 auto;
  padding: 70px 20px 24px;
  text-align: center;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4vw, 2.65rem);
  font-family: "Playfair Display", "Times New Roman", serif;
  letter-spacing: 0.02em;
  background: linear-gradient(96deg, #ffffff 0%, #dbeafe 46%, #7dd3fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  margin: 0 auto;
  max-width: 760px;
  color: rgba(238, 244, 255, 0.92);
  line-height: 1.75;
}

.engine-wrapper {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 20px 72px;
}

.engine-card {
  border-radius: 22px;
  padding: 26px;
  background:
    linear-gradient(160deg, rgba(9, 28, 56, 0.88), rgba(7, 20, 43, 0.86)),
    radial-gradient(circle at 16% 12%, rgba(34, 211, 238, 0.12), transparent 42%);
  border: 1px solid rgba(125, 211, 252, 0.26);
  box-shadow: 0 24px 48px rgba(3, 10, 24, 0.42);
  position: relative;
  overflow: hidden;
}

.engine-card::before {
  content: "";
  position: absolute;
  inset: -120px auto auto -120px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.16), transparent 68%);
  pointer-events: none;
}

.engine-card::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -100px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.2), transparent 70%);
  pointer-events: none;
}

.engine-card > * {
  position: relative;
  z-index: 1;
}

.engine-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.engine-head h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #f8fafc;
}

.step-text {
  font-size: 0.85rem;
  color: #bfdbfe;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-bottom: 22px;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #22d3ee, #3b82f6);
  transition: width 0.25s ease;
}

.question-box {
  border-radius: 16px;
  padding: 18px;
  border: 1px solid rgba(125, 211, 252, 0.28);
  background:
    linear-gradient(145deg, rgba(14, 42, 78, 0.78), rgba(8, 25, 49, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.question-title {
  margin: 0 0 14px;
  font-size: 1.02rem;
  line-height: 1.65;
}

.answer-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.btn-answer {
  border: none;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-yes {
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #052e22;
}

.btn-no {
  background: linear-gradient(135deg, #fca5a5, #f97316);
  color: #3a0f04;
}

.result-box {
  display: none;
  margin-top: 20px;
  border-radius: 16px;
  padding: 20px;
  background:
    linear-gradient(155deg, rgba(8, 28, 58, 0.94), rgba(9, 40, 74, 0.9)),
    radial-gradient(circle at 85% 18%, rgba(34, 211, 238, 0.16), transparent 42%);
  border: 1px solid rgba(125, 211, 252, 0.28);
  box-shadow:
    0 18px 36px rgba(2, 8, 22, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

.result-box.show {
  display: block;
}

.result-box h3 {
  margin: 0 0 14px;
  color: #fef3c7;
}

.result-line {
  margin: 8px 0;
  line-height: 1.65;
}

.result-line strong {
  color: #c7e4ff;
}

.result-line span {
  white-space: pre-line;
}

.result-arabic-line {
  border-top: 1px dashed rgba(125, 211, 252, 0.3);
  padding-top: 10px;
  margin-top: 12px;
}

.arabic-ibarah {
  display: block;
  margin-top: 4px;
  font-family: "Amiri", "Scheherazade New", serif;
  font-size: 1.08rem;
  line-height: 1.9;
  direction: rtl;
}

.reset-wrap {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.btn-reset {
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.08);
  color: #e2ecff;
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
}

.fiqh-insight {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px 38px;
}

.fiqh-insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.fiqh-insight-card {
  border-radius: 18px;
  padding: 18px 18px 16px;
  background:
    linear-gradient(160deg, rgba(8, 26, 52, 0.9), rgba(8, 22, 45, 0.86)),
    radial-gradient(circle at 86% 14%, rgba(45, 212, 191, 0.18), transparent 42%);
  border: 1px solid rgba(125, 211, 252, 0.22);
  box-shadow: 0 16px 34px rgba(3, 10, 24, 0.34);
}

.fiqh-insight-card h3 {
  margin: 0 0 10px;
  color: #fef3c7;
}

.fiqh-insight-card p {
  margin: 0;
  color: rgba(233, 241, 255, 0.95);
  line-height: 1.7;
}

.smart-method-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #d9e7ff;
  line-height: 1.7;
}

body.rtl-ui .smart-method-list {
  padding-left: 0;
  padding-right: 18px;
}

.smart-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding: 18px 16px 24px;
  text-align: center;
  color: #dbeafe;
}

body.rtl-ui {
  direction: rtl;
}

body.rtl-ui .lang-switch {
  margin-left: 0;
  margin-right: auto;
  z-index: 3;
}

body.rtl-ui .reset-wrap {
  justify-content: flex-start;
}

@media (max-width: 840px) {
  .nav-container {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-brand{
    width:100%;
    justify-content:center;
  }

  .nav-brand-glass{
    width:100%;
    justify-content:center;
    padding:9px 12px;
    border-radius:16px;
  }

  .nav-menu{
    position: static;
    left: auto;
    top: auto;
    transform: none;
    max-width: none;
    z-index: auto;
    width:100%;
    display:grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap:10px;
    padding:10px 10px;
    border-radius:18px;
    background:rgba(255,255,255,0.05);
    border:1px solid rgba(255,255,255,0.10);
    backdrop-filter: blur(12px);
    box-sizing:border-box;
    overflow:hidden;
    min-width:0;
  }

  .nav-menu a{
    display:flex;
    justify-content:center;
    padding:10px 8px;
    border-radius:14px;
    background: rgba(255,255,255,0.04);
    width:100%;
    min-width:0;
    box-sizing:border-box;
  }

  .lang-switch {
    margin-left: 0;
  }

  .answer-actions {
    grid-template-columns: 1fr;
  }

  .fiqh-insight-grid {
    grid-template-columns: 1fr;
  }
}

.scroll-to-top{
  position: fixed;
  left: 18px;
  bottom: 26px;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1200;

  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.scroll-to-top svg{
  width: 16px;
  height: 16px;
}

.scroll-to-top.show{
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-to-top:hover{
  transform: translateY(-2px);
  box-shadow:
    0 10px 22px rgba(0,0,0,0.35),
    0 6px 14px rgba(239,68,68,0.45);
}

.scroll-to-top:active{
  transform: scale(0.95);
}

@media (max-width: 840px) {
  .scroll-to-top{
    left: 16px;
    bottom: 20px;
  }
}

.hero-full {
  max-width: none;
  width: 100%;
  padding: 84px 20px 30px;
}

.hero-shell {
  max-width: 1040px;
  margin: 0 auto;
}

.hero-badge,
.insight-badge,
.ai-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.hero-badge,
.insight-badge {
  margin-bottom: 12px;
  color: #e0f2fe;
  background: rgba(125, 211, 252, 0.14);
  border: 1px solid rgba(125, 211, 252, 0.22);
}

.ai-chip {
  color: #082033;
  background: linear-gradient(135deg, #7dd3fc, #22d3ee);
}

.ai-panel {
  margin-top: 18px;
  border-top: 1px dashed rgba(125, 211, 252, 0.28);
  padding-top: 18px;
}

.ai-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ai-panel-head h4 {
  margin: 0;
  color: #fef3c7;
  font-size: 1rem;
}

.ai-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ai-card,
.ai-source-box {
  border-radius: 16px;
  padding: 16px;
  background: linear-gradient(150deg, rgba(14, 42, 78, 0.72), rgba(8, 25, 49, 0.8));
  border: 1px solid rgba(125, 211, 252, 0.2);
}

.ai-card strong,
.ai-source-box strong {
  display: block;
  margin-bottom: 8px;
  color: #c7e4ff;
}

.ai-card p,
.ai-source-box p {
  margin: 0;
  line-height: 1.75;
  color: #eef4ff;
}

.ai-source-box {
  margin-top: 12px;
}

body.rtl-ui .hero,
body.rtl-ui .hero h1,
body.rtl-ui .hero p {
  text-align: center;
}

body.rtl-ui .fiqh-insight-card,
body.rtl-ui .engine-card,
body.rtl-ui .result-box,
body.rtl-ui .ai-card,
body.rtl-ui .ai-source-box {
  text-align: right;
}

body.rtl-ui .ai-panel-head {
  flex-direction: row-reverse;
}

@media (max-width: 800px) {
  .fiqh-insight-grid,
  .ai-grid {
    grid-template-columns: 1fr;
  }

  .hero-full {
    padding-top: 70px;
  }

  .engine-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    line-height: 1.2;
  }

  .hero p,
  .fiqh-insight-card p,
  .ai-card p,
  .ai-source-box p,
  .result-line {
    font-size: 0.95rem;
  }

  .hero-badge,
  .insight-badge,
  .ai-chip {
    font-size: 0.72rem;
  }
}


/* Longer smart-haid questions */
.question-box {
  padding: 22px;
}

.question-title {
  font-size: 1.08rem;
  line-height: 1.82;
  max-width: 100%;
  color: #f8fbff;
}

@media (min-width: 900px) {
  .question-box {
    padding: 26px 28px;
  }

  .question-title {
    font-size: 1.12rem;
    line-height: 1.9;
  }
}

body.rtl-ui .question-title {
  text-align: right;
}
