/* ================================================
   HISABATI.COM — Main Stylesheet
   Arabic RTL Tools Website
   ================================================ */

:root {
  --primary: #0F52BA;
  --primary-l: #1A6FD4;
  --primary-d: #0A3A8C;
  --accent: #FF5722;
  --accent-l: #FF7043;
  --success: #16A34A;
  --warning: #D97706;
  --danger: #DC2626;
  --bg: #F2F5F9;
  --bg2: #FAFBFC;
  --card: #FFFFFF;
  --text: #1A202C;
  --text2: #4A5568;
  --muted: #718096;
  --border: #CBD5E0;
  --border-l: #E2E8F0;
  --shadow-s: 0 1px 4px rgba(0,0,0,0.08);
  --shadow: 0 4px 24px rgba(0,0,0,0.09);
  --shadow-l: 0 12px 48px rgba(0,0,0,0.14);
  --r: 12px;
  --rs: 8px;
  --rl: 20px;
  --t: 0.25s ease;
  --font-ar: 'Cairo', 'Tajawal', Arial, sans-serif;
  --font-en: 'Inter', system-ui, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F172A; --bg2: #1E293B; --card: #1E293B;
    --text: #F1F5F9; --text2: #CBD5E0; --muted: #94A3B8;
    --border: #334155; --border-l: #2D3748;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-ar);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  direction: rtl;
}

body.en { direction: ltr; font-family: var(--font-en); }

a { color: var(--primary); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }

h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; line-height: 1.25; }
h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); font-weight: 700; line-height: 1.3; }
h3 { font-size: clamp(1.05rem, 2.5vw, 1.35rem); font-weight: 700; line-height: 1.4; }
h1, h2, h3 { color: var(--text); }
p { color: var(--text2); margin-bottom: 1rem; }

/* ── LAYOUT ── */
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0; }
.section-sm { padding: 40px 0; }

/* ── HEADER ── */
.site-header {
  background: var(--card);
  border-bottom: 3px solid var(--primary);
  box-shadow: var(--shadow-s);
  position: sticky; top: 0; z-index: 200;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; max-width: 1180px; margin: 0 auto;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 40px; height: 40px; border-radius: var(--rs);
  background: linear-gradient(135deg, var(--primary-d), var(--primary-l));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.25rem; flex-shrink: 0;
}
.logo-name { font-size: 1.35rem; font-weight: 800; color: var(--primary); }
.logo-name em { color: var(--accent); font-style: normal; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  padding: 7px 13px; border-radius: var(--rs); font-size: .88rem; font-weight: 600;
  color: var(--text2); transition: all var(--t);
}
.nav a:hover, .nav a.active { background: var(--bg); color: var(--primary); }

.header-right { display: flex; align-items: center; gap: 10px; }
.lang-toggle {
  display: flex; border-radius: 20px; overflow: hidden;
  border: 1.5px solid var(--border); background: var(--bg);
}
.lang-btn {
  padding: 5px 13px; font-size: .82rem; font-weight: 700;
  background: none; border: none; cursor: pointer; color: var(--muted);
  transition: all var(--t); font-family: inherit;
}
.lang-btn.active { background: var(--primary); color: #fff; border-radius: 20px; }

.menu-btn {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; padding: 6px; background: none; border: none;
}
.menu-btn span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: all var(--t); }

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, #082F6E 0%, var(--primary) 55%, var(--primary-l) 100%);
  color: #fff; padding: 72px 0 80px; text-align: center; position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; margin-bottom: 14px; }
.hero p { color: rgba(255,255,255,.82); font-size: 1.1rem; max-width: 580px; margin: 0 auto 36px; }

