/*
 * تصميم الموقع العام — جهاز إدارة المدن التاريخية
 * مبني على Bootstrap 5.3 RTL، والألوان مأخوذة من الشعار (البني الطيني، الذهبي، الأزرق)
 */

:root {
    --brand: #6b4423;
    --brand-dark: #3f2814;
    --brand-light: #f6efe6;
    --gold: #e9a21b;
    --gold-light: #fff4dc;
    --sky: #1592c9;
    --ink: #2a2118;
    --muted: #6f6357;
    --surface: #ffffff;
    --surface-2: #faf7f2;
    --border: #e8dfd3;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgb(63 40 20 / 6%), 0 2px 8px rgb(63 40 20 / 6%);
    --shadow: 0 6px 24px rgb(63 40 20 / 10%);

    --bs-body-font-family: "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--surface-2);
    --bs-primary: var(--brand);
    --bs-primary-rgb: 107, 68, 35;
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: 107, 68, 35;
    --bs-link-hover-color: var(--brand-dark);
    --bs-link-hover-color-rgb: 63, 40, 20;
    --bs-border-color: var(--border);
    --bs-border-radius: 10px;
}

html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body { line-height: 1.85; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, .h1, .h2, .h3, .h4, .h5 { font-family: "Noto Kufi Arabic", var(--bs-body-font-family); line-height: 1.5; color: var(--brand-dark); }
img { max-width: 100%; height: auto; }
::selection { background: var(--gold-light); }
.text-brand { color: var(--brand) !important; }
.text-gold { color: var(--gold) !important; }
.bg-brand-light { background: var(--brand-light) !important; }

.skip-link { position: absolute; inset-inline-start: 1rem; top: .5rem; z-index: 2000; background: #fff; padding: .5rem 1rem; border-radius: 8px; }

/* الأزرار */
.btn { font-weight: 600; border-radius: 10px; padding-inline: 1.15rem; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand); }
.btn-gold { --bs-btn-color: var(--brand-dark); --bs-btn-bg: var(--gold); --bs-btn-border-color: var(--gold); --bs-btn-hover-bg: #d18f0f; --bs-btn-hover-border-color: #d18f0f; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #d18f0f; }
.form-control:focus, .form-select:focus { border-color: var(--gold); box-shadow: 0 0 0 .2rem rgb(233 162 27 / 25%); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* الشريط العلوي والقائمة */
.topbar { background: var(--brand-dark); color: #f3e7d6; font-size: .85rem; padding-block: .35rem; }
.topbar a { color: #f3e7d6; text-decoration: none; }
.topbar a:hover { color: var(--gold); }
.topbar .bi-facebook, .topbar .bi-youtube { font-size: 1rem; }

/* بدون backdrop-filter: يجعل القائمة الجانبية (position: fixed) تابعة للهيدر وتسبب تمرير أفقي */
.site-header { background: #fff; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.site-header .navbar { padding-block: .4rem; }
.navbar-brand img { height: 56px; width: auto; }
.brand-text strong { font-family: "Noto Kufi Arabic", sans-serif; font-size: 1rem; color: var(--brand-dark); line-height: 1.4; }
.brand-text small { color: var(--muted); font-size: .78rem; }
.navbar-toggler { border: 0; font-size: 1.8rem; color: var(--brand-dark); }
.navbar-toggler:focus { box-shadow: none; }
.site-header .nav-link { white-space: nowrap; font-weight: 600; color: var(--ink); border-radius: 8px; padding-inline: .8rem !important; }
.site-header .nav-link:hover, .site-header .nav-link:focus { color: var(--brand); background: var(--brand-light); }
.site-header .nav-link.active { color: var(--brand); background: var(--gold-light); }
.dropdown-menu { border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: .5rem; }
.dropdown-item { border-radius: 8px; padding: .5rem .9rem; font-weight: 500; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--brand-light); color: var(--brand); }
@media (max-width: 1199.98px) {
    .offcanvas .nav-link { padding-block: .7rem; }
}

/* الشريحة الرئيسية */
.hero { position: relative; color: #fff; }
.hero .carousel-item { height: clamp(380px, 62vh, 620px); }
.hero .carousel-item img { width: 100%; height: 100%; object-fit: cover; }
.hero .carousel-item::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(20 12 4 / 15%) 0%, rgb(20 12 4 / 72%) 100%); }
.hero-caption { position: absolute; inset-inline: 0; bottom: 0; z-index: 2; padding-bottom: clamp(2.5rem, 7vh, 5rem); }
.hero-caption h1, .hero-caption h2 { color: #fff; font-size: clamp(1.6rem, 3.6vw, 2.8rem); font-weight: 800; text-shadow: 0 2px 12px rgb(0 0 0 / 35%); }
.hero-caption p { max-width: 46rem; font-size: clamp(1rem, 1.6vw, 1.2rem); opacity: .95; }
.hero .carousel-indicators { z-index: 3; margin-bottom: 1.25rem; }
.hero .carousel-indicators [data-bs-target] { width: 28px; height: 4px; border-radius: 4px; }

/* رأس الصفحات الداخلية */
.page-hero { background: radial-gradient(circle at 15% 20%, rgb(233 162 27 / 25%), transparent 45%), linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff; padding-block: 2.5rem 2.25rem; }
.page-hero h1 { color: #fff; font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 800; margin: 0; }
.page-hero .lead { color: #f3e7d6; font-size: 1.05rem; margin-top: .5rem; }
.page-hero .breadcrumb { margin-bottom: .6rem; --bs-breadcrumb-divider-color: #e6d3bb; --bs-breadcrumb-item-active-color: #fff; font-size: .9rem; }
.page-hero .breadcrumb a { color: #f3e7d6; text-decoration: none; }
.page-hero .breadcrumb a:hover { color: var(--gold); }
.breadcrumb-item + .breadcrumb-item::before { content: "‹"; }

/* الأقسام */
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section-alt { background: var(--surface); }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.section-title h2 { font-size: clamp(1.35rem, 2.4vw, 1.8rem); font-weight: 800; margin: 0; position: relative; padding-bottom: .6rem; }
.section-title h2::after { content: ""; position: absolute; inset-inline-start: 0; bottom: 0; width: 56px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--gold), var(--sky)); }
.eyebrow { display: inline-block; color: var(--gold); font-weight: 700; font-size: .85rem; letter-spacing: .02em; margin-bottom: .25rem; }

/* البطاقات */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; background: var(--surface); }
.card-hover { transition: transform .2s ease, box-shadow .2s ease; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-img-wrap { aspect-ratio: 16 / 10; overflow: hidden; background: var(--brand-light); position: relative; }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card-hover:hover .card-img-wrap img { transform: scale(1.05); }
.card-title { font-size: 1.05rem; font-weight: 700; line-height: 1.6; }
.card-title a { color: var(--brand-dark); text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; }
.card .meta { color: var(--muted); font-size: .85rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.card .badge-cat { position: absolute; top: .75rem; inset-inline-start: .75rem; z-index: 1; background: rgb(63 40 20 / 85%); color: #fff; font-weight: 600; font-size: .75rem; border-radius: 30px; padding: .35rem .75rem; }
.play-icon { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 3.4rem; text-shadow: 0 4px 18px rgb(0 0 0 / 45%); transition: transform .2s ease; }
.card-hover:hover .play-icon { transform: scale(1.12); }

.feature-card { padding: 1.75rem; height: 100%; }
.feature-icon { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; font-size: 1.6rem; background: var(--gold-light); color: var(--brand); margin-bottom: 1rem; }

.numbered-list { counter-reset: item; list-style: none; padding: 0; margin: 0; display: grid; gap: .85rem; }
.numbered-list li { counter-increment: item; position: relative; padding: 1rem 1.15rem; padding-inline-start: 3.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.numbered-list li::before { content: counter(item); position: absolute; inset-inline-start: 1rem; top: 1rem; width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; font-size: .9rem; }
@media (min-width: 992px) { .numbered-list.two-cols { grid-template-columns: 1fr 1fr; } }

/* الإحصائيات */
.stats-band { background: linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff; }
.stat { text-align: center; padding: 1.5rem .5rem; }
.stat .num { font-family: "Noto Kufi Arabic", sans-serif; font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 800; color: var(--gold); line-height: 1.2; }
.stat .label { color: #f3e7d6; }

/* المقالات */
.article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(1.25rem, 4vw, 2.5rem); box-shadow: var(--shadow-sm); }
.article-body { font-size: 1.08rem; line-height: 2; overflow-wrap: anywhere; }
.article-body img { border-radius: 10px; margin-block: .75rem; height: auto !important; }
.article-body iframe { max-width: 100%; }
.article-body table { width: 100%; max-width: 100%; display: block; overflow-x: auto; }
.article-cover { border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; max-height: 460px; }
.article-cover img { width: 100%; height: 100%; max-height: 460px; object-fit: cover; }
.article .meta { color: var(--muted); font-size: .92rem; display: flex; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.share-bar a { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--border); color: var(--brand); text-decoration: none; }
.share-bar a:hover { background: var(--brand); color: #fff; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: .75rem; }
.gallery a { display: block; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--brand-light); }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.gallery a:hover img { transform: scale(1.06); }

.sidebar-card { position: sticky; top: 110px; }
.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list li + li { border-top: 1px solid var(--border); }
.mini-list a { display: flex; gap: .75rem; padding: .75rem 0; text-decoration: none; color: var(--ink); align-items: center; }
.mini-list a:hover { color: var(--brand); }
.mini-list img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.mini-list .t { font-weight: 600; font-size: .92rem; line-height: 1.6; }

/* الجداول */
.table-modern { --bs-table-bg: transparent; margin: 0; }
.table-modern thead th { background: var(--brand-light); color: var(--brand-dark); font-weight: 700; border-bottom: 0; white-space: nowrap; }
.table-modern td, .table-modern th { padding: .85rem 1rem; vertical-align: middle; }
.table-modern tbody tr:hover { background: var(--surface-2); }
@media (max-width: 767.98px) {
    .table-stack thead { display: none; }
    .table-stack tbody tr { display: block; padding: .75rem 0; border-bottom: 1px solid var(--border); }
    .table-stack tbody td { display: flex; gap: .75rem; border: 0; padding: .3rem 1rem; }
    .table-stack tbody td::before { content: attr(data-label); font-weight: 700; color: var(--brand); min-width: 6.5rem; flex-shrink: 0; }
}

/* الفيديو */
.ratio iframe { border-radius: var(--radius); }

/* النماذج */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(1.25rem, 4vw, 2rem); box-shadow: var(--shadow-sm); }
.form-label { font-weight: 600; }
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.contact-item { display: flex; gap: 1rem; align-items: start; }
.contact-item .icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-light); color: var(--brand); font-size: 1.3rem; flex-shrink: 0; }
.map-frame { width: 100%; min-height: 340px; border: 0; border-radius: var(--radius); }

/* التذييل */
.site-footer { background: #20160d; color: #d9cbb8; padding-block: 3rem 1.5rem; margin-top: 3rem; }
.site-footer h2 { color: #fff; font-weight: 700; margin-bottom: 1rem; }
.site-footer a { color: #d9cbb8; text-decoration: none; }
.site-footer a:hover { color: var(--gold); }
.site-footer hr { border-color: rgb(255 255 255 / 15%); margin-block: 2rem 1.25rem; }
.footer-logo { height: 64px; width: auto; filter: drop-shadow(0 2px 8px rgb(0 0 0 / 40%)); }
.footer-links li { margin-bottom: .45rem; }

.back-to-top { position: fixed; bottom: 1.25rem; inset-inline-end: 1.25rem; width: 46px; height: 46px; padding: 0; z-index: 1030; box-shadow: var(--shadow); }

/* عارض الصور */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgb(10 6 2 / 92%); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox img { max-width: min(92vw, 1400px); max-height: 86vh; border-radius: 10px; box-shadow: 0 10px 40px rgb(0 0 0 / 50%); }
.lightbox-close { position: fixed; top: 1.25rem; inset-inline-end: 1.25rem; z-index: 2; }
.lightbox-nav { position: fixed; top: 50%; transform: translateY(-50%); border: 0; background: rgb(255 255 255 / 12%); color: #fff; width: 52px; height: 52px; border-radius: 50%; font-size: 1.5rem; }
.lightbox-nav:hover { background: rgb(255 255 255 / 25%); }
.lightbox-prev { inset-inline-start: 1rem; }
.lightbox-next { inset-inline-end: 1rem; }

.empty-state { color: var(--muted); }
.pagination { --bs-pagination-color: var(--brand); --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-hover-color: var(--brand-dark); --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgb(233 162 27 / 25%); gap: .25rem; }
.pagination .page-link { border-radius: 8px !important; min-width: 2.5rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
    .topbar, .site-header, .site-footer, .back-to-top, .share-bar, .sidebar-card { display: none !important; }
    .page-hero { background: none; color: #000; padding: 0 0 1rem; }
    .page-hero h1 { color: #000; }
    .article { border: 0; box-shadow: none; padding: 0; }
}
