


    /* ═══════════════════════════════════════════════════════════════
    CATEGORY MODAL — custom layout
    ═══════════════════════════════════════════════════════════════ */

    #showPostModal .modal-content {
        background: #f5f5f5;
    }

    #showPostModal .modal-body {
        position: relative;
    }

    /* ─── Close button ─── */
    .cat-modal-close {
        position: absolute;
        top: 18px;
        left: 22px;
        width: 42px;
        height: 42px;
        border-radius: 50%;
        border: 1.5px solid #cdcccc;
        background: #fff;
        color: #333;
        font-size: 22px;
        font-weight: 300;
        line-height: 1;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.15s ease, color 0.15s ease;
        z-index: 5;
        padding: 0;
    }

    .cat-modal-close:hover {
        background: #333;
        color: #fff;
    }

    /* ═══════════════════════════════════════════════════════════════
    3-column layout — FIXED sidebar width, fluid content,
    fluid preview. No Bootstrap grid involved.
    ═══════════════════════════════════════════════════════════════ */

    .cat-modal-layout {
        display: grid;
        /*  ┌── sidebar ──┬──────── content ────────┬── preview ──┐ */
        /* grid-template-columns: 220px minmax(0, 1fr) 260px; */
        gap: 20px;
        direction: rtl;
        min-height: 620px;
    }

    .cat-modal-layout-full{
        grid-template-columns: 220px minmax(0, 1fr) 260px;
    }
    .cat-modal-layout-half{
        grid-template-columns: 220px minmax(0, 1fr);
    }


    /* ═══════════════════════════════════════════════════════════════
    RIGHT COLUMN — Sidebar (narrow, fixed width)
    ═══════════════════════════════════════════════════════════════ */

    .cat-modal-sidebar {
        display: flex;
        flex-direction: column;
        padding-top: 4px;
        min-width: 0;      /* prevent flex/grid overflow */
        max-width: 220px;  /* explicit cap in case grid stretches */
    }

    .cat-all-pill {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        background: #d9d9d9;
        color: #333;
        padding: 10px 16px;
        border-radius: 24px;
        font-size: 14px;
        font-weight: 700;
        text-decoration: none;
        margin-bottom: 14px;
        transition: background 0.15s ease;
        font-family: "Yekan", sans-serif;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .cat-all-pill:hover {
        background: #c9c9c9;
        color: #111;
        text-decoration: none;
    }

    .cat-all-pill i {
        font-size: 13px;
        flex-shrink: 0;
    }

    .cat-all-pill-bottom {
        margin-top: 20px;
        margin-bottom: 0;
        font-size: 13px;
    }

    .cat-tab-list {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .cat-tab {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 9px 12px;
        border-radius: 12px;
        text-decoration: none;
        font-size: 15px;
        font-weight: 500;
        font-family: "Yekan", sans-serif;
        transition: background 0.15s ease, color 0.15s ease;
        cursor: pointer;
        min-width: 0;    /* allow the label to ellipsis */
    }

    .cat-tab:hover {
        background: rgba(0, 74, 173, 0.04);
        color: #004AAD !important;
        text-decoration: none;
    }

    .cat-tab.active {
        background: rgba(0, 74, 173, 0.10);
        color: #004AAD !important;
        font-weight: 800;
    }

    .cat-tab .cat-icon {
        width: 16px;
        text-align: center;
        font-size: 13px;
        flex-shrink: 0;
    }

    .cat-tab .cat-label {
        flex: 1 1 auto;
        text-align: right;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .cat-tab .cat-chevron {
        font-size: 9px;
        opacity: 0.55;
        flex-shrink: 0;
    }

    /* ═══════════════════════════════════════════════════════════════
    MIDDLE COLUMN — Scrollable content
    ═══════════════════════════════════════════════════════════════ */

    .cat-modal-content {
        max-height: 640px;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 4px 8px 20px 6px;
        scroll-behavior: smooth;
        scrollbar-width: thin;
        scrollbar-color: #bbb transparent;
        min-width: 0;   /* critical: allows the grid track to shrink */

        -webkit-mask-image: linear-gradient(
            to bottom,
            #000 0,
            #000 calc(100% - 40px),
            transparent 100%
        );
        mask-image: linear-gradient(
            to bottom,
            #000 0,
            #000 calc(100% - 40px),
            transparent 100%
        );
    }

    .cat-modal-content::-webkit-scrollbar {
        width: 6px;
    }

    .cat-modal-content::-webkit-scrollbar-track {
        background: transparent;
    }

    .cat-modal-content::-webkit-scrollbar-thumb {
        background: #c8c8c8;
        border-radius: 3px;
    }

    .cat-modal-content::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }

    .cat-section {
        margin-bottom: 32px;
        scroll-margin-top: 10px;
    }

    .cat-section:last-child {
        margin-bottom: 0;
    }

    .cat-section-header {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        padding: 0 6px;
        margin-bottom: 16px;
    }

    .cat-section-title {
        font-size: 15px;
        font-weight: 800;
        color: #222;
        font-family: "Yekan", sans-serif;
    }

    .cat-section-title.active{
        color: #004AAD !important;
    }

    .cat-section-title small {
        font-size: 12px;
        font-weight: 500;
        color: #777;
        margin-right: 4px;
    }

    .cat-section-link {
        font-size: 12px;
        color: #666;
        text-decoration: none;
        font-family: "Yekan", sans-serif;
        white-space: nowrap;
    }

    .cat-section-link:hover {
        color: #222;
        text-decoration: underline;
    }

    /* ─── Cards grid ─── */
    .cat-card-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 14px 10px;
        padding: 0 6px;
    }

    .cat-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        text-decoration: none;
        color: #333;
        transition: transform 0.15s ease;
        min-width: 0;
    }

    .cat-card:hover {
        text-decoration: none;
        color: #111;
        transform: translateY(-2px);
    }

    /* ===== Empty state message for sections with no items ===== */
    .cat-empty-msg {
        grid-column: 1 / -1;               /* span full grid width */
        text-align: center;
        padding: 20px 12px;
        margin: 4px 0;
        font-size: 13px;
        color: #9ca3af;                    /* gray-400 */
        /* background: #fafafa; */
        border: 1px dashed #e5e7eb;        /* gray-200 */
        border-radius: 12px;
        font-weight: 500;
    }

    .cat-circle {
        width: 88px;
        height: 88px;
        border-radius: 50%;
        background: #e8e8e8;         /* lighter placeholder while loading */
        transition: background 0.2s ease, transform 0.2s ease;
        overflow: hidden;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }

    .cat-circle img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.35s ease;
    }

    .cat-card:hover .cat-circle img {
        transform: scale(1.06);
    }

    .cat-card-name {
        font-size: 13px;
        font-weight: 600;
        color: #333;
        text-align: center;
        font-family: "Yekan", sans-serif;
        line-height: 1.35;
        max-width: 100%;
        word-break: break-word;
    }

    /* ═══════════════════════════════════════════════════════════════
    LEFT COLUMN — Preview
    ═══════════════════════════════════════════════════════════════ */

    /* ═══════════════════════════════════════════════════════════════
    LEFT COLUMN — Advertisement previews
    ═══════════════════════════════════════════════════════════════ */

    .cat-modal-preview {
        display: flex;
        flex-direction: column;
        gap: 16px;
        padding-top: 4px;
        min-width: 0;
    }

    .cat-preview-box {
        display: block;
        width: 100%;
        height: 280px;
        border-radius: 20px;
        overflow: hidden;
        background: #e8e8e8;                 /* placeholder while loading */
        position: relative;
        text-decoration: none;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        box-shadow: 0 2px 8px -4px rgba(0, 0, 0, 0.15);
    }

    .cat-preview-box img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.4s ease;
    }

    /* Hover: lift the ad and zoom the image slightly */
    .cat-preview-box:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.25);
    }

    .cat-preview-box:hover img {
        transform: scale(1.04);
    }

    /* ─── Optional: "Ad" badge ─── */
    .cat-preview-box::after {
        content: "تبلیغ";
        position: absolute;
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.6);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        padding: 3px 8px;
        border-radius: 10px;
        font-family: "Yekan", sans-serif;
        letter-spacing: 0.3px;
        pointer-events: none;
    }

    /* ═══════════════════════════════════════════════════════════════
    RESPONSIVE
    ═══════════════════════════════════════════════════════════════ */

    /* Tablet landscape — shrink preview first */
    @media (max-width: 1200px) {
        .cat-modal-layout {
            gap: 16px;
        }
        .cat-modal-layout-full{
            grid-template-columns: 200px minmax(0, 1fr) 200px;
        }
        .cat-modal-layout-half{
            grid-template-columns: 200px minmax(0, 1fr);
        }
        .cat-circle {
            width: 76px;
            height: 76px;
        }
        .cat-preview-box {
            height: 220px;
        }
    }

    /* Tablet portrait — hide preview, keep sidebar + content */
    @media (max-width: 992px) {
        .cat-modal-layout {
            gap: 16px;
        }
        .cat-modal-layout-full{
            grid-template-columns: 200px minmax(0, 1fr);
        }
        .cat-modal-layout-half{
            grid-template-columns: 200px minmax(0, 1fr);
        }
        .cat-modal-preview {
            display: none;
        }
    }

    /* Mobile — single column, sidebar below content */
    @media (max-width: 768px) {
        .cat-modal-layout {
            gap: 16px;
        }
        .cat-modal-layout-full{
            grid-template-columns: minmax(0, 1fr);
        }
        .cat-modal-layout-half{
            grid-template-columns: minmax(0, 1fr);
        }
        .cat-modal-sidebar {
            order: 2;
            max-width: none;
            margin-top: 20px;
        }
        .cat-modal-content {
            order: 1;
            max-height: none;
            -webkit-mask-image: none;
            mask-image: none;
        }
        .cat-tab .cat-label {
            /* allow wrapping on mobile since sidebar is full-width */
            white-space: normal;
            overflow: visible;
            text-overflow: clip;
        }
    }

    /* Small phones */
    @media (max-width: 480px) {
        .cat-modal-sidebar {
            display: none;
        }
        .cat-card-grid {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }
        .cat-circle {
            width: 64px;
            height: 64px;
        }
        .cat-card-name {
            font-size: 12px;
        }
    }