/* =========================================
   Nahj al-Balagha
   ========================================= */

.nahj-page {
    direction: rtl;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}


.nahj-page *,
.nahj-page *::before,
.nahj-page *::after {
    box-sizing: border-box;
}


.nahj-container {
    width: min(1180px, calc(100% - 30px));
    margin: 35px auto 60px;
}


/* =========================================
   Header
   ========================================= */

.nahj-page-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;

    margin-bottom: 30px;
    padding: 25px 20px;

    background: #ffffff;
    border: 1px solid #e7e7e7;
    border-radius: 18px;

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.06);

    text-align: center;
}


.nahj-page-icon {
    width: 65px;
    height: 65px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 65px;

    border-radius: 50%;

    background: #f1f5f2;

    font-size: 30px;
    font-weight: 800;
}


.nahj-page-title {
    margin: 0 0 7px !important;

    font-size: 30px !important;
    font-weight: 800 !important;
}


.nahj-page-description {
    margin: 0 !important;

    font-size: 15px;
    line-height: 1.9;
}


/* =========================================
   Search
   ========================================= */

.nahj-search-box {
    padding: 25px;

    margin-bottom: 25px;

    background: #fff;

    border: 1px solid #e4e4e4;
    border-radius: 18px;

    box-shadow:
        0 7px 24px rgba(0, 0, 0, 0.05);
}


.nahj-search-label {
    display: block;

    margin-bottom: 12px;

    font-size: 17px;
    font-weight: 700;
}


.nahj-search-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}


.nahj-search-input {
    flex: 1;

    min-width: 0;

    height: 52px;

    padding: 0 17px;

    border: 1px solid #d4d4d4 !important;
    border-radius: 11px !important;

    background: #fff !important;

    font-family: inherit;
    font-size: 16px;

    outline: none !important;
}


.nahj-search-input:focus {
    border-color: #999 !important;

    box-shadow:
        0 0 0 3px rgba(0, 0, 0, 0.06) !important;
}




/* =========================================
   دکمه جستجو
   ========================================= */

.nahj-search-btn {
    min-width: 125px;

    border: 1px solid #000000 !important;
    border-radius: 11px !important;

    background: #000000 !important;
    color: #ffffff !important;

    cursor: pointer;

    font-family: inherit;
    font-size: 16px;
    font-weight: 800;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}


.nahj-search-btn span {
    color: #ffffff !important;
}


.nahj-search-btn:hover {
    background: #222222 !important;
    color: #ffffff !important;
}


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



.nahj-search-message {
    min-height: 25px;

    margin-top: 10px;

    font-size: 14px;
}


.nahj-search-message.error {
    font-weight: 600;
}


.nahj-search-message.success {
    font-weight: 600;
}


/* =========================================
   Categories
   ========================================= */

.nahj-categories {
    display: flex;
    flex-direction: column;

    gap: 6px;

    margin-bottom: 40px;
}


.nahj-category {
    width: 100%;
}


/* =========================================
   منوهای سه‌گانه
   ========================================= */

.nahj-category-btn {
    width: 100%;
    min-height: 60px;

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 14px 18px;

    border: 2px solid transparent !important;
    border-radius: 13px !important;

    cursor: pointer;

    font-family: inherit;
    font-size: 17px;
    font-weight: 800;

    text-align: right;

    color: #000000 !important;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        filter 0.2s ease;
}


/* خطبه‌ها - سبز */

.nahj-category:nth-child(1) .nahj-category-btn {
    background: #55b878 !important;
    color: #000000 !important;
}


/* نامه‌ها - آبی */

.nahj-category:nth-child(2) .nahj-category-btn {
    background: #4e9fe6 !important;
    color: #000000 !important;
}


/* حکمت‌ها - صورتی */

.nahj-category:nth-child(3) .nahj-category-btn {
    background: #ed8eb4 !important;
    color: #000000 !important;
}


/* تمام اجزای داخل دکمه نیز مشکی */

