/* ============================
   VARIABLES & RESET
============================ */
:root {
    --bg-primary:    #f0f5ff;
    --bg-secondary:  #ffffff;
    --bg-card:       #ffffff;
    --bg-card-hover: #eff6ff;
    --border:        #dbeafe;
    --border-dark:   #bfdbfe;
    --blue:          #2563eb;
    --blue-dark:     #1d4ed8;
    --blue-light:    #60a5fa;
    --blue-pale:     #eff6ff;
    --blue-mid:      #3b82f6;
    --navy:          #1e3a5f;
    --text-primary:  #0f172a;
    --text-secondary:#475569;
    --text-muted:    #94a3b8;
    --radius:        14px;
    --radius-sm:     8px;
    --transition:    0.22s ease;
    --shadow:        0 4px 20px rgba(37,99,235,0.1);
    --shadow-blue:   0 8px 30px rgba(37,99,235,0.18);
    --shadow-card:   0 2px 12px rgba(15,23,42,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    text-align: start;
    line-height: 1.6;
    overflow-x: hidden;
}

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

/* ============================
   CONTAINER
============================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}
@media (max-width: 480px) {
    .container { padding: 0 10px; }
}

/* ============================
   NAVBAR
============================ */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 12px rgba(37,99,235,0.08);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    border: 1px solid #dfe9ff;
    border-radius: 12px;
    padding: 6px 10px;
}

.logo-img {
    height: 36px;
    width: auto;
    display: block;
}

.logo-img--mob {
    height: 28px;
}

.logo-icon {
    font-size: 1.4rem;
    color: var(--blue);
}

.logo-text-wrap {
    display: flex;
    flex-direction: column;
    line-height: 1;
    gap: 3px;
    text-align: left;
}

.logo-main {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--navy);
}

.logo-accent { color: var(--blue); }

.logo-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.5px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2px;
    align-items: center;
}

.nav-links > li { position: relative; }
.nav-links > li.has-mega { position: static; }

.nav-links > li > a {
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.nav-links > li { margin: 0 2px; }

.nav-links > li:not(.has-mega) > a:hover,
.nav-links > li:not(.has-mega).active > a {
    color: var(--blue);
    background: var(--blue-pale);
}

.nav-home-link {
    border: 1px solid rgba(59,130,246,0.3) !important;
    background: transparent !important;
}
.nav-home-link:hover {
    background: #eff6ff !important;
}

.nav-arrow {
    display: inline-block;
    vertical-align: middle;
    opacity: 0.5;
    transition: transform var(--transition), opacity var(--transition);
    flex-shrink: 0;
}

.nav-links > li:hover .nav-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

/* ============================
   MEGA MENU
============================ */
.mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    width: 580px;
    background: #ffffff;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    box-shadow: var(--shadow-blue);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 200;
}

.mega-menu::before, .mega-menu::after { display: none; }

.has-mega:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* أقسام تظهر فقط في القائمة الجانبية على الهاتف */
.nav-mob-only { display: none; }
/* أقسام تظهر فقط على الديسكتوب */
.nav-desk-only { display: list-item; }

/* ميغا منيو عريض للأقسام الرئيسية */
.mega-menu--wide {
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    transform: translateY(8px);
    border-radius: 0 0 16px 16px;
    border-top: 3px solid var(--cat-color, var(--blue));
}
.has-mega:hover .mega-menu--wide {
    transform: translateY(0);
}

/* شبكة عرض الأقسام */
.mega-cols-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 10px;
    padding: 0;
}

/* كارد القسم الفرعي */
.mega-sub-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow .2s, border-color .2s;
}
.mega-sub-card:hover {
    border-color: var(--cat-color, var(--blue));
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

.mega-sub-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: .79rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}

.mega-sub-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(255,255,255,.5);
    font-size: .77rem;
    flex-shrink: 0;
}

.mega-sub-tools {
    padding: 5px 6px;
}

