/* =========================================================
   توفير بذكاء - نظام التصميم الأساسي
   RTL / عربي / متجاوب بالكامل
   ========================================================= */

:root {
  --navy-dark: #061426;
  --blue-deep: #0b3470;
  --gold: #d4a43a;
  --bg-light: #f7f4ed;
  --white: #ffffff;
  --text-gray: #475569;
  --green-save: #1f9d55;

  --font-main: 'Tajawal', 'Cairo', 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-sm: 0 2px 8px rgba(6, 20, 38, 0.06);
  --shadow-md: 0 8px 24px rgba(6, 20, 38, 0.10);
  --shadow-lg: 0 16px 40px rgba(6, 20, 38, 0.14);

  --container-width: 1180px;
}

/* ---------- إعادة ضبط أساسية ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--bg-light);
  color: var(--text-gray);
  direction: rtl;
  text-align: right;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }

ul, ol { padding-inline-start: 1.4rem; margin: 0; }

h1, h2, h3, h4 {
  color: var(--navy-dark);
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 .6em;
}

h1 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.35rem); }

p { margin: 0 0 1em; }

.container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: 20px;
}

section { padding: 56px 0; }

.section-head { text-align: center; max-width: 720px; margin: 0 auto 36px; }
.section-head .eyebrow {
  display: inline-block;
  color: var(--gold);
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .04em;
  margin-bottom: .5em;
}
.section-head p { color: var(--text-gray); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

.skip-link {
  position: absolute; right: -999px; top: 0;
  background: var(--navy-dark); color: var(--white);
  padding: 10px 16px; z-index: 999; border-radius: 0 0 8px 8px;
}
.skip-link:focus { right: 0; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .2s ease, color .2s ease;
  font-family: inherit;
  line-height: 1;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--gold);
  color: var(--navy-dark);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { box-shadow: var(--shadow-md); background: #e0b24d; }

.btn-outline {
  background: transparent;
  color: var(--white);
  border-color: rgba(255,255,255,.55);
}
.btn-outline:hover { background: rgba(255,255,255,.12); }

.btn-secondary {
  background: var(--blue-deep);
  color: var(--white);
}
.btn-secondary:hover { background: #0e3f88; }

.btn-ghost {
  background: var(--white);
  color: var(--blue-deep);
  border-color: #e3ddcd;
}
.btn-ghost:hover { border-color: var(--gold); }

.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: .9rem; }

.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- الهيدر ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy-dark);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 12px;
}
.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--white);
}
.brand-name span { color: var(--gold); }
.brand-tagline {
  font-size: .75rem;
  color: #c8ceda;
  margin-top: 2px;
}

.main-nav { display: flex; }
.main-nav ul {
  list-style: none;
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
}
.main-nav a {
  display: inline-block;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  color: #e6e9f0;
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.main-nav a:hover,
.main-nav a[aria-current="page"] {
  background: rgba(212, 164, 58, 0.16);
  color: var(--gold);
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 2px solid rgba(255,255,255,.3);
  border-radius: var(--radius-sm);
  color: var(--white);
  width: 44px;
  height: 44px;
  font-size: 1.3rem;
  cursor: pointer;
}

/* ---------- الهيرو ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--blue-deep) 100%);
  color: var(--white);
  padding: 72px 0 64px;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 40px;
  align-items: center;
}
.hero h1 { color: var(--white); }
.hero-lead {
  font-size: 1.1rem;
  color: #d8dde6;
  max-width: 46ch;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}
.hero-art {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(2px);
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.hero-stat {
  background: rgba(255,255,255,.05);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
}
.hero-stat strong {
  display: block;
  font-size: 1.6rem;
  color: var(--gold);
}
.hero-stat span { font-size: .8rem; color: #cfd5e0; }

/* ---------- بريدكرمب ---------- */
.breadcrumb {
  background: var(--white);
  border-bottom: 1px solid #ece7d8;
}
.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 0;
  margin: 0;
  font-size: .85rem;
  color: var(--text-gray);
}
.breadcrumb a { color: var(--blue-deep); font-weight: 600; }
.breadcrumb li:not(:last-child)::after { content: '/'; margin-inline-start: 6px; color: #b7b0a0; }
.breadcrumb li[aria-current] { color: var(--text-gray); }

/* ---------- كروت عامة ---------- */
.grid {
  display: grid;
  gap: 24px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #efe9da;
  transition: box-shadow .2s ease, transform .2s ease;
  display: flex;
  flex-direction: column;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }

.card-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--gold), #b98a26);
  color: var(--navy-dark);
  font-size: 1.5rem;
  margin-bottom: 16px;
}
.card h3 { margin-bottom: 8px; }
.card p { flex: 1; font-size: .93rem; }
.card .btn { margin-top: 14px; align-self: flex-start; }