.nahj-category-btn,
.nahj-category-btn span,
.nahj-category-btn .nahj-category-icon,
.nahj-category-btn .nahj-category-arrow {
    color: #000000 !important;
}


/* حالت Hover */

.nahj-category-btn:hover {
    transform: translateY(-1px);

    filter: brightness(1.04);

    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.14);
}


/* حالت Focus */

.nahj-category-btn:focus {
    outline: 3px solid rgba(0, 0, 0, 0.18) !important;
    outline-offset: 2px;
}

.nahj-category-icon {
    font-size: 21px;
}


.nahj-category-arrow {
    margin-right: auto;

    font-size: 22px;

    transition:
        transform 0.25s ease;
}


.nahj-category-btn[aria-expanded="true"]
.nahj-category-arrow {
    transform: rotate(180deg);
}


.nahj-category-content {
    display: none;

    padding: 20px 0 5px;
}


/* =========================================
   Cards
   ========================================= */

.nahj-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px;
}


.nahj-card {
    position: relative;

    display: flex;
    flex-direction: column;

    min-width: 0;

    padding: 21px;

    background: #fff;

    border: 1px solid #e2e2e2;
    border-radius: 16px;

    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.045);

    overflow: hidden;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}


.nahj-card:hover {
    transform: translateY(-2px);

    box-shadow:
        0 10px 27px rgba(0, 0, 0, 0.08);
}


.nahj-card-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 13px;
}


.nahj-card-type {
    display: flex;

    align-items: center;

    gap: 8px;

    font-size: 14px;
    font-weight: 700;
}


.nahj-number {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-width: 34px;
    height: 30px;

    padding: 0 8px;

    border-radius: 8px;

    background: #f2f2f2;

    font-size: 14px;
}


.nahj-card-title {
    margin: 0 0 15px !important;

    font-size: 18px !important;
    line-height: 1.8 !important;

    font-weight: 800 !important;
}


.nahj-card-text {
    font-size: 16px;

    line-height: 2.25;

    text-align: justify;

    overflow-wrap: anywhere;
}


.nahj-excerpt,
.nahj-full-text {
    text-align: justify;
}


.nahj-full-text p {
    margin: 0 0 13px;
}


.nahj-full-text p:last-child {
    margin-bottom: 0;
}


/* =========================================
   دکمه ادامه مطلب
   ========================================= */

.nahj-more-btn {
    align-self: flex-start;

    display: inline-flex;
    align-items: center;

    gap: 7px;

    margin-top: 18px;
    padding: 9px 16px;

    border: 1px solid #000000 !important;
    border-radius: 9px !important;

    background: #000000 !important;
    color: #ffffff !important;

    cursor: pointer;

    font-family: inherit;
    font-size: 14px;
    font-weight: 700;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}


.nahj-more-btn span,
.nahj-more-btn .nahj-more-arrow {
    color: #ffffff !important;
}


.nahj-more-btn:hover {
    background: #222222 !important;
    color: #ffffff !important;

    transform: translateY(-1px);
}


.nahj-more-btn:focus {
    outline: 2px solid #000000 !important;
    outline-offset: 2px;
}


.nahj-more-arrow {
    font-size: 17px;
}


/* =========================================
   دکمه صوت
   ========================================= */

.nahj-audio-btn {
    width: 40px;
    height: 40px;

    flex: 0 0 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid #000000 !important;
    border-radius: 50% !important;

    background: #000000 !important;
    color: #ffffff !important;

    cursor: pointer;

    font-size: 18px;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}


.nahj-audio-btn .nahj-speaker-icon {
    color: #ffffff !important;
}


.nahj-audio-btn:hover {
    background: #222222 !important;
    color: #ffffff !important;

    transform: scale(1.06);
}


.nahj-audio-btn.playing {
    background: #333333 !important;

    transform: scale(1.08);
}



.nahj-audio-player {
    display: none;

    width: 100%;

    margin-bottom: 15px;
}


.nahj-audio-player audio {
    display: block;

    width: 100%;

    height: 42px;
}


