/* ==========================================================================
   قاعدة معرفة الجدول الذكي — واجهة الزوار
   ألوان الهوية مستخرجة من شعار Smartble
   ========================================================================== */
:root {
    --brand: #3C9AA6;
    --brand-dark: #2E7A85;
    --brand-darker: #1E5860;
    --brand-light: #44C4C5;
    --brand-soft: #E7F5F6;
    --brand-softer: #F4FBFB;
    --ink: #14323A;
    --muted: #6B8087;
    --line: #E3ECEE;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgba(20, 50, 58, .06), 0 2px 8px rgba(20, 50, 58, .04);
    --shadow-md: 0 4px 12px rgba(20, 50, 58, .07), 0 12px 28px rgba(20, 50, 58, .06);
}

* { scroll-behavior: smooth; }

body {
    font-family: 'Tajawal', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: #fff;
    font-size: 16px;
    line-height: 1.85;
}

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

.text-brand { color: var(--brand) !important; }
.bg-brand { background-color: var(--brand) !important; }
.bg-brand-soft { background-color: var(--brand-soft) !important; }

.btn-brand {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 700;
}
.btn-brand:hover, .btn-brand:focus {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}
.btn-outline-brand {
    border-color: var(--brand);
    color: var(--brand-dark);
    font-weight: 700;
}
.btn-outline-brand:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* ---------- الهيدر ---------- */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1030;
}
.site-header .navbar-brand img { height: 38px; width: auto; }
.site-header .navbar-brand span {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--ink);
    line-height: 1.2;
}
.site-header .navbar-brand small {
    display: block;
    font-size: .72rem;
    color: var(--muted);
    font-weight: 500;
}
.site-header .nav-link {
    font-weight: 600;
    color: var(--ink);
    padding: .5rem .9rem !important;
    border-radius: 8px;
}
.site-header .nav-link:hover { background: var(--brand-soft); color: var(--brand-dark); }
.site-header .nav-link.active { color: var(--brand-dark); background: var(--brand-soft); }

/* ---------- الهيرو ---------- */
.hero {
    background:
        radial-gradient(1100px 340px at 80% -60px, rgba(68, 196, 197, .25), transparent 65%),
        linear-gradient(180deg, var(--brand-softer) 0%, #fff 100%);
    padding: 3.2rem 0 2.6rem;
    border-bottom: 1px solid var(--line);
}
.hero h1 {
    font-weight: 800;
    font-size: clamp(1.5rem, 4.4vw, 2.35rem);
    margin-bottom: .6rem;
}
.hero p.lead { color: var(--muted); font-size: 1.02rem; }

.kb-search {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow-md);
    padding: .35rem .35rem .35rem 1.1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.kb-search input {
    border: 0;
    outline: 0;
    flex: 1;
    font-size: 1rem;
    padding: .65rem .4rem;
    background: transparent;
    min-width: 0;
}
.kb-search .bi-search { color: var(--muted); font-size: 1.15rem; }
.kb-search button { border-radius: 999px; padding: .6rem 1.5rem; white-space: nowrap; }

.chip {
    display: inline-block;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 999px;
    padding: .25rem .85rem;
    font-size: .85rem;
    margin: .25rem .15rem;
    transition: .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }

/* ---------- بطاقات التصنيفات ---------- */
.section-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 800;
    font-size: 1.3rem;
    margin-bottom: .3rem;
}
.section-sub { color: var(--muted); margin-bottom: 1.4rem; }

.cat-card {
    display: block;
    height: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem;
    transition: .18s ease;
    box-shadow: var(--shadow-sm);
}
.cat-card:hover {
    transform: translateY(-3px);
    border-color: var(--brand-light);
    box-shadow: var(--shadow-md);
}
.cat-card .cat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: grid; place-items: center;
    font-size: 1.4rem;
    margin-bottom: .9rem;
}
.cat-card h3 { font-size: 1.05rem; font-weight: 800; color: var(--ink); margin-bottom: .35rem; }
.cat-card p { color: var(--muted); font-size: .9rem; margin: 0 0 .75rem; line-height: 1.7; }
.cat-card .count { font-size: .82rem; color: var(--brand-dark); font-weight: 700; }