.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(31, 157, 85, .12);
  color: var(--green-save);
  margin-bottom: 10px;
}
.badge.soon {
  background: rgba(212, 164, 58, .16);
  color: #9c7924;
}

.alt-formats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.alt-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px dashed #cfc7ac;
  color: #8b8574;
  background: transparent;
}
.alt-badge.soon { color: #9c7924; border-color: rgba(212, 164, 58, .4); }

.thumb-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(135deg, #f0ead8, #f0ead8 10px, #e9e1cc 10px, #e9e1cc 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a99a72;
  font-size: 2rem;
  margin-bottom: 14px;
}

/* ---------- شبكة ميزات ---------- */
.feature {
  text-align: center;
  padding: 30px 20px;
}
.feature .card-icon { margin-inline: auto; }

/* ---------- فلاتر / بحث ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 28px;
}
.filter-bar input[type="search"] {
  flex: 1;
  min-width: 220px;
}
.chip {
  border: 2px solid #e3ddcd;
  background: var(--white);
  color: var(--text-gray);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
}
.chip.active,
.chip:hover {
  border-color: var(--gold);
  color: var(--navy-dark);
  background: rgba(212,164,58,.12);
}

/* ---------- نماذج / حاسبات ---------- */
.calc-page {
  padding-block: 40px 64px;
}
.calc-layout {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 28px;
  align-items: start;
}
.panel {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid #efe9da;
  box-shadow: var(--shadow-sm);
  padding: 26px;
}
.panel + .panel { margin-top: 22px; }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-weight: 700;
  color: var(--navy-dark);
  margin-bottom: 6px;
  font-size: .92rem;
}
.field .hint { font-size: .78rem; color: #8b8574; margin-top: 4px; }
.field-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

input[type="text"],
input[type="email"],
input[type="number"],
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid #e3ddcd;
  background: var(--white);
  color: var(--navy-dark);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color .15s ease;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--blue-deep);
}
input.invalid { border-color: #d64545; }
.error-msg {
  display: none;
  color: #b83232;
  font-size: .8rem;
  margin-top: 5px;
  font-weight: 600;
}
.error-msg.show { display: block; }

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.radio-option {
  border: 2px solid #e3ddcd;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-gray);
}
.radio-option input { accent-color: var(--blue-deep); margin-inline-end: 6px; }
.radio-option:has(input:checked) {
  border-color: var(--blue-deep);
  color: var(--blue-deep);
  background: rgba(11,52,112,.06);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

/* نتائج الحاسبة */
.result-panel {
  background: linear-gradient(160deg, var(--navy-dark), var(--blue-deep));
  color: var(--white);
  border-radius: var(--radius-md);
  padding: 26px;
  box-shadow: var(--shadow-md);
}
.result-panel h3 { color: var(--white); }
.result-empty { color: #cbd2de; font-size: .92rem; }

.result-grid {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}
.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,.07);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.result-item .label { font-size: .85rem; color: #d5dae4; }
.result-item .value { font-weight: 800; font-size: 1.15rem; color: var(--gold); }
.result-item.positive .value { color: #4fd67e; }
.result-item.negative .value { color: #ff8a8a; }

.alert {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.alert-warning { background: #fff2d6; color: #7a5a05; }
.alert-danger { background: #fde2e2; color: #8c1f1f; }
.alert-success { background: #dff5e6; color: #146837; }
.alert-info { background: #e2ecfb; color: #103a75; }

progress.savings-progress {
  width: 100%;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  appearance: none;
}
progress.savings-progress::-webkit-progress-bar { background: rgba(255,255,255,.15); border-radius: 999px; }
progress.savings-progress::-webkit-progress-value { background: var(--gold); border-radius: 999px; }
progress.savings-progress::-moz-progress-bar { background: var(--gold); border-radius: 999px; }

table.result-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: .9rem;
}
table.result-table th, table.result-table td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid rgba(255,255,255,.14);
}
table.result-table th { color: var(--gold); }

.tips-box {
  background: #fbf8f0;
  border: 1px dashed var(--gold);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-size: .9rem;
  margin-top: 18px;
}
.tips-box h4 { margin-bottom: 8px; font-size: 1rem; }
.tips-box ul { padding-inline-start: 1.2rem; }
.tips-box li { margin-bottom: 6px; }

/* ---------- أسئلة شائعة ---------- */
.faq-item {
  background: var(--white);
  border: 1px solid #efe9da;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer;
  padding: 16px 20px;
  font-weight: 700;
  color: var(--navy-dark);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  color: var(--gold);
  font-size: 1.3rem;
  font-weight: 800;
}
.faq-item[open] summary::after { content: '−'; }
.faq-item .faq-body { padding: 0 20px 18px; font-size: .92rem; }

/* ---------- إعلانات ---------- */
.ad-slot {
  background: repeating-linear-gradient(45deg, #eef0f4, #eef0f4 12px, #e4e7ee 12px, #e4e7ee 24px);
  border: 1px dashed #c7ccd8;
  border-radius: var(--radius-sm);
  color: #8b93a3;
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-block: 28px;
}
.ad-slot-top, .ad-slot-bottom { min-height: 90px; }
.ad-slot-middle { min-height: 120px; }
.ad-slot-sidebar { min-height: 250px; }

/* ---------- الاشتراك ---------- */
.newsletter {
  background: var(--navy-dark);
  color: var(--white);
}
.newsletter-box {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}
.newsletter h2 { color: var(--white); }
.newsletter-form {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.newsletter-form input[type="email"] {
  flex: 1;
  min-width: 240px;
  max-width: 360px;
}
.newsletter-note { font-size: .78rem; color: #a9b1c0; margin-top: 12px; }
.form-success {
  display: none;
  background: rgba(31,157,85,.18);
  color: #6fe0a1;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
  font-weight: 700;
}
.form-success.show { display: block; }

/* ---------- مقالات مرتبطة ---------- */
.related-articles { padding-top: 40px; }
.article-card img, .article-card .thumb-placeholder { margin-bottom: 14px; }
.article-meta { font-size: .78rem; color: #9a927c; margin-bottom: 6px; }

/* ---------- تخطيط صفحة المقال (محتوى + شريط جانبي) ---------- */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  align-items: start;
}
.article-aside {
  position: sticky;
  top: 84px;
}
@media (max-width: 980px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-aside { position: static; }
}

/* ---------- الفوتر ---------- */
.site-footer {
  background: var(--navy-dark);
  color: #c8ceda;
  padding-top: 48px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 30px;
  padding-bottom: 34px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.footer-col h4 { color: var(--white); font-size: 1rem; margin-bottom: 14px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { font-size: .9rem; color: #c8ceda; }
.footer-col a:hover { color: var(--gold); }
.footer-brand .brand-name { color: var(--white); }
.footer-brand p { font-size: .88rem; margin-top: 10px; max-width: 32ch; }
.footer-bottom {
  padding: 20px 0;
  font-size: .8rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- صفحات ثابتة (about/privacy...) ---------- */
.static-page { padding-block: 48px 64px; }
.static-page .content-box {
  background: var(--white);
  border: 1px solid #efe9da;
  border-radius: var(--radius-md);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  max-width: 860px;
  margin-inline: auto;
}
.static-page .content-box h2 { margin-top: 1.2em; }
.static-page .content-box h2:first-child { margin-top: 0; }

/* ---------- تويست / نسخ ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy-dark);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: .9rem;
  font-weight: 700;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
  z-index: 300;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* =========================================================
   استجابة للشاشات (Responsive)
   ========================================================= */
@media (max-width: 980px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .calc-layout { grid-template-columns: 1fr; }
  .hero-inner { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .main-nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    background: var(--navy-dark);
    flex-direction: column;
    box-shadow: var(--shadow-md);
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
  }
  .main-nav.open { max-height: 520px; }
  .main-nav ul { flex-direction: column; gap: 0; padding: 8px; }
  .main-nav a { display: block; padding: 12px 16px; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .header-inner { position: relative; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
  section { padding: 40px 0; }
  .newsletter-box { padding: 26px 20px; }
}
