/* ============================
   TOOLS PAGE HERO
============================ */
.tools-hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--blue-dark) 100%);
    padding: 48px 20px;
    text-align: center;
}

.tools-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.22);
    color: rgba(255,255,255,0.9);
    padding: 5px 16px;
    border-radius: 50px;
    font-size: 0.82rem;
    margin-bottom: 14px;
}

.tools-hero-title {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 8px;
}

.tools-hero-desc {
    color: rgba(255,255,255,0.7);
    font-size: 0.97rem;
}

/* ============================
   TOOLS PAGE LAYOUT
============================ */
.tools-page {
    padding: 36px 0 64px;
    background: var(--bg-primary);
}

.tools-grid {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.tools-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* ============================
   CATEGORY SECTIONS
============================ */

.cat-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.cat-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 14px;
    border-bottom: none;
    background: linear-gradient(135deg, var(--cat-color, var(--blue)) 0%, color-mix(in srgb, var(--cat-color, var(--blue)) 70%, #000) 100%);
    position: relative;
    overflow: hidden;
}

.cat-section-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.06);
    pointer-events: none;
}

.cat-section-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(255,255,255,0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.25);
}

.cat-section-meta { flex: 1; min-width: 0; }

.cat-section-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-section-count {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.75);
    opacity: 1;
}

.cat-section-link { display: none; }

/* ============================
   TOOL CARDS GRID
============================ */
.cat-tools-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
    background: var(--border);
}

.cat-tool-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-card);
    text-decoration: none;
    transition: all var(--transition);
    position: relative;
    border-inline-end: 3px solid transparent;
}

.cat-tool-card:hover {
    background: var(--cat-bg, var(--blue-pale));
    border-inline-end-color: var(--cat-color, var(--blue));
}

.cat-tool-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    flex-shrink: 0;
    transition: transform var(--transition), box-shadow var(--transition);
}

.cat-tool-card:hover .cat-tool-icon {
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
    transform: scale(1.06);
}

.cat-tool-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.cat-tool-info strong {
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--transition);
}

.cat-tool-card:hover .cat-tool-info strong {
    color: var(--cat-color, var(--blue));
}

.cat-tool-info span {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-tool-arrow {
    font-size: 0.55rem;
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0.35;
    transition: opacity var(--transition), color var(--transition);
}

.cat-tool-card:hover .cat-tool-arrow {
    opacity: 1;
    color: var(--cat-color, var(--blue));
}

html[dir="ltr"] .cat-tool-arrow {
    transform: scaleX(-1);
}

/* ============================
   DARK MODE
============================ */
body.dark .tools-page           { background: #0f172a; }
body.dark .tools-hero           { background: linear-gradient(135deg, #020817 0%, #0f172a 100%); }
body.dark .cat-section          { background: #1e293b; border-color: #1e3a5f; }
body.dark .cat-section-header   { border-color: transparent; }
body.dark .cat-section-title    { color: #ffffff; }
body.dark .cat-tools-grid       { background: #0f172a; }
body.dark .cat-tool-card        { background: #1e293b; border-inline-end-color: transparent; }
body.dark .cat-tool-card:hover  { background: #172554; border-inline-end-color: var(--cat-color, #3b82f6); }
body.dark .cat-tool-info strong { color: #f1f5f9; }
body.dark .cat-tool-info span   { color: #475569; }

/* ============================
   RESPONSIVE
============================ */
@media (max-width: 860px) {
    .tools-grid { flex-wrap: wrap; }
    .tools-col { flex: 0 0 calc(50% - 8px); }
}

/* ============================
   MOBILE ACCORDION
============================ */
@media (max-width: 600px) {
    .tools-col { flex: 0 0 100%; }

    /* تحويل الهيدر إلى زر accordion */
    .cat-section-header {
        cursor: pointer;
        user-select: none;
    }

    /* سهم الـ accordion */
    .accordion-arrow {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background: rgba(255,255,255,0.2);
        color: #ffffff;
        font-size: 0.75rem;
        margin-inline-start: auto;
        transition: transform 0.3s ease, background 0.2s;
        flex-shrink: 0;
        border: 1px solid rgba(255,255,255,0.3);
    }

    .cat-section.open .accordion-arrow {
        transform: rotate(180deg);
        background: rgba(255,255,255,0.35);
    }

    /* إخفاء الأدوات افتراضياً */
    .cat-tools-grid {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease;
    }

    /* إظهارها عند الفتح */
    .cat-section.open .cat-tools-grid {
        max-height: 2000px;
    }
}

/* إخفاء السهم على الشاشات الكبيرة */
@media (min-width: 601px) {
    .accordion-arrow { display: none; }
}