/* ---------- قائمة المواضيع ---------- */
.article-item {
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    padding: .95rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    transition: .15s;
    height: 100%;
}
.article-item:hover { border-color: var(--brand-light); background: var(--brand-softer); }
.article-item i.lead-icon { color: var(--brand); font-size: 1.15rem; margin-top: .15rem; }
.article-item .t { font-weight: 700; color: var(--ink); display: block; }
.article-item .d { color: var(--muted); font-size: .86rem; line-height: 1.6; }
.article-item .meta { font-size: .78rem; color: var(--muted); }

/* ---------- صفحة الموضوع ---------- */
.kb-breadcrumb {
    font-size: .88rem;
    color: var(--muted);
    padding: 1rem 0;
}
.kb-breadcrumb a { color: var(--muted); }
.kb-breadcrumb a:hover { color: var(--brand); }

.article-head h1 {
    font-weight: 800;
    font-size: clamp(1.35rem, 3.6vw, 2rem);
    margin-bottom: .6rem;
}
.article-meta { color: var(--muted); font-size: .86rem; display: flex; flex-wrap: wrap; gap: 1rem; }

.kb-content { font-size: 1.03rem; line-height: 2.05; }
.kb-content h2 {
    font-size: 1.3rem; font-weight: 800; margin: 2rem 0 .8rem;
    padding-inline-start: .7rem; border-inline-start: 4px solid var(--brand-light);
}
.kb-content h3 { font-size: 1.12rem; font-weight: 800; margin: 1.5rem 0 .6rem; color: var(--brand-darker); }
.kb-content h4 { font-size: 1rem; font-weight: 700; margin: 1.2rem 0 .5rem; }
.kb-content p { margin-bottom: 1rem; }
.kb-content img {
    max-width: 100%; height: auto;
    border-radius: 12px;
    border: 1px solid var(--line);
    margin: 1rem 0;
    display: block;
}
.kb-content figure { margin: 1.2rem 0; }
.kb-content figcaption { color: var(--muted); font-size: .85rem; text-align: center; margin-top: .4rem; }
.kb-content ul, .kb-content ol { padding-inline-start: 1.4rem; margin-bottom: 1rem; }
.kb-content li { margin-bottom: .45rem; }
.kb-content blockquote {
    background: var(--brand-soft);
    border-inline-start: 4px solid var(--brand);
    border-radius: 10px;
    padding: .9rem 1.1rem;
    margin: 1.2rem 0;
    color: var(--brand-darker);
}
.kb-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2rem 0;
    font-size: .95rem;
}
.kb-content table th, .kb-content table td {
    border: 1px solid var(--line);
    padding: .6rem .8rem;
    text-align: start;
}
.kb-content table th { background: var(--brand-soft); font-weight: 700; }
.kb-content pre {
    background: #0f2a30; color: #d7f1f3;
    padding: 1rem; border-radius: 12px;
    overflow-x: auto; direction: ltr; text-align: left;
}
.kb-content code { background: var(--brand-soft); padding: .1rem .35rem; border-radius: 5px; font-size: .9em; }
.kb-content pre code { background: transparent; color: inherit; }
.kb-content .table-wrap { overflow-x: auto; }

.ratio-video {
    position: relative; width: 100%; padding-top: 56.25%;
    border-radius: 14px; overflow: hidden; border: 1px solid var(--line);
    background: #000; margin: 1.2rem 0;
}
.ratio-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* الصور والفيديو داخل محتوى المحرر */
.kb-content iframe {
    max-width: 100%;
    aspect-ratio: 16 / 9;
    width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--line);
    margin: 1rem 0;
}

/* ---------- الشريط الجانبي ---------- */
.side-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem;
    box-shadow: var(--shadow-sm);
}
.side-card h4 { font-size: .95rem; font-weight: 800; margin-bottom: .8rem; color: var(--ink); }
.side-list a {
    display: block;
    padding: .5rem .6rem;
    border-radius: 8px;
    color: var(--ink);
    font-size: .92rem;
    line-height: 1.6;
}
.side-list a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.side-list a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }

#toc a { display: block; padding: .35rem .5rem; font-size: .88rem; color: var(--muted); border-inline-start: 2px solid var(--line); }
#toc a:hover, #toc a.active { color: var(--brand-dark); border-inline-start-color: var(--brand); background: var(--brand-softer); }
#toc a.lvl-3 { padding-inline-start: 1.3rem; font-size: .84rem; }

/* ---------- التقييم ---------- */
.feedback-box {
    background: var(--brand-softer);
    border: 1px dashed var(--brand-light);
    border-radius: var(--radius);
    padding: 1.3rem;
    text-align: center;
    margin-top: 2.5rem;
}

/* ---------- الأسئلة المتكررة ---------- */
.accordion-item { border: 1px solid var(--line); border-radius: 12px !important; margin-bottom: .7rem; overflow: hidden; }
.accordion-button { font-weight: 700; background: #fff; box-shadow: none !important; }
.accordion-button:not(.collapsed) { background: var(--brand-soft); color: var(--brand-darker); }
.accordion-button::after { margin-inline-start: auto; margin-inline-end: 0; }
.accordion-body { color: #35525a; }

/* ---------- الفوتر ---------- */
.site-footer {
    background: var(--brand-darker);
    color: #cfe7ea;
    padding: 2.5rem 0 1.5rem;
    margin-top: 4rem;
}
.site-footer a { color: #cfe7ea; }
.site-footer a:hover { color: #fff; }
.site-footer img { height: 40px; background: #fff; border-radius: 8px; padding: 4px; }

/* ---------- عام ---------- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state > i { font-size: 2.6rem; color: var(--line); display: block; margin-bottom: .8rem; }

mark { background: #fff3a3; padding: 0 .15rem; border-radius: 3px; }

@media (max-width: 767.98px) {
    body { font-size: 15px; }
    .hero { padding: 2rem 0 1.8rem; }
    .kb-search { padding: .3rem .3rem .3rem .8rem; }
    .kb-search button { padding: .55rem 1rem; }
    .kb-content { font-size: 1rem; line-height: 1.95; }
    .site-header .navbar-brand img { height: 32px; }
}

/* ---------- مجموعات البرامج ---------- */
.product-group-head {
    display: flex; align-items: center; gap: .7rem;
    padding-bottom: .7rem; margin-bottom: 1.2rem;
    border-bottom: 2px solid var(--line);
}
.product-group-head h2 { font-size: 1.15rem; font-weight: 800; margin: 0; }
.side-group { font-size: .74rem; font-weight: 700; color: var(--muted); padding: .7rem .6rem .2rem; }
.product-card .count { color: var(--brand-dark); }
.cat-badges .badge { font-weight: 600; }

/* شريط التنقل: منع التفاف الروابط عند ازدحام العناصر */
.site-header .nav-link,
.site-header .navbar-nav .btn { white-space: nowrap; }
@media (min-width: 992px) and (max-width: 1399.98px) {
    .site-header .nav-link { padding: .45rem .6rem !important; font-size: .92rem; }
    .site-header .navbar-nav .btn { font-size: .85rem; padding-inline: .8rem !important; }
    .site-header .navbar-brand span { font-size: .95rem; }
}

/* ---------- الإجراءات السريعة ---------- */
.quick-actions {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.1rem 1.2rem;
    box-shadow: var(--shadow-md);
    margin-top: -2.6rem;
    position: relative;
    z-index: 5;
}
.quick-actions-head {
    display: flex; align-items: center; gap: .5rem;
    font-weight: 800; font-size: .95rem; color: var(--ink);
    margin-bottom: .9rem;
}
.quick-actions-head i { color: #f0a500; }

.quick-action {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    gap: .35rem; height: 100%;
    padding: .9rem .6rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--brand-softer);
    transition: .16s ease;
}
.quick-action:hover {
    transform: translateY(-2px);
    border-color: var(--brand-light);
    background: var(--brand-soft);
    box-shadow: var(--shadow-sm);
}
.quick-action .qa-icon {
    width: 40px; height: 40px; border-radius: 11px;
    display: grid; place-items: center; font-size: 1.15rem;
    background: #fff; color: var(--brand-dark);
    border: 1px solid var(--line);
}
.quick-action .qa-label { font-weight: 700; font-size: .9rem; color: var(--ink); line-height: 1.45; }
.quick-action .qa-desc { font-size: .76rem; color: var(--muted); line-height: 1.5; }

@media (max-width: 767.98px) {
    .quick-actions { margin-top: -1.6rem; padding: .9rem .8rem 1rem; }
    .quick-action { padding: .75rem .45rem; }
    .quick-action .qa-label { font-size: .84rem; }
    .quick-action .qa-desc { display: none; }
}

/* ---------- بطاقات الإجابة في نتائج البحث ---------- */
.answer-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow-sm);
}
.answer-card.is-top {
    border-color: var(--brand-light);
    background: linear-gradient(180deg, var(--brand-softer), #fff);
    box-shadow: var(--shadow-md);
    padding: 1.3rem 1.4rem;
}
.answer-badge {
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .78rem; font-weight: 700; color: var(--brand-dark);
    background: #fff; border: 1px solid var(--brand-light);
    padding: .2rem .7rem; border-radius: 999px; margin-bottom: .7rem;
}
.answer-q { font-size: 1.08rem; font-weight: 800; color: var(--ink); margin-bottom: .5rem; line-height: 1.6; }
.answer-card.is-top .answer-q { font-size: 1.2rem; }
.answer-a { color: #35525a; line-height: 1.95; margin-bottom: .7rem; }
.answer-src {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .82rem; color: var(--muted); font-weight: 600;
}
.answer-src:hover { color: var(--brand-dark); }

.no-answer {
    text-align: center; padding: 2.5rem 1.2rem;
    background: var(--brand-softer);
    border: 1px dashed var(--brand-light);
    border-radius: var(--radius);
    margin-bottom: 2rem;
}
.no-answer > i { font-size: 2.4rem; color: var(--brand-light); display: block; margin-bottom: .7rem; }

/* ---------- الاقتراحات الفورية ---------- */
.suggest-anchor { position: relative; }
.suggest-box {
    position: absolute; inset-inline-start: 0; top: calc(100% + .5rem);
    min-width: min(380px, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow-md); z-index: 1050;
    max-height: 340px; overflow-y: auto; text-align: start;
}
/* داخل حقل البحث الكبير تأخذ القائمة عرض الحقل نفسه */
.suggest-anchor:not(.nav-search) .suggest-box { inset-inline: 0; min-width: 0; }
.suggest-box a {
    display: block; padding: .65rem .9rem; border-bottom: 1px solid var(--line);
    color: var(--ink); font-size: .92rem; line-height: 1.55;
}
.suggest-box a:last-child { border-bottom: 0; }
.suggest-box a:hover, .suggest-box a.is-active { background: var(--brand-soft); }
.suggest-box a small { display: block; color: var(--muted); font-size: .76rem; margin-top: .1rem; }
.suggest-box .suggest-empty { padding: .8rem .9rem; color: var(--muted); font-size: .88rem; }

/* ---------- حقل البحث في شريط التنقل ---------- */
.nav-search { min-width: 210px; }
.kb-search-sm {
    padding: .1rem .1rem .1rem .8rem;
    box-shadow: none;
    background: var(--brand-softer);
}
.kb-search-sm input { font-size: .9rem; padding: .4rem .3rem; }
.kb-search-sm .bi-search { font-size: 1rem; }
.kb-search-sm:focus-within { background: #fff; border-color: var(--brand-light); }

/* حقل السؤال داخل الشريط الجانبي لصفحة الموضوع */
.side-card .kb-search { box-shadow: none; background: var(--brand-softer); padding: .25rem .25rem .25rem .7rem; }
.side-card .kb-search input { font-size: .88rem; padding: .4rem .25rem; }

/* زر بأيقونة فقط للمساحات الضيقة */
.kb-search .btn-icon {
    width: 34px; height: 34px; padding: 0 !important;
    display: grid; place-items: center; flex: 0 0 auto;
}
.kb-search input { min-width: 4rem; }

@media (max-width: 991.98px) {
    .nav-search { min-width: 0; width: 100%; margin-top: .5rem; }
    .suggest-box { position: static; margin-top: .5rem; min-width: 0; max-width: 100%; }
}