.hero-stats { display: flex; justify-content: center; gap: 48px; flex-wrap: wrap; margin-top: 40px; }
.stat .num { font-size: 2rem; font-weight: 800; color: #fff; }
.stat .lbl { font-size: .8rem; color: rgba(255,255,255,.7); margin-top: 2px; }

/* ── TOOL CARDS GRID ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 22px;
}

.tool-card {
  background: var(--card); border-radius: var(--r);
  padding: 26px 24px; box-shadow: var(--shadow);
  border: 1px solid var(--border-l); position: relative;
  overflow: hidden; text-decoration: none; display: block;
  transition: transform var(--t), box-shadow var(--t);
}
.tool-card::before {
  content: ''; position: absolute; top: 0; right: 0;
  width: 4px; height: 100%;
  background: linear-gradient(to bottom, var(--tc, var(--primary)), var(--accent));
}
body.en .tool-card::before { right: auto; left: 0; }
.tool-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-l); }

.tool-card .icon {
  width: 56px; height: 56px; border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; margin-bottom: 14px;
  background: color-mix(in srgb, var(--tc, var(--primary)) 12%, white);
  color: var(--tc, var(--primary));
}
.tool-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.tool-card p { font-size: .88rem; color: var(--muted); margin: 0 0 14px; }
.tool-card .arrow { color: var(--primary); font-size: 1.1rem; transition: transform var(--t); }
.tool-card:hover .arrow { transform: translateX(-5px); }
body.en .tool-card:hover .arrow { transform: translateX(5px); }

/* card accent colors */
.tc-age   { --tc: #1565C0; }
.tc-hijri { --tc: #6B21A8; }
.tc-bmi   { --tc: #065F46; }
.tc-loan  { --tc: #9A3412; }
.tc-pct   { --tc: #7C3AED; }
.tc-zod   { --tc: #B45309; }

/* ── TOOL PAGE WRAPPER ── */
.tool-wrap {
  background: var(--card); border-radius: var(--rl);
  box-shadow: var(--shadow); overflow: hidden; margin: 28px 0;
}
.tool-head {
  background: linear-gradient(135deg, var(--primary-d), var(--primary-l));
  padding: 28px 30px; color: #fff; text-align: center;
}
.tool-head h1 { color: #fff; font-size: 1.55rem; margin-bottom: 6px; }
.tool-head p { color: rgba(255,255,255,.82); margin: 0; font-size: .93rem; }
.tool-body { padding: 28px 30px; }

/* ── TABS ── */
.tabs { display: flex; border-bottom: 2px solid var(--border-l); margin-bottom: 22px; gap: 3px; }
.tab-btn {
  padding: 9px 18px; border: none; background: none; cursor: pointer;
  font-size: .93rem; font-weight: 600; color: var(--muted); font-family: inherit;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  border-radius: var(--rs) var(--rs) 0 0; transition: all var(--t);
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: rgba(15,82,186,.05); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp .3s ease; }

/* ── FORM ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .88rem; font-weight: 700; margin-bottom: 7px; color: var(--text); }
.form-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.inp, select.inp {
  width: 100%; padding: 11px 14px;
  border: 2px solid var(--border); border-radius: var(--rs);
  font-size: .97rem; font-family: inherit; color: var(--text);
  background: var(--card); transition: border-color var(--t), box-shadow var(--t);
  appearance: none; -webkit-appearance: none;
}
.inp:focus, select.inp:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,82,186,.14);
}
select.inp {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2.5'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center; padding-left: 36px;
}
body.en select.inp { background-position: right 12px center; padding-left: 14px; padding-right: 36px; }

input[type=range] {
  width: 100%; accent-color: var(--primary); cursor: pointer; height: 6px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 26px; border-radius: var(--r); font-size: 1rem;
  font-weight: 700; font-family: inherit; cursor: pointer; border: none; transition: all var(--t);
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary-d), var(--primary-l));
  color: #fff; width: 100%;
  box-shadow: 0 4px 16px rgba(15,82,186,.28);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(15,82,186,.38); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: var(--bg); color: var(--text2);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--border-l); }

/* ── RESULTS ── */
.result-box {
  display: none; margin-top: 22px;
  animation: fadeUp .35s ease;
}
.result-box.show { display: block; }

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

.result-hero {
  background: linear-gradient(135deg, var(--primary-d), var(--primary-l));
  border-radius: var(--r); padding: 24px; color: #fff; text-align: center; margin-bottom: 14px;
}
.result-hero .big { font-size: 2.6rem; font-weight: 800; }
.result-hero .lbl { font-size: .88rem; opacity: .82; margin-top: 2px; }

.result-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px;
}
.rg-item {
  background: var(--bg); border-radius: var(--rs); padding: 14px 10px; text-align: center;
  border: 1px solid var(--border-l);
}
.rg-item .v { font-size: 1.55rem; font-weight: 700; color: var(--primary); }
.rg-item .u { font-size: .78rem; color: var(--muted); margin-top: 3px; }

/* ── AD SLOTS ── */
.ad-slot {
  background: var(--bg2); border: 1.5px dashed var(--border);
  border-radius: var(--rs); display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: .75rem; margin: 18px 0;
}
.ad-lb  { width: 100%; height: 90px; }
.ad-mid { width: 100%; max-width: 340px; height: 250px; margin: 18px auto; }
.ad-ban { width: 100%; height: 60px; }

/* ── SEO CONTENT ── */
.seo-box {
  background: var(--card); border-radius: var(--r); padding: 28px 30px;
  margin: 18px 0; border: 1px solid var(--border-l);
}
.seo-box h2 {
  font-size: 1.2rem; color: var(--primary); margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 2px solid var(--border-l);
}
.seo-box p { font-size: .93rem; line-height: 1.85; }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--border-l); }
.faq-q {
  padding: 14px 0; cursor: pointer; font-weight: 700; font-size: .95rem;
  display: flex; align-items: center; justify-content: space-between;
  transition: color var(--t); list-style: none; user-select: none;
}
.faq-q:hover { color: var(--primary); }
.faq-q::after { content: '+'; font-size: 1.3rem; color: var(--primary); transition: transform var(--t); flex-shrink: 0; }
.faq-item.open .faq-q::after { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.faq-item.open .faq-a { max-height: 400px; padding-bottom: 14px; }

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: .82rem; color: var(--muted); padding: 12px 0;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { opacity: .45; }

/* ── RELATED TOOLS ── */
.related-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 16px 0;
}
.rel-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: var(--rs); padding: 13px 15px;
  border: 1.5px solid var(--border-l); text-decoration: none; transition: all var(--t);
}
.rel-item:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-s); }
.rel-item span:first-child { font-size: 1.3rem; flex-shrink: 0; }
.rel-item span:last-child { font-size: .88rem; font-weight: 700; color: var(--text); }

/* ── BMI ── */
.bmi-bar { height: 14px; border-radius: 7px; margin: 16px 0 6px; position: relative;
  background: linear-gradient(to right,#3B82F6 18.5%,#22C55E 18.5% 25%,#FBBF24 25% 30%,#F97316 30% 35%,#EF4444 35%); }
.bmi-needle {
  position: absolute; top: -7px; width: 4px; height: 28px;
  background: var(--text); border-radius: 2px; transform: translateX(-50%);
  transition: left .6s cubic-bezier(.34,1.56,.64,1);
}
.bmi-cats {
  display: grid; grid-template-columns: repeat(5,1fr); gap: 4px;
  font-size: .72rem; text-align: center; margin-top: 6px;
}
.bmi-cat { padding: 5px 3px; border-radius: 4px; font-weight: 700; }
.bmi-cat.uw { background: rgba(59,130,246,.1); color: #2563EB; }
.bmi-cat.nw { background: rgba(34,197,94,.1); color: #15803D; }
.bmi-cat.ow { background: rgba(251,191,36,.1); color: #B45309; }
.bmi-cat.o1 { background: rgba(249,115,22,.1); color: #C2410C; }
.bmi-cat.o2 { background: rgba(239,68,68,.1); color: #B91C1C; }

/* ── LOAN ── */
.loan-sum { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin: 18px 0; }
.ls-item { background: var(--bg); border-radius: var(--rs); padding: 18px 14px; text-align: center; border: 1px solid var(--border-l); }
.ls-item .v { font-size: 1.45rem; font-weight: 800; color: var(--primary); }
.ls-item .l { font-size: .78rem; color: var(--muted); margin-top: 3px; }

.pie-wrap { display: flex; align-items: center; gap: 20px; margin: 14px 0; flex-wrap: wrap; }
.pie-svg { flex-shrink: 0; }
.pie-legend { display: flex; flex-direction: column; gap: 8px; }
.leg-item { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.leg-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

.table-wrap { max-height: 320px; overflow-y: auto; border-radius: var(--rs); border: 1px solid var(--border-l); }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th { background: var(--primary); color: #fff; padding: 9px 10px; text-align: center; font-weight: 700; position: sticky; top: 0; }
td { padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--border-l); }
tr:hover td { background: var(--bg); }

/* ── PERCENTAGE ── */
.pct-mode { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.pct-mode-btn {
  padding: 7px 16px; border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--bg); font-size: .85rem; font-weight: 600; cursor: pointer;
  font-family: inherit; color: var(--text2); transition: all var(--t);
}
.pct-mode-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── SHARE ── */
.share-row { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--border-l); margin-top: 18px; }
.shr {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: 20px; font-size: .83rem; font-weight: 600;
  text-decoration: none; cursor: pointer; border: none; font-family: inherit; transition: all var(--t);
}
.shr:hover { opacity: .88; transform: translateY(-2px); }
.shr-wa  { background: #25D366; color: #fff; }
.shr-tw  { background: #1DA1F2; color: #fff; }
.shr-fb  { background: #1877F2; color: #fff; }
.shr-cp  { background: var(--bg); color: var(--text2); border: 1.5px solid var(--border); }

/* ── FOOTER ── */
.site-footer { background: #0F1729; color: rgba(255,255,255,.68); padding: 56px 0 22px; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 44px; margin-bottom: 44px; }
.foot-brand .logo-name { color: #fff; display: block; margin-bottom: 10px; }
.foot-brand p { font-size: .88rem; line-height: 1.75; color: rgba(255,255,255,.58); }
.foot-col h4 { color: #fff; font-size: .92rem; margin-bottom: 14px; }
.foot-col ul { list-style: none; }
.foot-col li { margin-bottom: 8px; }
.foot-col a { color: rgba(255,255,255,.58); font-size: .88rem; transition: color var(--t); }
.foot-col a:hover { color: var(--accent); }
.foot-bottom {
  border-top: 1px solid rgba(255,255,255,.1); padding-top: 20px;
  display: flex; align-items: center; justify-content: space-between; font-size: .83rem;
}
.socials { display: flex; gap: 10px; }
.soc-link {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; background: rgba(255,255,255,.1); color: #fff;
  text-decoration: none; font-size: .88rem; transition: background var(--t);
}
.soc-link:hover { background: var(--primary-l); color: #fff; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1A202C; color: #fff; padding: 11px 22px;
  border-radius: 24px; font-size: .88rem; z-index: 1000;
  transition: transform .3s ease; white-space: nowrap; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── BACK TO TOP ── */
.btt {
  position: fixed; bottom: 24px; left: 24px; width: 42px; height: 42px;
  border-radius: 50%; background: var(--primary); color: #fff; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(16px);
  transition: all var(--t); z-index: 50; font-size: 1rem;
}
body.en .btt { left: auto; right: 24px; }
.btt.show { opacity: 1; transform: translateY(0); }

/* ── MOBILE ── */
@media (max-width: 780px) {
  .nav { display: none; position: fixed; top: 68px; left: 0; right: 0;
    background: var(--card); flex-direction: column; padding: 20px;
    box-shadow: var(--shadow); z-index: 199; }
  .nav.open { display: flex; }
  .menu-btn { display: flex; }
  .foot-grid { grid-template-columns: 1fr; gap: 24px; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
  .loan-sum { grid-template-columns: 1fr; }
  .bmi-cats { grid-template-columns: repeat(3,1fr); }
  .tools-grid { grid-template-columns: 1fr; }
  .foot-bottom { flex-direction: column; gap: 14px; text-align: center; }
  .ad-lb { height: 60px; }
  .hero-stats { gap: 24px; }
  .tool-body { padding: 20px 18px; }
}
