/* ============================================================
   خوارزميات — صفحة التصنيف (categoryShow) بالهوية الجديدة
   بانر هوية + مسار تنقّل + بطاقات أقسام تفاعلية
   ============================================================ */

/* ---------- بانر الهوية العلوي ---------- */
.khw-cathero {
    position: relative;
    overflow: hidden;
    padding: 70px 0 84px;
    background:
        radial-gradient(ellipse 80% 90% at 78% 25%, rgba(15, 77, 51, 0.6) 0%, transparent 62%),
        radial-gradient(ellipse 60% 80% at 12% 80%, rgba(31, 64, 104, 0.35) 0%, transparent 65%),
        linear-gradient(160deg, #0a2e1f 0%, #04180f 100%);
    direction: rtl;
}

.khw-cathero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(127, 227, 176, 0.14) 1.2px, transparent 1.2px);
    background-size: 30px 30px;
    -webkit-mask-image: radial-gradient(ellipse 70% 90% at 30% 50%, #000 0%, transparent 78%);
    mask-image: radial-gradient(ellipse 70% 90% at 30% 50%, #000 0%, transparent 78%);
    pointer-events: none;
}

.khw-cathero::after {
    content: "";
    position: absolute;
    top: -70px;
    left: -60px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 159, 69, 0.14) 0%, transparent 70%);
    pointer-events: none;
}

.khw-cathero__inner { position: relative; z-index: 2; }

/* مسار التنقل */
.khw-crumb {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: "Tajawal", sans-serif;
    font-size: 14.5px;
    font-weight: 500;
    margin-bottom: 18px;
    color: #9fd4b8;
}