/* صف الأداة */
.mega-tool-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 6px;
    border-radius: 6px;
    text-decoration: none;
    transition: background .15s;
}
.mega-tool-row:hover {
    background: var(--tb, #f1f5f9);
}
.mega-tool-row:hover .mega-tool-name { color: var(--tc, #3b82f6); }

.soon-inline {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 50px;
    font-size: .65rem;
    font-weight: 400;
    background: var(--cat-color, var(--blue));
    color: #fff !important;
    margin-inline-start: 5px;
    vertical-align: middle;
    opacity: .9;
}
.cat-list-card--soon,
.cat-tool-card--soon { opacity: .75; }

.nav-soon-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 50px;
    font-size: .6rem;
    font-weight: 700;
    background: var(--tc, var(--blue));
    color: #fff;
    margin-inline-start: 5px;
    flex-shrink: 0;
    vertical-align: middle;
    opacity: .9;
}

.mega-tool-icon {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: var(--tb, #f1f5f9);
    color: var(--tc, #64748b);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
    flex-shrink: 0;
    transition: background .15s;
}
.mega-tool-row:hover .mega-tool-icon {
    background: var(--tc, #3b82f6);
    color: #fff;
}

.mega-tool-name {
    font-size: .75rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .15s;
}

/* أيقونة القسم في النافبار */
.nav-cat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--cat-bg, #f1f5f9);
    color: var(--cat-color, #475569);
    font-size: 0.78rem;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.has-mega:hover .nav-cat-icon { transform: scale(1.1); }

/* مربع عنصر القسم في النافبار */
.has-mega > a {
    border: 1px solid color-mix(in srgb, var(--cat-color, var(--border)) 30%, transparent 70%);
    background: transparent;
}
.has-mega:hover > a {
    border-color: var(--cat-color, var(--blue));
    background: var(--cat-bg, var(--blue-pale));
    color: var(--cat-color, var(--blue));
}

.mega-inner { padding: 16px 20px 20px; }

.mega-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.mega-heading h3 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 7px;
}

.mega-view-all {
    font-size: 0.82rem;
    color: var(--blue);
    font-weight: 500;
    transition: color var(--transition);
}

.mega-view-all:hover { color: var(--blue-dark); }

.mega-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.mega-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    cursor: pointer;
}

.mega-item:hover { background: var(--blue-pale); }

.mega-icon {
    width: 34px;
    height: 34px;
    background: var(--blue-pale);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: var(--blue);
    flex-shrink: 0;
    transition: all var(--transition);
}

.mega-item:hover .mega-icon {
    background: var(--blue);
    color: #ffffff;
}

.mega-item div { flex: 1; min-width: 0; }

.mega-item strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.mega-item small {
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* ============================
   NAV CONTROLS (dark + lang)
============================ */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* --- Dark Mode Switch --- */
.dark-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.dark-switch input { display: none; }

.dark-switch-track {
    position: relative;
    width: 52px;
    height: 28px;
    background: #e2e8f0;
    border-radius: 50px;
    border: 1px solid var(--border-dark);
    transition: background 0.3s, border-color 0.3s;
    display: flex;
    align-items: center;
    padding: 0 5px;
    justify-content: space-between;
}

.dark-icon-sun  { font-size: 0.7rem; color: #f59e0b; z-index: 1; }
.dark-icon-moon { font-size: 0.65rem; color: #94a3b8; z-index: 1; }

.dark-switch-thumb {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    transition: transform 0.3s ease, background 0.3s;
    z-index: 2;
}

/* checked state */
.dark-switch input:checked + .dark-switch-track {
    background: #1e3a8a;
    border-color: #3b82f6;
}

.dark-switch input:checked + .dark-switch-track .dark-icon-moon { color: #93c5fd; }

.dark-switch input:checked + .dark-switch-track .dark-switch-thumb {
    transform: translateX(-24px);
    background: #93c5fd;
}

/* --- Language Picker --- */
.lang-picker {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #ffffff;
    border: 1px solid var(--border-dark);
    border-radius: 50px;
    padding: 6px 14px 6px 10px;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(37,99,235,0.08);
}

.lang-btn-flag {
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}

.lang-btn .nav-arrow {
    opacity: 0.4;
    transition: transform var(--transition), opacity var(--transition);
    margin-right: 2px;
}

.lang-btn:hover {
    border-color: var(--blue);
    box-shadow: 0 2px 10px rgba(37,99,235,0.15);
}

.lang-picker.open .lang-btn {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.lang-picker.open .lang-btn .nav-arrow { transform: rotate(180deg); opacity: 1; }

.lang-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 200px;
    background: #ffffff;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(37,99,235,0.14), 0 2px 8px rgba(0,0,0,0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px) scale(0.98);
    transform-origin: top left;
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    z-index: 300;
    overflow: hidden;
    padding: 6px;
}

/* مثلث صغير فوق الـ dropdown */
.lang-dropdown::before {
    content: '';
    position: absolute;
    top: -7px; left: 20px;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid var(--border-dark);
}
.lang-dropdown::after {
    content: '';
    position: absolute;
    top: -5px; left: 21px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #ffffff;
}

.lang-picker.open .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.lang-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    font-size: 0.86rem;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
    border-radius: 8px;
}

.lang-item:hover {
    background: var(--blue-pale);
    color: var(--blue);
}

.lang-item--active {
    background: var(--blue-pale);
    color: var(--blue);
    font-weight: 600;
    position: relative;
}

.lang-item--active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
    color: var(--blue);
    margin-right: auto;
}

.lang-flag { font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.lang-name  { flex: 1; }

/* ============================
   DARK MODE THEME
============================ */
body.dark {
    --bg-primary:    #0f172a;
    --bg-secondary:  #1e293b;
    --bg-card:       #1e293b;
    --bg-card-hover: #263248;
    --border:        #1e3a5f;
    --border-dark:   #2d4a7a;
    --text-primary:  #f1f5f9;
    --text-secondary:#94a3b8;
    --text-muted:    #64748b;
    --blue-pale:     #172554;
    --shadow-card:   0 2px 12px rgba(0,0,0,0.4);
    --shadow-blue:   0 8px 30px rgba(0,0,0,0.4);
}

body.dark .navbar       { background: #0f172a; border-color: #1e3a5f; }
body.dark .lang-btn          { background: #1e293b; border-color: #2d4a7a; color: #f1f5f9; box-shadow: none; }
body.dark .lang-btn-flag { box-shadow: 0 1px 3px rgba(0,0,0,0.4); }
body.dark .lang-btn:hover    { border-color: #3b82f6; box-shadow: 0 2px 10px rgba(59,130,246,0.2); }
body.dark .lang-picker.open .lang-btn { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
body.dark .lang-dropdown     { background: #1e293b; border-color: #2d4a7a; box-shadow: 0 10px 40px rgba(0,0,0,0.4); }
body.dark .lang-dropdown::after  { border-bottom-color: #1e293b; }
body.dark .lang-dropdown::before { border-bottom-color: #2d4a7a; }
body.dark .lang-item         { color: #94a3b8; }
body.dark .lang-item:hover   { background: #172554; color: #60a5fa; }
body.dark .lang-item--active { background: #172554; color: #60a5fa; }
body.dark .lang-item--active::after { color: #60a5fa; }
body.dark .dark-switch-track { background: #1e293b; border-color: #2d4a7a; }
body.dark .mega-menu    { background: #1e293b; border-color: #2d4a7a; }
body.dark .mega-sub-card { border-color: #1e3a5f; }
body.dark .mega-sub-card:hover { border-color: var(--cat-color, #60a5fa); }
body.dark .mega-sub-header { border-color: #1e3a5f; }
body.dark .mega-item:hover { background: #172554; }
body.dark .mega-item strong { color: #f1f5f9; }
body.dark .cat-card     { background: #1e293b; border-color: #1e3a5f; }
body.dark .tool-card    { background: #1e293b; border-color: #1e3a5f; }
body.dark .digital-card { background: #1e293b; border-color: #1e3a5f; }
body.dark .challenges-section { background: #0f172a; border-color: #1e3a5f; }
body.dark .categories-section { background: #0f172a; border-color: #1e3a5f; }
body.dark .nav-links > li > a { color: #94a3b8; }
body.dark .nav-links > li > a:hover { background: #172554; color: #60a5fa; }

/* Logo */
body.dark .logo              { border-color: #1e3a5f; }
body.dark .logo-main         { color: #f1f5f9; }
body.dark .logo-accent       { color: #60a5fa; }
body.dark .logo-sub          { color: #475569; }
body.dark .logo-icon         { color: #60a5fa; }
body.dark .menu-toggle span  { background: #94a3b8; }

/* Mega menu */
body.dark .mega-heading      { border-color: #1e3a5f; }
body.dark .mega-heading h3   { color: #f1f5f9; }
body.dark .mega-view-all     { color: #60a5fa; }
body.dark .mega-icon         { background: #172554; color: #60a5fa; }
body.dark .mega-item:hover .mega-icon { background: #2563eb; color: #fff; }
body.dark .mega-item small   { color: #64748b; }
body.dark .mega-col-title    { color: #60a5fa; border-color: #1e3a5f; }

/* Section titles */
body.dark .section-title     { color: #f1f5f9; }
body.dark .section-desc      { color: #64748b; }

/* Category cards */
body.dark .cat-name          { color: #f1f5f9; }
body.dark .cat-count         { color: #475569; }

/* Tool cards */
body.dark .tool-name         { color: #f1f5f9; }
body.dark .tool-desc         { color: #64748b; }
body.dark .tool-tag          { background: #172554; color: #60a5fa; border-color: #1e3a5f; }
body.dark .tool-card:hover   { border-color: #3b82f6; }

/* Digital cards */
body.dark .digital-name      { color: #f1f5f9; }
body.dark .digital-desc      { color: #64748b; }
body.dark .digital-card:hover { border-color: #3b82f6; }

/* Search */
body.dark .search-wrapper    { background: #1e293b; box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
body.dark .search-input      { color: #f1f5f9; }
body.dark .search-input::placeholder { color: #475569; }

/* Hero cats */
body.dark .hero-cats         { border-color: rgba(255,255,255,0.08); }

/* Tools section background */
body.dark .tools-section     { background: #0f172a; }
body.dark .digital-section   { background: #0f172a; }

/* Footer brand logo */
body.dark .footer-brand .logo-main { color: #f1f5f9; }

/* Hero */
body.dark .hero {
    background: linear-gradient(145deg, #020817 0%, #0c1a3a 40%, #0f2454 70%, #0f172a 100%);
}
body.dark .hero-glow {
    background:
        radial-gradient(ellipse 90% 70% at 50% -20%, rgba(30,58,138,0.3) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 0% 100%,  rgba(15,23,42,0.8) 0%, transparent 55%),
        radial-gradient(ellipse 40% 40% at 100% 0%,  rgba(37,99,235,0.08) 0%, transparent 50%);
}
body.dark .hero-badge {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}
body.dark .hero-cats {
    background: linear-gradient(135deg, rgba(15,23,42,0.6) 0%, rgba(12,26,58,0.6) 50%, rgba(6,20,40,0.6) 100%);
    border-color: rgba(255,255,255,0.07);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--navy);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* ============================
   HERO
============================ */
.hero {
    position: relative;
    padding: 100px 20px 90px;
    text-align: center;
    /* overflow: hidden; */
    background: linear-gradient(145deg, #0c1f5c 0%, #1a3aad 40%, #1d4ed8 70%, #2563eb 100%);
}

.hero-glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 90% 70% at 50% -20%, rgba(147,197,253,0.15) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 0% 100%, rgba(30,58,138,0.5) 0%, transparent 55%),
        radial-gradient(ellipse 40% 40% at 100% 0%, rgba(96,165,250,0.12) 0%, transparent 50%);
    pointer-events: none;
}

/* ============================
   HERO BACKGROUND DECORATIONS
============================ */

/* Orbs - دوائر ضوئية ضبابية */
.hero-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(60px);
}

.hero-orb--1 {
    width: 600px; height: 600px;
    top: -250px; left: -150px;
    background: radial-gradient(circle, rgba(96,165,250,0.25) 0%, transparent 70%);
    animation: floatSlow 10s ease-in-out infinite;
}

.hero-orb--2 {
    width: 400px; height: 400px;
    bottom: -150px; right: -80px;
    background: radial-gradient(circle, rgba(147,197,253,0.2) 0%, transparent 70%);
    animation: floatSlow 13s ease-in-out infinite reverse;
}

.hero-orb--3 {
    width: 280px; height: 280px;
    top: 30%; right: 10%;
    background: radial-gradient(circle, rgba(30,58,138,0.6) 0%, transparent 70%);
    animation: floatMid 8s ease-in-out infinite;
}

/* Rings - حلقات دائرية */
.hero-ring {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.1);
}

.hero-ring--1 {
    width: 320px; height: 320px;
    top: -80px; left: 5%;
    animation: spinSlow 25s linear infinite;
    border-color: rgba(147,197,253,0.15);
    border-width: 1px;
}

.hero-ring--1::after {
    content: '';
    position: absolute;
    width: 10px; height: 10px;
    background: rgba(147,197,253,0.6);
    border-radius: 50%;
    top: 10px; left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 8px rgba(147,197,253,0.8);
}

.hero-ring--2 {
    width: 200px; height: 200px;
    bottom: 20px; left: 12%;
    border-color: rgba(255,255,255,0.08);
    animation: spinSlow 18s linear infinite reverse;
}

.hero-ring--2::after {
    content: '';
    position: absolute;
    width: 7px; height: 7px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 6px rgba(255,255,255,0.4);
}

.hero-ring--3 {
    width: 500px; height: 500px;
    top: 50%; right: -100px;
    transform: translateY(-50%);
    border-color: rgba(96,165,250,0.08);
    border-width: 2px;
    animation: spinSlow 35s linear infinite;
}

/* Geometric shapes - أشكال هندسية */
.hero-geo {
    position: absolute;
    pointer-events: none;
    opacity: 0.12;
}

/* مستطيل مائل - أعلى اليمين */
.hero-geo--1 {
    width: 80px; height: 80px;
    top: 15%; right: 8%;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 12px;
    transform: rotate(20deg);
    animation: floatGeo 7s ease-in-out infinite;
}

/* مربع صغير - أسفل اليسار */
.hero-geo--2 {
    width: 50px; height: 50px;
    bottom: 25%; left: 8%;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    transform: rotate(-15deg);
    animation: floatGeo 9s ease-in-out infinite reverse;
    opacity: 0.1;
}

/* خط مائل - أعلى اليسار */
.hero-geo--3 {
    width: 120px; height: 2px;
    top: 20%; left: 15%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transform: rotate(-35deg);
    animation: floatMid 6s ease-in-out infinite;
    opacity: 0.3;
}

/* خط مائل - أسفل اليمين */
.hero-geo--4 {
    width: 90px; height: 2px;
    bottom: 30%; right: 12%;
    background: linear-gradient(90deg, transparent, rgba(147,197,253,0.5), transparent);
    transform: rotate(25deg);
    animation: floatMid 8s ease-in-out infinite reverse;
    opacity: 0.3;
}

/* Particles - جسيمات صغيرة */
.hero-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: rgba(255,255,255,0.6);
    box-shadow: 0 0 6px rgba(255,255,255,0.4);
}

.hero-particle--1 { width: 4px; height: 4px; top: 20%; left: 20%; animation: particle 6s ease-in-out infinite; }
.hero-particle--2 { width: 3px; height: 3px; top: 60%; left: 30%; animation: particle 8s ease-in-out infinite 1s; }
.hero-particle--3 { width: 5px; height: 5px; top: 35%; right: 20%; animation: particle 7s ease-in-out infinite 0.5s; }
.hero-particle--4 { width: 3px; height: 3px; bottom: 30%; right: 30%; animation: particle 9s ease-in-out infinite 2s; }
.hero-particle--5 { width: 4px; height: 4px; top: 75%; left: 55%; animation: particle 5s ease-in-out infinite 1.5s; }
.hero-particle--6 { width: 3px; height: 3px; top: 15%; right: 40%; animation: particle 10s ease-in-out infinite 0.8s; }

/* Dot grid */
.hero-dots {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255,255,255,0.12) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, black 20%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, black 20%, transparent 100%);
}

/* Animations */
@keyframes floatSlow {
    0%, 100% { transform: translateY(0) scale(1); }
    50%       { transform: translateY(-30px) scale(1.05); }
}

@keyframes floatMid {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%       { transform: translateY(-15px) rotate(8deg); }
}

@keyframes floatGeo {
    0%, 100% { transform: rotate(20deg) translateY(0); }
    50%       { transform: rotate(28deg) translateY(-12px); }
}

@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes particle {
    0%, 100% { transform: translateY(0) translateX(0); opacity: 0.6; }
    33%       { transform: translateY(-20px) translateX(10px); opacity: 1; }
    66%       { transform: translateY(-10px) translateX(-8px); opacity: 0.4; }
}

.hero-content {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 0.84rem;
    margin-bottom: 26px;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.1rem);
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 18px;
    color: #ffffff;
}

.hero-accent {
    color: #93c5fd;
    display: block;
}

.hero-desc {
    color: rgba(255,255,255,0.82);
    font-size: 1.05rem;
    margin-bottom: 36px;
    line-height: 1.7;
}

.search-box {
    max-width: 580px;
    margin: 0 auto 36px;
    position: relative;
}

.search-wrapper {
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 50px;
    padding: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    transition: box-shadow var(--transition);
}

.search-wrapper:focus-within {
    box-shadow: 0 8px 32px rgba(0,0,0,0.28), 0 0 0 3px rgba(255,255,255,0.3);
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.97rem;
    padding: 10px 16px;
    direction: inherit;
    min-width: 0;
}

.search-input::placeholder { color: #94a3b8; }

.search-btn {
    background: var(--blue);
    color: #ffffff;
    border: none;
    border-radius: 40px;
    padding: 11px 28px;
    font-size: 0.93rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.search-btn:hover {
    background: var(--blue-dark);
    transform: scale(1.02);
}

.search-btn:active { transform: scale(0.98); }

/* Search suggestions dropdown */
.search-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0,0,0,.18);
    z-index: 9999;
    overflow: hidden;
    max-height: 420px;
    overflow-y: auto;
}
.search-suggestions.active { display: block; }

.search-sugg-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background .15s;
    border-bottom: 1px solid var(--border);
}
.search-sugg-item:last-child { border-bottom: none; }
.search-sugg-item:hover { background: var(--bg-primary); }

.search-sugg-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem;
    flex-shrink: 0;
}
.search-sugg-info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 2px;
}
.search-sugg-name {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-sugg-name mark {
    background: none;
    color: var(--blue);
    font-weight: 700;
}
.search-sugg-desc {
    font-size: .72rem;
    color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-sugg-type {
    font-size: .68rem;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 50px;
    flex-shrink: 0;
    white-space: nowrap;
}
.search-sugg-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: .85rem;
}
body.dark .search-suggestions { background: #1e293b; border-color: #1e3a5f; }
body.dark .search-sugg-item:hover { background: #0f172a; }

/* Search tags */
.search-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    justify-content: center;
    opacity: 0.55;
    transition: opacity var(--transition);
}

.search-tags:hover { opacity: 0.8; }

.search-tag-label {
    color: rgba(255,255,255,0.7);
    font-size: 0.74rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-tag-label i { font-size: 0.65rem; color: #fbbf24; }

.search-tag {
    color: rgba(255,255,255,0.7);
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.74rem;
    transition: color var(--transition);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.2);
    text-underline-offset: 3px;
}

.search-tag:hover { color: #ffffff; text-decoration-color: rgba(255,255,255,0.5); }

.hero-cats {
    max-width: 700px;
    margin: 0 auto;
    background: linear-gradient(135deg, rgba(109,40,217,0.35) 0%, rgba(30,58,138,0.4) 50%, rgba(6,78,89,0.35) 100%);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 20px 24px;
    backdrop-filter: blur(10px);
}

.hero-cats-label {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 14px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

.hero-cats-label::before,
.hero-cats-label::after {
    content: '';
    flex: 1;
    max-width: 60px;
    height: 1px;
    background: rgba(255,255,255,0.2);
}

.hero-cats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    justify-content: center;
}

.hero-cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.85);
    padding: 7px 16px;
    border-radius: 50px;
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    backdrop-filter: blur(4px);
}

.hero-cat-chip i {
    font-size: 0.85rem;
    opacity: 0.85;
    color: var(--chip-color, rgba(255,255,255,0.85));
}

.hero-cat-chip:hover {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.4);
    color: #ffffff;
    transform: translateY(-2px);
}

.hero-cat-chip--highlight {
    background: rgba(251,191,36,0.18);
    border-color: rgba(251,191,36,0.45);
    color: #fde68a;
}

.hero-cat-chip--highlight i { opacity: 1; }

.hero-cat-chip--highlight:hover {
    background: rgba(251,191,36,0.3);
    border-color: rgba(251,191,36,0.65);
    color: #fef3c7;
}

/* ألوان أيقونات الفئات */
.hero-cats-grid .hero-cat-chip:nth-child(1) i { color: #fbbf24; } /* العملات - ذهبي */
.hero-cats-grid .hero-cat-chip:nth-child(2) i { color: #c084fc; } /* ذكاء اصطناعي - بنفسجي */
.hero-cats-grid .hero-cat-chip:nth-child(3) i { color: #34d399; } /* إسلامية - أخضر */
.hero-cats-grid .hero-cat-chip:nth-child(4) i { color: #f472b6; } /* نسائية - وردي */
.hero-cats-grid .hero-cat-chip:nth-child(5) i { color: #f87171; } /* صحة - أحمر */
.hero-cats-grid .hero-cat-chip:nth-child(6) i { color: #22d3ee; } /* رقمية - سماوي */
.hero-cats-grid .hero-cat-chip:nth-child(7) i { color: #818cf8; } /* مبرمجين - نيلي */

/* ============================
   SECTIONS
============================ */
.section { padding: 72px 0; }

.section-header { text-align: center; margin-bottom: 44px; }

.section-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 8px; color: var(--navy); }

.section-desc { color: var(--text-secondary); font-size: 0.95rem; }

/* ============================
   CATEGORIES
============================ */
.categories-section {
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
}

.cat-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 16px 18px;
    text-align: center;
    display: block;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow-card);
}

/* الخط الملون في الأعلى */
.cat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--cat-color, var(--blue));
    transition: height var(--transition);
}

.cat-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    border-color: var(--cat-color, var(--blue));
}

.cat-card:hover::before { height: 100%; opacity: 0.08; }

.cat-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--cat-bg, var(--blue-pale));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-size: 1.35rem;
    color: var(--cat-color, var(--blue));
    transition: all var(--transition);
}

.cat-card:hover .cat-icon {
    background: var(--cat-color, var(--blue));
    color: #ffffff;
}

.cat-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    transition: color var(--transition);
}

.cat-count {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.cat-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--cat-bg, var(--blue-pale));
    border-radius: 50%;
    font-size: 0.7rem;
    color: var(--cat-color, var(--blue));
    transition: all var(--transition);
    opacity: 0;
    transform: translateY(4px);
}

.cat-card:hover .cat-arrow {
    opacity: 1;
    transform: translateY(0);
    background: var(--cat-color, var(--blue));
    color: #ffffff;
}

/* ألوان الفئات */
.cat--gold    { --cat-color: #d97706; --cat-bg: #fef3c7; }
.cat--green   { --cat-color: #059669; --cat-bg: #d1fae5; }
.cat--pink    { --cat-color: #db2777; --cat-bg: #fce7f3; }
.cat--red     { --cat-color: #dc2626; --cat-bg: #fee2e2; }
.cat--blue    { --cat-color: #2563eb; --cat-bg: #dbeafe; }
.cat--purple  { --cat-color: #7c3aed; --cat-bg: #ede9fe; }
.cat--indigo  { --cat-color: #4f46e5; --cat-bg: #e0e7ff; }
.cat--teal    { --cat-color: #0d9488; --cat-bg: #ccfbf1; }
.cat--emerald { --cat-color: #16a34a; --cat-bg: #dcfce7; }
.cat--orange  { --cat-color: #ea580c; --cat-bg: #ffedd5; }
.cat--yellow  { --cat-color: #ca8a04; --cat-bg: #fef9c3; }
.cat--slate   { --cat-color: #475569; --cat-bg: #f1f5f9; }
.cat--cyan    { --cat-color: #0891b2; --cat-bg: #cffafe; }
.cat--rose    { --cat-color: #e11d48; --cat-bg: #ffe4e6; }

/* ============================
   TOOLS GRID
============================ */
.tools-section { background: var(--bg-primary); }

.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: all var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow-card);
}

.tool-card:hover {
    border-color: var(--blue-light);
    transform: translateY(-3px);
    box-shadow: var(--shadow-blue);
}

.tool-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.tool-currency  { background: #fef3c7; }
.tool-gold      { background: #fef9c3; }
.tool-pregnancy { background: #fce7f3; }
.tool-zakat     { background: #d1fae5; }
.tool-pdf       { background: #fee2e2; }
.tool-image     { background: #dbeafe; }

.tool-info { flex: 1; min-width: 0; }

.tool-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
    line-height: 1.4;
}

.tool-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 10px;
}

.tool-tag {
    display: inline-block;
    background: var(--blue-pale);
    color: var(--blue);
    border: 1px solid var(--border-dark);
    padding: 2px 11px;
    border-radius: 50px;
    font-size: 0.74rem;
    font-weight: 500;
}



.mega-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 16px;
}

.mega-col { display: flex; flex-direction: column; gap: 2px; }

.mega-col-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 12px 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}


/* ============================
   TOOLS - NEW ICONS
============================ */
.tool-ai  { background: #ede9fe; }
.tool-bmi { background: #dcfce7; }

/* ============================
   DIGITAL TOOLS SECTION
============================ */
.digital-section {
    background: var(--bg-primary);
}

.digital-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.digital-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all var(--transition);
    box-shadow: var(--shadow-card);
    cursor: pointer;
}

.digital-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-blue);
    border-color: var(--blue-light);
}

.digital-preview {
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    transition: transform var(--transition);
}

.digital-card:hover .digital-preview i { transform: scale(1.15); }

.digital-preview--qr       { background: linear-gradient(135deg, #e0f2fe, #bae6fd); color: #0369a1; }
.digital-preview--barcode  { background: linear-gradient(135deg, #f0fdf4, #bbf7d0); color: #15803d; }
.digital-preview--password { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #b45309; }
.digital-preview--color    { background: linear-gradient(135deg, #fae8ff, #e9d5ff); color: #7e22ce; }
.digital-preview--uuid     { background: linear-gradient(135deg, #ffe4e6, #fecdd3); color: #be123c; }
.digital-preview--username { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #4338ca; }

.digital-info {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.digital-name {
    font-size: 0.97rem;
    font-weight: 700;
    color: var(--text-primary);
}

.digital-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}

.digital-action {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--blue);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    transition: gap var(--transition);
}

.digital-card:hover .digital-action { gap: 10px; }

/* ============================
   CHALLENGES SECTION
============================ */
.challenges-section {
    background: #ffffff;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.challenges-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.challenge-card {
    position: relative;
    border-radius: var(--radius);
    padding: 28px 22px 22px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    transition: all var(--transition);
    overflow: hidden;
    text-decoration: none;
}

.challenge-wouldyou  { background: linear-gradient(135deg, #1e3a8a, #2563eb); }
.challenge-personality { background: linear-gradient(135deg, #6d28d9, #8b5cf6); }
.challenge-memory    { background: linear-gradient(135deg, #065f46, #059669); }
.challenge-winner    { background: linear-gradient(135deg, #92400e, #d97706); }
.challenge-iq        { background: linear-gradient(135deg, #881337, #e11d48); }
.challenge-numbers   { background: linear-gradient(135deg, #164e63, #0891b2); }

.challenge-card:hover { transform: translateY(-5px); box-shadow: 0 12px 32px rgba(0,0,0,0.2); }

.challenge-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.3);
}

.challenge-icon {
    width: 54px;
    height: 54px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #ffffff;
}

.challenge-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
}

.challenge-desc {
    font-size: 0.84rem;
    color: rgba(255,255,255,0.75);
    line-height: 1.5;
    flex: 1;
}

.challenge-btn {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.35);
    padding: 7px 18px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 4px;
    transition: background var(--transition);
}

.challenge-card:hover .challenge-btn { background: rgba(255,255,255,0.35); }

/* Nav challenges highlight */
.nav-challenges { color: #ea580c !important; }
.nav-challenges:hover { background: #fff7ed !important; }

/* ============================
   CATS BAR (before footer)
============================ */
.cats-bar {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}
.cats-bar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.cats-bar-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .78rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.cats-bar-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}
.cats-bar-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 600;
    background: var(--cb);
    color: var(--c);
    border: 1px solid color-mix(in srgb, var(--c) 20%, transparent);
    text-decoration: none;
    transition: background .15s, transform .15s, box-shadow .15s;
    white-space: nowrap;
}
.cats-bar-item:hover {
    background: var(--c);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px color-mix(in srgb, var(--c) 30%, transparent);
}
.cats-bar-item i { font-size: .72rem; }

@media (max-width: 768px) {
    .cats-bar { padding: 12px 0; }
    .cats-bar-label { display: none; }
    .cats-bar-list { gap: 6px; }
    .cats-bar-item { font-size: .72rem; padding: 4px 10px; }
}

/* ============================
   FOOTER
============================ */
.footer {
    background: var(--navy);
    position: relative;
}

.footer-wave {
    line-height: 0;
    margin-bottom: -1px;
}
.footer-wave svg { width: 100%; height: 40px; display: block; }

/* Grid */
.footer-grid {
    display: grid;
    grid-template-columns: 1.8fr 1fr 1fr 1fr;
    gap: 40px;
    padding: 48px 0 40px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

/* Brand */
.footer-logo { max-height: 42px; width: auto; margin-bottom: 14px; display: block; }

.footer-tagline {
    color: rgba(255,255,255,.5);
    font-size: 0.83rem;
    line-height: 1.7;
    max-width: 240px;
    margin-bottom: 20px;
}

.footer-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 12px;
    padding: 12px 16px;
    width: fit-content;
}
.footer-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.footer-stat-num { font-size: 1rem; font-weight: 800; color: #fff; line-height: 1; }
.footer-stat-lbl { font-size: 0.65rem; color: rgba(255,255,255,.45); white-space: nowrap; }
.footer-stat-div { width: 1px; height: 28px; background: rgba(255,255,255,.15); }

/* Columns */
.footer-col-title {
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 7px;
    opacity: .9;
}
.footer-col-title i { font-size: .75rem; opacity: .6; }

.footer-col-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.footer-col-list li a {
    color: rgba(255,255,255,.5);
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color .2s, padding-inline-start .2s;
    text-decoration: none;
}
.footer-col-list li a i { font-size: .72rem; opacity: .6; width: 12px; text-align: center; }
.footer-col-list li a:hover {
    color: var(--blue-light);
    padding-inline-start: 4px;
}
.footer-col-list li a:hover i { opacity: 1; }

/* Bottom bar */
.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    color: rgba(255,255,255,.3);
    font-size: 0.8rem;
    flex-wrap: wrap;
    gap: 8px;
}
.footer-bottom-logo { display: none; max-height: 30px; width: auto; opacity: .75; }
.footer-bottom-links { display: flex; gap: 20px; }
.footer-bottom-links a {
    color: rgba(255,255,255,.35);
    font-size: 0.8rem;
    transition: color .2s;
    text-decoration: none;
}
.footer-bottom-links a:hover { color: var(--blue-light); }

/* ============================
   RESPONSIVE
============================ */
@media (max-width: 1024px) {
    .categories-grid { grid-template-columns: repeat(4, 1fr); }
    .tools-grid { grid-template-columns: repeat(2, 1fr); }
    .digital-grid { grid-template-columns: repeat(2, 1fr); }
    .challenges-grid { grid-template-columns: repeat(2, 1fr); }
    .mega-menu { width: 460px; }
    .mega-menu--wide { width: 560px; }
    .mega-cols { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
}

/* ============================
   MOBILE OVERLAY
============================ */
.mob-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 998;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mob-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================
   MOBILE MENU HEADER (li)
============================ */
.mob-menu-header {
    width: 100%;
    padding: 0 !important;
    flex-shrink: 0;
}

.mob-menu-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.mob-menu-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    direction: ltr;
}

.mob-menu-close {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    transition: background 0.2s;
}

.mob-menu-close i {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin: 0;
}

.mob-menu-close:hover { background: var(--border); }

/* ============================
   MOBILE ONLY ELEMENTS (hidden on desktop)
============================ */
.mob-icon        { display: none; }
.mob-menu-header { display: none; }
.mob-overlay     { display: none; }

@media (max-width: 768px) {
    .nav-container { justify-content: space-between; height: 56px; padding: 0 12px; }

    /* hamburger يمين، شعار وسط، controls يسار */
    .menu-toggle  { order: 1; display: flex; flex-shrink: 0; }
    .logo         { order: 2; position: static; transform: none; margin: 0 auto; border: none; padding: 4px 6px; }
    .logo-img     { height: 30px; }
    .nav-controls { order: 3; flex-shrink: 0; gap: 4px; }

    .lang-btn span#langLabel { display: none; }
    .lang-btn { padding: 5px 8px; gap: 3px; min-width: auto; font-size: .78rem; }
    .lang-btn-flag { font-size: 1.1rem; }
    .lang-btn .nav-arrow { display: none; }
    .lang-dropdown { left: 0; right: auto; }

    .dark-switch-track { width: 40px; height: 22px; }
    .dark-switch-thumb { width: 16px; height: 16px; }
    .dark-switch input:checked + .dark-switch-track .dark-switch-thumb { transform: translateX(-18px); }
    .dark-icon-sun, .dark-icon-moon { font-size: .6rem; }

    /* إظهار عناصر الموبايل فقط */
    .mob-menu-header { display: block; }
    .mob-overlay.active { display: block; }
    .nav-mob-only { display: block; }
    /* إخفاء الأقسام الرئيسية في الموبايل */
    .nav-desk-only { display: none; }

    /* ---- ألوان الأقسام ---- */
    .mob-gold    { --mc: #d97706; --mb: #fef3c7; }
    .mob-green   { --mc: #059669; --mb: #d1fae5; }
    .mob-pink    { --mc: #db2777; --mb: #fce7f3; }
    .mob-red     { --mc: #dc2626; --mb: #fee2e2; }
    .mob-indigo  { --mc: #4f46e5; --mb: #e0e7ff; }
    .mob-emerald { --mc: #16a34a; --mb: #dcfce7; }
    .mob-cyan    { --mc: #0891b2; --mb: #cffafe; }
    .mob-rose    { --mc: #e11d48; --mb: #ffe4e6; }

    /* ---- Panel ---- */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 310px;
        height: 100vh;
        background: var(--bg-primary, #f0f5ff);
        border-left: 1px solid var(--border);
        flex-direction: column;
        align-items: flex-start;
        padding: 0;
        gap: 0;
        transition: right 0.32s cubic-bezier(0.4,0,0.2,1);
        z-index: 999;
        overflow-y: auto;
        overflow-x: hidden;
        box-shadow: -8px 0 32px rgba(0,0,0,0.15);
        scrollbar-width: thin;
        scrollbar-color: var(--border-dark) transparent;
    }

    .nav-links.active { right: 0; }
    .nav-links > li { width: 100%; }
    .nav-links > li.has-mega { position: relative; }

    /* ---- رئيسية (plain item) ---- */
    .nav-links > li:not(.has-mega):not(.mob-menu-header) > a {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 13px 16px;
        color: var(--text-secondary);
        font-size: 0.9rem;
        font-weight: 600;
        border-bottom: 1px solid var(--border);
        background: var(--bg-card);
        transition: background 0.2s;
    }

    .nav-links > li:not(.has-mega):not(.mob-menu-header) > a .mob-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 30px; height: 30px;
        border-radius: 8px;
        background: var(--blue-pale);
        color: var(--blue);
        font-size: 0.82rem;
        flex-shrink: 0;
    }

    /* ---- Category header ---- */
    .has-mega > a {
        display: flex !important;
        align-items: center;
        gap: 10px;
        padding: 13px 16px !important;
        width: 100%;
        font-size: 0.88rem;
        font-weight: 600;
        border-bottom: 1px solid var(--border);
        background: var(--bg-card);
        color: var(--text-primary) !important;
        transition: background 0.2s;
        justify-content: flex-start !important;
    }

    .has-mega > a:hover { background: var(--bg-primary); }

    /* أيقونة القسم على الهاتف */
    .nav-cat-icon { width:30px;height:30px;border-radius:8px;font-size:0.85rem; }
    .mob-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px; height: 28px;
        border-radius: 7px;
        background: var(--mb, var(--blue-pale));
        color: var(--mc, var(--blue));
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    /* السهم يُدفع لليسار */
    .has-mega > a .nav-arrow {
        margin-right: auto !important;
        opacity: 0.4;
        color: var(--text-muted);
        transition: transform 0.3s ease, opacity 0.2s;
    }

    .has-mega.open > a .nav-arrow {
        transform: rotate(180deg);
        opacity: 0.7;
    }

    /* ---- Mega menu accordion ---- */
    .mega-menu {
        position: static;
        width: 100%;
        border: none;
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border);
    }

    .mega-menu::before,
    .mega-menu::after { display: none; }

    .mega-menu.open { max-height: 700px; }

    /* ---- Mega inner ---- */
    .mega-inner { padding: 4px 0 6px; }

    .mega-heading { display: none; }

    /* ---- Mega items — قائمة بسيطة ---- */
    .mega-grid {
        display: flex;
        flex-direction: column;
    }

    .mega-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 20px;
        color: var(--text-secondary);
        font-size: 0.85rem;
        border-bottom: 1px solid var(--border);
        transition: background 0.15s, color 0.15s;
    }

    .mega-item:last-child { border-bottom: none; }

    .mega-item:hover {
        background: var(--bg-card);
        color: var(--mc, var(--blue));
    }

    .mega-icon {
        width: 26px; height: 26px;
        border-radius: 6px;
        background: var(--mb, var(--blue-pale));
        color: var(--mc, var(--blue));
        font-size: 0.75rem;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mega-item strong { font-size: 0.83rem; font-weight: 500; color: inherit; }
    .mega-item small  { display: none; }

    /* mega cols (تقنية) */
    .mega-menu--wide { width: 100%; }
    .mega-cols { display: flex; flex-direction: column; gap: 0; }
    .mega-col { display: flex; flex-direction: column; }
    .mega-col-title {
        font-size: 0.72rem;
        font-weight: 700;
        color: var(--text-muted);
        padding: 8px 20px 4px;
        text-transform: uppercase;
        letter-spacing: 0.4px;
    }

    .hero { padding: 64px 20px 52px; }

    .search-wrapper { padding: 5px; }

    .search-input {
        font-size: 0.9rem;
        padding: 9px 12px;
    }

    .search-btn {
        padding: 10px 18px;
        font-size: 0.85rem;
    }

    .search-tag-label { width: 100%; justify-content: center; }

    .categories-grid { grid-template-columns: repeat(2, 1fr); }
    .tools-grid { grid-template-columns: 1fr; }
    .digital-grid { grid-template-columns: 1fr; }
    .challenges-grid { grid-template-columns: 1fr; }
    .mega-menu--wide { width: 100%; }
    .mega-cols { grid-template-columns: 1fr; }

    /* Footer — mobile: مدمج وصغير */
    .footer-wave  { display: none; }
    .footer-grid  { display: none; }
    .footer-bottom {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
        padding: 18px 0 14px;
        font-size: .76rem;
        border-top: none;
    }
    .footer-bottom-logo  { display: block; }
    .footer-bottom-links { gap: 16px; }
    .hero-cats-grid { gap: 7px; }
    .hero-cat-chip { padding: 6px 13px; font-size: 0.8rem; }
}

@media (max-width: 420px) {
    .categories-grid { grid-template-columns: repeat(2, 1fr); }
    .cat-card { padding: 20px 8px 16px; }
}

/* ============================
   LTR OVERRIDES (non-Arabic)
============================ */

/* Language dropdown — يفتح من اليمين في LTR */
html[dir="ltr"] .lang-dropdown {
    left: auto;
    right: 0;
    transform-origin: top right;
}
html[dir="ltr"] .lang-dropdown::before {
    left: auto;
    right: 20px;
}
html[dir="ltr"] .lang-dropdown::after {
    left: auto;
    right: 21px;
}

/* Checkmark في عنصر اللغة النشط */
html[dir="ltr"] .lang-item--active::after {
    margin-right: unset;
    margin-left: auto;
}

/* سهم القسم في القائمة — يُدفع لليمين */
html[dir="ltr"] .has-mega > a .nav-arrow {
    margin-right: unset !important;
    margin-left: auto !important;
}

/* الشريط الجانبي للموبايل — يظهر من اليسار */
@media (max-width: 768px) {
    html[dir="ltr"] .nav-links {
        right: auto;
        left: -100%;
        border-left: none;
        border-right: 1px solid var(--border);
        box-shadow: 8px 0 32px rgba(0,0,0,0.15);
        transition: left 0.32s cubic-bezier(0.4,0,0.2,1);
    }
    html[dir="ltr"] .nav-links.active {
        left: 0;
    }
}
