:root {
    color-scheme: light;
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-soft: #eef4f8;
    --text: #111827;
    --muted: #667085;
    --line: #dde5ed;
    --primary: #0f766e;
    --primary-strong: #115e59;
    --accent: #2563eb;
    --warn: #c2410c;
    --shadow: 0 22px 70px rgba(15, 23, 42, .10);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d1117;
    --surface: #151b23;
    --surface-soft: #1f2937;
    --text: #eef4ff;
    --muted: #a7b0bf;
    --line: #2b3542;
    --primary: #2dd4bf;
    --primary-strong: #5eead4;
    --accent: #60a5fa;
    --warn: #fb923c;
    --shadow: 0 24px 80px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, Cairo, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
}
body[dir="rtl"], html[dir="rtl"] body { font-family: Cairo, Inter, system-ui, sans-serif; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1rem; color: var(--muted); }
h1, h2, h3, h4 { margin: 0; line-height: 1.12; letter-spacing: 0; color: var(--text); }
ul { margin: 0; padding: 0; list-style: none; }

.container { width: min(1240px, calc(100% - 32px)); margin: 0 auto; }
.section { padding: 92px 0; }
.section-tight { padding: 64px 0; }
.section-muted { background: var(--surface-soft); }
.eyebrow { color: var(--primary); font-weight: 800; font-size: .82rem; text-transform: uppercase; letter-spacing: 0; margin-bottom: 14px; display: inline-flex; }
.section-head { max-width: 760px; margin-bottom: 34px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head h1, .section-head h2 { font-size: clamp(2rem, 4vw, 4.4rem); }
.section-head h2 { font-size: clamp(1.8rem, 3vw, 3.15rem); }
.section-head p { font-size: 1.05rem; margin-top: 16px; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}
.nav-shell { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; max-width: 180px; }
.brand img { max-height: 42px; width: auto; object-fit: contain; }
.nav-menu { flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; overflow: visible; }
.nav-menu ul, .mobile-nav ul { display: flex; align-items: center; gap: 6px; }
.nav-menu ul { flex-wrap: nowrap; justify-content: center; overflow: visible; }
.nav-menu a, .mobile-nav a {
    display: inline-flex;
    align-items: center;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 700;
    font-size: .92rem;
    white-space: nowrap;
}
.nav-menu a:hover, .mobile-nav a:hover { background: var(--surface-soft); color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
html[dir="rtl"] .nav-shell { direction: rtl; }
html[dir="rtl"] .nav-actions { direction: rtl; }
html[dir="rtl"] .nav-menu ul { direction: rtl; }
.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 800;
    cursor: pointer;
    transition: .18s ease;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 12px 30px color-mix(in srgb, var(--primary) 28%, transparent); }
.btn-primary:hover { background: var(--primary-strong); transform: translateY(-1px); }
.btn-ghost { border-color: var(--line); background: var(--surface); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.icon-btn, .menu-toggle {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
}
.language-select {
    height: 42px;
    max-width: 112px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    padding: 0 10px;
}
.menu-toggle { display: none; flex-direction: column; gap: 4px; align-items: center; justify-content: center; }
.menu-toggle span { width: 18px; height: 2px; background: currentColor; border-radius: 99px; }
.mobile-panel {
    display: none;
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding: 16px;
}
.mobile-panel.is-open { display: block; }
.mobile-nav ul { align-items: stretch; flex-direction: column; }
.mobile-nav a { width: 100%; }
.mobile-panel-actions { display: grid; gap: 10px; margin-top: 12px; }

.hero {
    position: relative;
    overflow: hidden;
    padding: 88px 0 58px;
    background:
        linear-gradient(130deg, color-mix(in srgb, var(--primary) 14%, transparent), transparent 42%),
        radial-gradient(circle at 85% 12%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 30%);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 430px; align-items: center; gap: 54px; }
.hero h1 { font-size: clamp(2.5rem, 5vw, 5.9rem); max-width: 840px; }
.hero h1 span { color: var(--primary); }
.hero p { font-size: 1.15rem; max-width: 650px; margin: 22px 0 28px; }
.hero-actions, .inline-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-top { padding: 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.panel-title { font-weight: 900; }
.status-pill { border-radius: 999px; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); padding: 6px 10px; font-weight: 800; font-size: .8rem; }
.flow-list { padding: 20px; display: grid; gap: 12px; }
.flow-item { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.flow-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; background: var(--surface); color: var(--primary); font-weight: 900; }
.flow-item strong { display: block; }
.flow-item small { color: var(--muted); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 10px 34px rgba(15, 23, 42, .05);
}
.feature-card { min-height: 220px; display: flex; flex-direction: column; gap: 14px; }
.feature-icon, .metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--primary) 12%, var(--surface));
    color: var(--primary);
    font-weight: 900;
}
.feature-icon img { width: 30px; height: 30px; object-fit: contain; }
.card h3 { font-size: 1.2rem; margin-bottom: 8px; }
.card-link { margin-top: auto; color: var(--primary); font-weight: 900; }