/* =========================================
   Search Results
   ========================================= */

.nahj-results-section {
    scroll-margin-top: 35px;
}



.nahj-results-count {
    font-size: 14px;
    font-weight: 700;
}


.nahj-search-group {
    margin-bottom: 30px;
}


.nahj-search-group-title {
    margin: 0 0 15px !important;

    font-size: 20px !important;
    font-weight: 800 !important;
}


.nahj-no-result,
.nahj-error {
    padding: 20px;

    border-radius: 12px;

    background: #fff;

    border: 1px solid #ddd;

    text-align: center;

    line-height: 2;
}


/* =========================================
   Loader
   ========================================= */

.nahj-loader {
    display: flex;

    justify-content: center;
    align-items: center;

    gap: 7px;

    padding: 30px;
}


.nahj-loader span {
    width: 9px;
    height: 9px;

    border-radius: 50%;

    background: currentColor;

    animation: nahjLoading 0.8s infinite alternate;
}


.nahj-loader span:nth-child(2) {
    animation-delay: 0.15s;
}


.nahj-loader span:nth-child(3) {
    animation-delay: 0.3s;
}


@keyframes nahjLoading {

    from {
        opacity: 0.3;
        transform: translateY(0);
    }

    to {
        opacity: 1;
        transform: translateY(-5px);
    }

}


/* =========================================
   Tablet
   ========================================= */

@media (max-width: 800px) {

    .nahj-grid {
        grid-template-columns:
            1fr;
    }

    .nahj-container {
        width: min(
            100% - 24px,
            680px
        );

        margin-top: 25px;
    }

}



/* =========================================
   Search Results Header
   ========================================= */

.nahj-results-header {
    position: relative;

    display: flex;
    align-items: center;

    gap: 15px;

    min-height: 78px;

    margin-bottom: 20px;
    padding: 15px 20px;

    border-radius: 16px;

    background:
        linear-gradient(
            135deg,
            #1976d2,
            #0d47a1
        );

    color: #ffffff;

    box-shadow:
        0 7px 20px rgba(13, 71, 161, 0.20);
}


/*
 * آیکون
 */

.nahj-results-header-icon {
    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background: rgba(255, 255, 255, 0.18);

    font-size: 22px;
}


/*
 * بخش عنوان
 */

.nahj-results-header-content {
    min-width: 0;
    flex: 1;
}


.nahj-results-title {
    margin: 0 0 3px !important;

    color: #ffffff !important;

    font-size: 21px !important;
    line-height: 1.5 !important;

    font-weight: 800 !important;
}


.nahj-results-info {
    color: #ffffff !important;

    font-size: 14px;

    line-height: 1.8;

    opacity: 0.95;

    overflow-wrap: anywhere;
}


/*
 * تعداد نتایج
 */

.nahj-results-count {
    flex: 0 0 auto;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 36px;

    padding: 6px 13px;

    border-radius: 20px;

    background: rgba(255, 255, 255, 0.18);

    color: #ffffff !important;

    font-size: 13px;
    font-weight: 700;

    white-space: nowrap;
}



.nahj-category-count {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-width: 34px;
    height: 27px;

    padding: 0 8px;

    margin-right: 4px;

    border-radius: 20px;

    background: rgba(0, 0, 0, 0.12);

    color: #000000 !important;

    font-size: 12px;
    font-weight: 800;

    direction: rtl;
}



/* =========================================
   Search Highlight
   ========================================= */

.nahj-highlight {
    display: inline;

    background: #ffeb3b !important;
    color: #000000 !important;

    padding: 2px 5px;

    border-radius: 4px;

    font-weight: 800;

    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}


/* =========================================
   Mobile
   ========================================= */

