:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #1a2233;
  --muted: #5b6577;
  --primary: #0f766e;
  --primary-dark: #0b544e;
  --primary-soft: #d6f2ee;
  --accent: #f59e0b;
  --border: #e3e8ef;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --maxw: 1080px;
  --font: "Segoe UI", "Tahoma", "Cairo", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  direction: rtl;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  right: -999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
  z-index: 1000;
}

.skip-link:focus {
  right: 0;
}

/* Header */
.site-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}

.site-header .header-bar {
  position: relative;
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
  color: var(--primary-dark);
}

.brand-text {
  white-space: nowrap;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Nav toggle (mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.nav-toggle:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Main navigation */
.site-nav {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list > li > a,
.nav-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  border: none;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.nav-list > li > a:hover,
.nav-dropdown-btn:hover {
  color: var(--primary);
  background: var(--primary-soft);
  text-decoration: none;
}

.nav-list > li > a.is-current,
.nav-list > li > a[aria-current="page"] {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-dropdown-btn::after {
  content: "";
  width: 0;
  height: 0;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.2s;
}

.nav-dropdown.is-open .nav-dropdown-btn::after {
  transform: rotate(180deg);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  min-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  z-index: 300;
}

.nav-dropdown.is-open .nav-dropdown-menu,
.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-menu-label {
  margin: 0 0 8px;
  padding: 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.nav-dropdown-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.is-current,
.nav-dropdown-menu a[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
}

.nav-cta {
  margin-right: 4px;
}

.nav-cta a {
  background: var(--primary);
  color: #fff !important;
  padding: 10px 16px;
  border-radius: 10px;
}

.nav-cta a:hover {
  background: var(--primary-dark);
  color: #fff !important;
}

@media (max-width: 900px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 12px 20px 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  }

  .site-nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .nav-list > li > a,
  .nav-dropdown-btn {
    width: 100%;
    justify-content: space-between;
  }

  .nav-dropdown-menu {
    position: static;
    min-width: 0;
    grid-template-columns: 1fr;
    box-shadow: none;
    border: none;
    padding: 4px 0 8px;
    max-height: 0;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: max-height 0.3s ease, padding 0.2s;
  }

  .nav-dropdown.is-open .nav-dropdown-menu {
    max-height: 480px;
    padding: 8px 0 12px;
  }

  .nav-dropdown:hover .nav-dropdown-menu {
    max-height: 0;
    padding: 4px 0 8px;
  }

  .nav-dropdown.is-open:hover .nav-dropdown-menu {
    max-height: 480px;
    padding: 8px 0 12px;
  }

  .header-bar {
    position: relative;
    flex-wrap: wrap;
  }
}

/* Legacy — keep for any old markup */
.top-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.top-nav a {
  color: var(--muted);
  font-weight: 600;
}

/* Hero */
.hero {
  background: linear-gradient(160deg, var(--primary-soft), transparent);
  padding: 56px 0 40px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 12px;
}

.hero p {
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
  font-size: 1.05rem;
}

/* Sections */
main {
  padding: 40px 0 60px;
}

.section-title {
  font-size: 1.5rem;
  margin: 0 0 20px;
}

/* Tool grid */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: block;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.tool-card .icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.tool-card h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 1.15rem;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.tool-card.soon {
  opacity: 0.6;
  pointer-events: none;
}

.badge-soon {
  display: inline-block;
  background: var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 8px;
}

/* Calculator layout */
.calc-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 720px;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.breakdown {
  margin-top: 16px;
  text-align: right;
}

.breakdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.breakdown th,
.breakdown td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(15, 118, 110, 0.15);
}

.breakdown th {
  color: var(--primary-dark);
  font-weight: 700;
}

.breakdown td:last-child,
.breakdown th:last-child {
  text-align: left;
  white-space: nowrap;
}

.breakdown tfoot td {
  font-weight: 800;
  color: var(--primary-dark);
  border-bottom: none;
  padding-top: 12px;
}

.panel-hidden {
  display: none;
}

.zakat-type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.zakat-tab {
  flex: 1;
  min-width: 120px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.zakat-tab.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

@media (max-width: 560px) {
  .field-row,
  .field-row-3 {
    grid-template-columns: 1fr;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 22px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
  width: 100%;
}

.btn:hover {
  background: var(--primary-dark);
}

/* Result */
.result {
  margin-top: 22px;
  padding: 20px;
  background: var(--primary-soft);
  border-radius: 12px;
  display: none;
}

.result.show {
  display: block;
}

.result-main {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-dark);
  text-align: center;
  margin-bottom: 14px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: center;
}

.result-item {
  background: #fff;
  border-radius: 10px;
  padding: 12px 8px;
}

.result-item .num {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
}

.result-item .lbl {
  font-size: 0.85rem;
  color: var(--muted);
}

.result-extra {
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
}

.result-summary {
  margin-top: 18px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

.result-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15, 118, 110, 0.12);
  font-size: 0.95rem;
}

.result-summary-row:last-child {
  border-bottom: none;
}

.result-summary-row .label {
  color: var(--muted);
  font-weight: 600;
}

.result-summary-row .value {
  color: var(--primary-dark);
  font-weight: 800;
  text-align: left;
}

.result-summary-row.highlight {
  background: rgba(15, 118, 110, 0.06);
}

.result-summary-row.highlight .value {
  font-size: 1.05rem;
}

.result-progress {
  margin-top: 16px;
}

.result-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.result-progress-bar {
  height: 10px;
  background: #fff;
  border-radius: 999px;
  overflow: hidden;
}

.result-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Content / FAQ */
.prose {
  max-width: 720px;
  margin: 40px auto 0;
}

.prose h2 {
  font-size: 1.4rem;
  margin: 28px 0 12px;
}

.faq-section {
  margin-top: 36px;
}

.faq-section > h2 {
  font-size: 1.4rem;
  margin-bottom: 16px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
}

.faq-item h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.faq-item p {
  margin: 0;
  color: var(--muted);
}

.notice {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 0.95rem;
  margin: 24px auto 0;
  max-width: 720px;
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 18px;
}

/* Footer */
.site-footer {
  background: linear-gradient(180deg, #eef2f7 0%, var(--surface) 100%);
  border-top: 1px solid var(--border);
  padding: 48px 0 0;
  margin-top: 48px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr;
  gap: 32px;
  padding-bottom: 32px;
}

.footer-brand .brand {
  margin-bottom: 12px;
}

.footer-tagline {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
  max-width: 280px;
  line-height: 1.6;
}

.footer-col h3 {
  margin: 0 0 14px;
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 800;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col a {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-col a:hover {
  color: var(--primary);
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 20px 0 28px;
  text-align: center;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted);
  font-weight: 600;
}

.footer-disclaimer {
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 720px;
  margin: 0 auto 10px;
  line-height: 1.6;
}

.copyright {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    text-align: center;
  }

  .footer-brand .brand {
    justify-content: center;
  }

  .footer-tagline {
    margin: 0 auto;
  }
}

/* Legal pages */
.legal-page {
  padding: 40px 0 20px;
}

.legal-header {
  margin-bottom: 28px;
}

.legal-header .eyebrow {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0 0 8px;
}

.legal-header h1 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.legal-meta {
  color: var(--muted);
  margin: 0;
}

.legal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.legal-card h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  color: var(--primary-dark);
}

.legal-card p,
.legal-card ul {
  margin: 0 0 12px;
  color: var(--text);
}

.legal-card ul {
  padding-right: 20px;
}

.legal-card li {
  margin-bottom: 6px;
}

.legal-note {
  background: var(--primary-soft);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.95rem;
}

@media (max-width: 560px) {
  .result-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .result-item .num {
    font-size: 1.1rem;
  }
}