.price-card { position: relative; display: flex; flex-direction: column; gap: 18px; }
.price-card.is-featured { border-color: var(--primary); box-shadow: var(--shadow); }
.price-badge { position: absolute; top: 18px; inset-inline-end: 18px; padding: 6px 10px; border-radius: 999px; background: var(--primary); color: #fff; font-size: .78rem; font-weight: 900; }
.price { font-size: 2.45rem; font-weight: 900; }
.price small { color: var(--muted); font-size: .95rem; font-weight: 700; }
.check-list { display: grid; gap: 10px; }
.check-list li { display: flex; gap: 10px; color: var(--muted); }
.check-list li::before { content: "OK"; color: var(--primary); font-weight: 900; font-size: .75rem; padding-top: .2rem; }

.page-hero { padding: 72px 0 52px; background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 12%, transparent), transparent); border-bottom: 1px solid var(--line); }
.page-hero h1 { font-size: clamp(2rem, 4vw, 4.2rem); max-width: 850px; }
.breadcrumbs { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-weight: 700; }
.breadcrumbs a { color: var(--primary); }

.media-frame { overflow: hidden; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-soft); }
.media-frame img { width: 100%; height: 100%; object-fit: cover; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 32px; align-items: start; }
.article-content { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 28px; }
.article-content img { border-radius: 8px; margin-bottom: 20px; }
.article-content h2, .article-content h3 { margin: 22px 0 12px; }
.article-content ul { list-style: disc; padding-inline-start: 22px; color: var(--muted); }
.sidebar { display: grid; gap: 18px; }
.search-form { display: flex; gap: 8px; }
.input, .textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: 8px;
    padding: 13px 14px;
    outline: none;
}
.textarea { min-height: 150px; resize: vertical; }
.input:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.alert { border-radius: 8px; padding: 14px 16px; margin-bottom: 18px; border: 1px solid var(--line); }
.alert-success { background: color-mix(in srgb, var(--primary) 14%, var(--surface)); color: var(--primary-strong); }
.alert-danger { background: color-mix(in srgb, #dc2626 12%, var(--surface)); color: #b91c1c; }
.alert-warning { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); color: var(--warn); }
.invalid-feedback { color: #dc2626; font-weight: 700; font-size: .9rem; display: block; margin-top: 6px; }
.is-invalid { border-color: #dc2626; }

.accordion { display: grid; gap: 12px; }
.accordion-item { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.accordion-button { width: 100%; border: 0; background: transparent; color: var(--text); display: flex; justify-content: space-between; gap: 16px; padding: 18px 20px; cursor: pointer; font-weight: 900; text-align: start; }
.accordion-button::after { content: "+"; color: var(--primary); font-size: 1.35rem; line-height: 1; }
.accordion-button[aria-expanded="true"]::after { content: "-"; }
.accordion-body { display: none; padding: 0 20px 18px; color: var(--muted); }
.accordion-item.is-open .accordion-body { display: block; }

.pagination, .basic-pagination ul { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
.pagination li a, .pagination li span, .basic-pagination a, .basic-pagination span {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
}
.active > span, .pagination .active span { background: var(--primary); color: #fff; border-color: var(--primary); }

.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding-top: 54px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr .8fr .8fr 1fr; gap: 28px; }
.site-footer h3 { font-size: 1rem; margin-bottom: 14px; }
.site-footer a { display: block; color: var(--muted); font-weight: 700; margin: 9px 0; }
.site-footer a:hover { color: var(--primary); }
.footer-brand p { margin-top: 16px; max-width: 420px; }
.footer-cta .btn { margin-top: 12px; }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 42px; padding: 20px 0; color: var(--muted); font-weight: 700; }

@media (max-width: 1020px) {
    .nav-menu, .nav-actions .btn-ghost, .nav-actions .btn-primary, .language-select { display: none; }
    .menu-toggle { display: inline-flex; }
    .nav-shell { justify-content: space-between; }
    .hero-grid, .article-layout { grid-template-columns: 1fr; }
    .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
    .nav-shell { gap: 10px; }
    .brand { max-width: 150px; }
    .nav-actions .btn-ghost { display: none; }
    .nav-menu a { padding-inline: 8px; font-size: .86rem; }
}

@media (max-width: 1100px) {
    .nav-menu { display: none; }
    .menu-toggle { display: inline-flex; }
}

@media (max-width: 680px) {
    .container { width: min(100% - 24px, 1180px); }
    .section { padding: 62px 0; }
    .hero { padding-top: 54px; }
    .grid-2, .grid-3, .grid-4, .form-grid, .footer-grid { grid-template-columns: 1fr; }
    .hero-actions .btn, .inline-actions .btn { width: 100%; }
    .panel-top, .flow-item { grid-template-columns: 1fr; }
    .article-content, .card { padding: 20px; }
}

/* ============================================================
   RTL — Arabic and other right-to-left languages
   Activated when <html dir="rtl"> is set by EnvironmentMiddleware
   ============================================================ */
html[dir="rtl"] {
    direction: rtl;
    text-align: right;
}
html[dir="rtl"] body {
    font-family: Cairo, Inter, system-ui, sans-serif;
}

/* — Typography — */
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] p { text-align: right; }

/* — Sections — */
html[dir="rtl"] .section-head { text-align: right; }
html[dir="rtl"] .section-head.center { text-align: center; }
html[dir="rtl"] .eyebrow { text-align: right; }

/* — Header — */
html[dir="rtl"] .site-header { direction: rtl; }
html[dir="rtl"] .nav-shell,
html[dir="rtl"] .nav-actions,
html[dir="rtl"] .nav-menu ul { flex-direction: row; }

/* — Hero — */
html[dir="rtl"] .hero-grid { direction: rtl; }
html[dir="rtl"] .hero h1,
html[dir="rtl"] .hero p { text-align: right; }
html[dir="rtl"] .hero-actions,
html[dir="rtl"] .inline-actions { flex-direction: row-reverse; }

/* — Flow panel — */
html[dir="rtl"] .flow-item { direction: rtl; }
html[dir="rtl"] .panel-top { flex-direction: row-reverse; }

/* — Cards and grids — */
html[dir="rtl"] .card { text-align: right; }
html[dir="rtl"] .feature-card { text-align: right; }
html[dir="rtl"] .check-list li { flex-direction: row-reverse; justify-content: flex-end; }
html[dir="rtl"] .check-list li::before { order: 1; }
html[dir="rtl"] .card-link { text-align: right; }

/* — Page hero & breadcrumbs — */
html[dir="rtl"] .page-hero { text-align: right; }
html[dir="rtl"] .page-hero h1 { text-align: right; }
html[dir="rtl"] .breadcrumbs { flex-direction: row-reverse; }

/* — Article layout — */
html[dir="rtl"] .article-layout { direction: rtl; }
html[dir="rtl"] .article-content { text-align: right; }
html[dir="rtl"] .article-content ul { padding-inline-start: 0; padding-inline-end: 22px; }

/* — Forms — */
html[dir="rtl"] .input,
html[dir="rtl"] .textarea,
html[dir="rtl"] select { text-align: right; direction: rtl; }
html[dir="rtl"] .search-form { flex-direction: row-reverse; }
html[dir="rtl"] .form-grid { direction: rtl; }
html[dir="rtl"] .alert { text-align: right; }
html[dir="rtl"] .invalid-feedback { text-align: right; }

/* — Accordion — */
html[dir="rtl"] .accordion-button { text-align: right; flex-direction: row-reverse; }
html[dir="rtl"] .accordion-body { text-align: right; }

/* — Pagination — */
html[dir="rtl"] .pagination,
html[dir="rtl"] .basic-pagination ul { flex-direction: row-reverse; }

/* — Footer — */
html[dir="rtl"] .site-footer { text-align: right; }
html[dir="rtl"] .footer-grid { direction: rtl; }
html[dir="rtl"] .footer-brand p { text-align: right; }
html[dir="rtl"] .footer-bottom { text-align: right; }

/* — Mobile nav — */
html[dir="rtl"] .mobile-nav a { text-align: right; }
html[dir="rtl"] .mobile-panel-actions { direction: rtl; }

/* — Sidebar / article — */
html[dir="rtl"] .sidebar { direction: rtl; text-align: right; }