.khw-crumb a { color: #cfe9db; text-decoration: none; transition: color 0.25s ease; }
.khw-crumb a:hover { color: var(--khw-green-soft, #7fe3b0); }
.khw-crumb i { font-size: 11px; color: rgba(127, 227, 176, 0.5); }
.khw-crumb .khw-crumb__current { color: var(--khw-green-soft, #7fe3b0); font-weight: 700; }

/* الكيكر */
.khw-cathero__kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: "Tajawal", sans-serif;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--khw-green-soft, #7fe3b0);
    margin: 0 0 12px;
}

.khw-cathero__kicker::before {
    content: "";
    width: 28px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(270deg, #2eb97e, transparent);
}

.khw-cathero__title {
    font-family: "Tajawal", sans-serif;
    font-size: clamp(30px, 4vw, 48px);
    font-weight: 800;
    color: #f2fbf6;
    line-height: 1.25;
    margin: 0 0 14px;
    text-shadow: 0 0 26px rgba(46, 185, 126, 0.3);
}

.khw-cathero__desc {
    font-family: "Tajawal", sans-serif;
    font-size: 17px;
    line-height: 1.85;
    color: #cfe9db;
    max-width: 620px;
    margin: 0 0 20px;
}

.khw-cathero__desc :is(p, div, span) { color: inherit; margin: 0; }

.khw-cathero__count {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: "Tajawal", sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #d9f3e5;
    background: rgba(127, 227, 176, 0.1);
    border: 1px solid rgba(127, 227, 176, 0.26);
    border-radius: 999px;
    padding: 9px 18px;
}

.khw-cathero__count i { color: var(--khw-orange, #ff9f45); }

/* ---------- شبكة بطاقات الأقسام ---------- */
.khw-catgrid {
    padding: 70px 0 100px;
    background:
        radial-gradient(ellipse 55% 50% at 90% 8%, rgba(46, 185, 126, 0.06) 0%, transparent 60%),
        linear-gradient(180deg, #f6faf7 0%, #fbfdfb 100%);
    direction: rtl;
    position: relative;
}

.khw-catgrid::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(46, 185, 126, 0.12) 1.2px, transparent 1.2px);
    background-size: 34px 34px;
    -webkit-mask-image: radial-gradient(ellipse 50% 55% at 88% 12%, #000 0%, transparent 70%);
    mask-image: radial-gradient(ellipse 50% 55% at 88% 12%, #000 0%, transparent 70%);
    pointer-events: none;
}

.khw-catgrid__inner { position: relative; z-index: 2; }

.khw-catgrid__head { margin-bottom: 40px; }

.khw-catgrid__head h2 {
    font-family: "Tajawal", sans-serif;
    font-size: clamp(22px, 2.4vw, 30px);
    font-weight: 800;
    color: var(--khw-navy, #16324f);
    margin: 0;
}

.khw-catgrid__head h2 span { color: #157f52; }

.khw-catcards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 22px;
}

/* بطاقة القسم */
.khw-catcard {
    position: relative;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 24px 24px;
    background: #fff;
    border: 1px solid rgba(22, 50, 79, 0.09);
    border-radius: 20px;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(22, 50, 79, 0.05), 0 16px 34px -18px rgba(22, 50, 79, 0.16);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}

/* توهج علوي يظهر عند المرور */
.khw-catcard::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(270deg, #2eb97e, #ff9f45);
    transform: scaleX(0);
    transform-origin: right center;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.khw-catcard:hover {
    transform: translateY(-7px);
    border-color: rgba(46, 185, 126, 0.4);
    box-shadow: 0 6px 14px rgba(22, 50, 79, 0.08), 0 30px 56px -20px rgba(6, 35, 26, 0.4);
}

.khw-catcard:hover::before { transform: scaleX(1); }

/* شارة الأيقونة */
.khw-catcard__icon {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #157f52;
    background: rgba(46, 185, 126, 0.1);
    border: 1px solid rgba(46, 185, 126, 0.25);
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* توحيد ألوان كل الأيقونات (SVG من قاعدة البيانات) على لون الشارة */
.khw-catcard__icon svg {
    width: 30px;
    height: 30px;
}

.khw-catcard__icon svg,
.khw-catcard__icon svg path {
    fill: currentColor !important;
}

.khw-catcard:hover .khw-catcard__icon {
    background: linear-gradient(135deg, #7fe3b0, #2eb97e);
    border-color: transparent;
    color: #06231a;
    transform: rotate(-6deg) scale(1.05);
    box-shadow: 0 12px 26px rgba(46, 185, 126, 0.4);
}

/* محتوى البطاقة */
.khw-catcard__body { flex: 1; min-width: 0; }

.khw-catcard__body h3 {
    font-family: "Tajawal", sans-serif;
    font-size: 19px;
    font-weight: 800;
    color: var(--khw-navy, #16324f);
    margin: 0 0 6px;
    transition: color 0.3s ease;
}

.khw-catcard:hover .khw-catcard__body h3 { color: #157f52; }

.khw-catcard__go {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "Tajawal", sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #8aa0ac;
    transition: color 0.3s ease, gap 0.3s ease;
}

.khw-catcard__go i { font-size: 12px; transition: transform 0.3s ease; }

.khw-catcard:hover .khw-catcard__go { color: var(--khw-orange, #ff9f45); }
.khw-catcard:hover .khw-catcard__go i { transform: translateX(-4px); }

/* حالة فارغة */
.khw-catempty {
    text-align: center;
    padding: 40px 20px;
    font-family: "Tajawal", sans-serif;
    font-size: 17px;
    color: #52666f;
}

/* ---------- التجاوب ---------- */
@media (max-width: 575px) {
    .khw-cathero { padding: 54px 0 64px; }
    .khw-catgrid { padding: 54px 0 72px; }
    .khw-catcards { grid-template-columns: 1fr; }
    .khw-catcard { padding: 20px; gap: 14px; }
    .khw-catcard__icon { width: 54px; height: 54px; border-radius: 15px; }
}

/* ---------- تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
    .khw-catcard,
    .khw-catcard::before,
    .khw-catcard__icon,
    .khw-catcard__body h3,
    .khw-catcard__go,
    .khw-catcard__go i { transition: none !important; }
    .khw-catcard:hover { transform: none; }
    .khw-catcard:hover .khw-catcard__icon { transform: none; }
}