@media (max-width: 600px) {

    .nahj-container {
        width: calc(100% - 18px);

        margin-top: 18px;
        margin-bottom: 40px;
    }


    .nahj-page-header {
        padding: 20px 14px;

        border-radius: 14px;

        gap: 12px;
    }


    .nahj-page-icon {
        width: 50px;
        height: 50px;

        flex-basis: 50px;

        font-size: 24px;
    }


    .nahj-page-title {
        font-size: 23px !important;
    }


    .nahj-page-description {
        font-size: 13px;

        line-height: 1.8;
    }


    .nahj-search-box {
        padding: 17px 13px;

        border-radius: 14px;
    }


    .nahj-search-row {
        flex-direction: column;
    }


    .nahj-search-input {
        width: 100% !important;

        height: 62px !important;
        min-height: 62px !important;

        padding: 0 17px !important;

        font-size: 16px !important;
        line-height: 62px !important;
    }


    .nahj-search-btn {
        width: 100%;

        height: 50px;
    }


    .nahj-category-btn {
        min-height: 56px;

        padding: 12px;

        font-size: 15px;
    }


    .nahj-category-content {
        padding-top: 13px;
    }


    .nahj-card {
        padding: 16px;

        border-radius: 13px;
    }


    .nahj-card-title {
        font-size: 17px !important;
    }


    .nahj-card-text {
        font-size: 15px;

        line-height: 2.15;
    }


    .nahj-card-header {
        margin-bottom: 10px;
    }



    /* حذف کامل هدر اختصاصی نهج البلاغه در موبایل */
    .nahj-page-header {
        display: none !important;
    }

    .nahj-categories {
        gap: 5px !important;
        margin-bottom: 25px !important;
    }

    .nahj-category-content {
        padding-top: 10px;
    }


}



/* =========================================
   Mobile Final Adjustments
   ========================================= */

@media (max-width: 600px) {

    /* حذف هدر اختصاصی */

    .nahj-page-header {
        display: none !important;
    }


    /* افزایش ارتفاع جستجو */

    .nahj-search-input {
        width: 100% !important;

        height: 62px !important;
        min-height: 62px !important;

        padding: 0 17px !important;

        font-size: 16px !important;
        line-height: 62px !important;
    }


    /* دکمه جستجو */

    .nahj-search-btn {
        width: 100% !important;

        height: 52px !important;
        min-height: 52px !important;

        background: #000000 !important;
        color: #ffffff !important;
    }


    .nahj-search-btn span {
        color: #ffffff !important;
    }


    /* کاهش فاصله منوها */

    .nahj-categories {
        gap: 5px !important;

        margin-bottom: 25px !important;
    }


    .nahj-category-btn {
        min-height: 54px !important;

        padding: 10px 13px !important;

        border-radius: 11px !important;

        font-size: 15px !important;
    }


    .nahj-category-content {
        padding-top: 10px !important;
    }


    /* کارت‌ها */

    .nahj-card {
        padding: 15px !important;

        border-radius: 12px !important;
    }


    /* متن کارت */

    .nahj-card-text {
        font-size: 15px !important;

        line-height: 2.2 !important;

        text-align: justify !important;
    }


    /* دکمه ادامه */

    .nahj-more-btn {
        background: #000000 !important;
        color: #ffffff !important;
    }


    .nahj-more-btn span,
    .nahj-more-btn .nahj-more-arrow {
        color: #ffffff !important;
    }


    /* هایلایت */

    .nahj-highlight {
        padding: 1px 3px;
    }


    .nahj-results-header {
        min-height: auto;

        margin-bottom: 15px;

        padding: 13px;

        gap: 10px;

        border-radius: 13px;
    }


    .nahj-results-header-icon {
        width: 40px;
        height: 40px;

        flex-basis: 40px;

        border-radius: 10px;

        font-size: 18px;
    }


    .nahj-results-title {
        font-size: 17px !important;
    }


    .nahj-results-info {
        font-size: 12px;

        line-height: 1.7;
    }


    .nahj-results-count {
        min-height: 32px;

        padding: 5px 9px;

        font-size: 11px;
    }

    .nahj-category-count {
        min-width: 30px;
        height: 25px;

        padding: 0 6px;

        font-size: 11px;
    }

}