﻿/* =========================================================
   Community Page — Modern Discussion Style
========================================================= */

.community-page {
    position: relative;
    min-height: 100vh;
    padding: 40px 20px;
    font-family: "Cairo", sans-serif;
    z-index: 1;
    isolation: isolate; /* يمنع أي تعارض z-index مستقبلي */
}


/* =========================================================
   Header
========================================================= */

.community-header .title {
    font-size: clamp(1.8rem, 4.5vw, 3rem);
    color: #fff;
    line-height: 1.3;
}

.community-header .subtitle {
    font-size: clamp(1rem, 3.2vw, 1.25rem);
    color: rgba(255,255,255,.85);
    line-height: 1.8;
}

/* =========================================================
   Cards (Main Community)
========================================================= */

.community-card {
    border-radius: 12px;
    min-height: 105px;
    transition: box-shadow .25s ease, transform .25s ease;
}

.community-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 6px 14px rgba(0,0,0,.25);
}

.community-card .card-body {
    padding: 8px 10px;
}

@media (min-width: 992px) {
    .col-lg-20 {
        flex: 0 0 20%;
        max-width: 20%;
    }
}

.emoji {
    font-size: 1.25rem;
    line-height: 1;
}

.card-title {
    font-size: .9rem;
    font-weight: bold;
    color: #222;
    margin: 0;
}

/* =========================================================
   Responsive
========================================================= */

@media (min-width: 992px) {
    .community-page::before {
        width: 1700px;
    }
}

@media (max-width: 576px) {
    .community-header .title { font-size: 1.6rem; }
    .community-header .subtitle { font-size: .95rem; }
    .community-card { min-height: 95px; }
    .emoji { font-size: 1.15rem; }
    .card-title { font-size: .85rem; }
}

/* =========================================================
   Community Specialization Page
========================================================= */

.section-page {
    min-height: 100vh;
    background-color: #f8f9fa;
    font-family: "Cairo", sans-serif;
}

/* =========================================================
   Post Card
========================================================= */

.post-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,.05);
    width: 100%;
    overflow: visible; /* مهم للقائمة المنسدلة */
}

.post-card:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,.08);
}

/* النصوص */
.post-title {
    font-size: 1rem;
    line-height: 1.4;
}

.community-specialization-page .post-title,
.community-specialization-page .post-title a {
    font-size: 1.24rem;
    font-weight: 800 !important;
    line-height: 1.45;
    color: #0f172a !important;
}

.community-specialization-page .post-title {
    text-align: center;
}

.community-specialization-page .post-title a {
    display: inline-block;
}

.community-specialization-page .post-text,
.community-specialization-page .community-post-content {
    font-size: 0.98rem;
    font-weight: 400;
    line-height: 1.9;
    color: #334155;
}

/* عناوين محتوى المشاركة تكون أدنى من عنوان البطاقة */
.community-specialization-page .community-post-content h1,
.community-specialization-page .community-post-content h2,
.community-specialization-page .community-post-content h3,
.community-specialization-page .community-post-content h4,
.community-specialization-page .community-post-content h5,
.community-specialization-page .community-post-content h6 {
    font-weight: 700;
    line-height: 1.6;
    margin-top: 0.85rem;
    margin-bottom: 0.45rem;
    color: #0f172a;
    max-width: 100%;
}

.community-specialization-page .community-post-content h1 { font-size: 1.04rem !important; }
.community-specialization-page .community-post-content h2 { font-size: 1.02rem !important; }
.community-specialization-page .community-post-content h3 { font-size: 1rem !important; }
.community-specialization-page .community-post-content h4 { font-size: 0.98rem !important; }
.community-specialization-page .community-post-content h5 { font-size: 0.96rem !important; }
.community-specialization-page .community-post-content h6 { font-size: 0.94rem !important; }

.community-specialization-page .specialization-hero-title {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 24px 16px;
    border: 1px solid #e4ede7;
    border-radius: 22px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%);
    box-shadow: 0 12px 30px rgba(16, 24, 40, 0.05);
    max-width: min(100%, 760px);
}

.community-specialization-page .specialization-main-title,
.community-specialization-page .specialization-detail-title {
    margin: 0;
    font-family: "Cairo", sans-serif;
    font-weight: 800;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    line-height: 1.3;
    text-wrap: balance;
}

.community-specialization-page .specialization-main-title {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.community-specialization-page .specialization-detail-title {
    font-size: clamp(1.05rem, 2.1vw, 1.45rem);
    color: #4b5563;
    font-weight: 700;
}

.community-specialization-page .specialization-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95em;
    line-height: 1;
}

.community-specialization-page .community-related-specializations {
    padding: 14px 16px 10px;
    border: 1px solid #e6ede8;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%);
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.04);
}

.community-specialization-page .community-related-specializations__label {
    font-weight: 700;
    color: #6b7280;
    letter-spacing: .2px;
}

.community-specialization-page .community-related-specializations__track {
    scrollbar-width: thin;
    scrollbar-color: #c5d6cb transparent;
}

.community-specialization-page .community-related-specialization-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid #cfe2d5;
    background: #fff;
    color: #165a38 !important;
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(22, 107, 67, 0.08);
    transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease;
}

@media (min-width: 768px) {
    .community-specialization-page .community-related-specialization-link {
        min-width: 170px;
        min-height: 56px;
        padding: 14px 18px;
        border-radius: 18px;
        background: linear-gradient(180deg, #ffffff 0%, #f9fcfa 100%);
        box-shadow: 0 8px 20px rgba(22, 107, 67, 0.10);
        font-size: 0.96rem;
    }

    .community-specialization-page .community-related-specializations__track {
        gap: 12px;
    }
}

.community-specialization-page .community-related-specialization-link:hover,
.community-specialization-page .community-related-specialization-link:focus {
    background: #eff8f2;
    border-color: #a9ccb6;
    color: #165a38 !important;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(22, 107, 67, 0.12);
    text-decoration: none;
}

/* Read more/less clamp */
.community-specialization-page .community-post-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.community-specialization-page .community-post-content.collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 6;
    position: relative;
}

.community-specialization-page .community-post-content.collapsed::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top, #fff, transparent);
}

.community-specialization-page .community-post-content:not(.collapsed) {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

#topic-word-count-live[data-state="warn"] {
  color: #9a6700 !important;
  font-weight: 700;
}

#topic-word-count-live[data-state="error"] {
  color: #b42318 !important;
  font-weight: 700;
}

.edit-word-count-live[data-state="warn"] {
  color: #9a6700 !important;
  font-weight: 700;
}

.edit-word-count-live[data-state="error"] {
  color: #b42318 !important;
  font-weight: 700;
}

.user-content {
    font-size: 1.05rem;
    line-height: 1.9;
    color: #2e2e2e;
}

.post-card .post-title,
.post-card .user-content {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* =========================================================
   Attachments
========================================================= */

.attachment-box {
    margin-top: 10px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.attachment-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1f2937 !important;
    font-weight: 600;
    font-size: 0.92rem;
    min-height: 40px;
    width: 100%;
    padding: 4px 6px;
    border-radius: 10px;
    transition: background-color .2s ease, transform .15s ease;
}

.attachment-link:hover {
    color: #111827 !important;
    background: #f8fafc;
    transform: translateY(-1px);
}

.attachment-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #f8fafc;
    color: #334155;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.attachment-name {
    flex: 1 1 auto;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-inline-start: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #f8fafc;
    color: #475569;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1.2;
    flex: 0 0 auto;
}

.attachment-type-badge.is-pdf {
    border-color: #d1d5db;
    background: #f8fafc;
    color: #475569;
}

.attachment-type-badge.is-word {
    border-color: #d1d5db;
    background: #f8fafc;
    color: #475569;
}

.attachment-type-badge.is-excel {
    border-color: #d1d5db;
    background: #f8fafc;
    color: #475569;
}

.attachment-type-badge.is-powerpoint {
    border-color: #d1d5db;
    background: #f8fafc;
    color: #475569;
}

.attachment-type-badge.is-generic {
    border-color: #d1d5db;
    background: #f8fafc;
    color: #475569;
}

/* Unified pagination look for both WordPress default links and Bootstrap markup */
.pagination {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination .page-numbers,
.pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    border-radius: 10px !important;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #334155;
    text-decoration: none;
    font-weight: 700;
    padding: 0 12px;
}

.pagination .page-link.prev,
.pagination .page-link.next,
.pagination .page-numbers.prev,
.pagination .page-numbers.next {
    min-width: 96px;
    padding-inline: 14px;
    font-weight: 700;
}

.pagination .page-numbers:hover,
.pagination .page-link:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}

.pagination .current,
.pagination .active .page-link,
.pagination .page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff !important;
}

.pagination .dots,
.pagination .page-item.disabled .page-link {
    background: #f8fafc;
    color: #94a3b8;
    border-color: #e2e8f0;
    pointer-events: none;
}

.pagination-wrapper {
    overflow-x: auto;
    padding-bottom: 4px;
}

.pagination-wrapper nav {
    min-width: max-content;
}

@media (max-width: 575px) {
    .pagination .page-numbers,
    .pagination .page-link {
        min-width: 36px;
        height: 36px;
        font-size: 0.8rem;
        padding: 0 8px;
        border-radius: 8px !important;
    }

    .pagination .page-link.prev,
    .pagination .page-link.next,
    .pagination .page-numbers.prev,
    .pagination .page-numbers.next {
        min-width: 84px;
        padding-inline: 10px;
    }
    .pagination-wrapper .page-item {
        display: none;
    }
    .pagination-wrapper .page-item.active,
    .pagination-wrapper .page-item.prev,
    .pagination-wrapper .page-item.next,
    .pagination-wrapper .page-item.disabled,
    .pagination-wrapper .page-item:first-child,
    .pagination-wrapper .page-item:last-child {
        display: list-item;
    }
}

/* =========================================================
   Buttons Row
========================================================= */

.post-card .d-flex {
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

/* Icon-only actions (endorse/repost) */
.icon-only-btn {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0.15rem 0.35rem !important;
    color: #334155 !important;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.icon-only-btn:hover {
    color: #0f172a !important;
}

.icon-only-btn.is-active {
    color: #166b43 !important;
}

.library-share-icon {
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    margin-inline-end: 4px;
}

.library-share-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.repost-icon {
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    font-size: 1rem;
    line-height: 1;
}

.repost-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.icon-only-btn .endorse-count {
    font-size: 0.82rem;
    font-weight: 800;
}

.post-dropdown .icon-only-dropdown-item {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #334155 !important;
}

.post-dropdown .icon-only-dropdown-item:hover {
    color: #0f172a !important;
}

/* عند فتح القائمة لا تتحرك البطاقة */
.post-card.dropdown-open {
    transform: none !important;
    z-index: 25;
    position: relative;
}

.post-card.dropdown-open:hover {
    transform: none !important;
}

/* =========================================================
   Sidebar
========================================================= */

/* تقليل الهوامش الخارجية للسايدبار في نسخة الحاسوب */
@media (min-width: 769px) {
    .community-specialization-page {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .community-specialization-page .container {
        padding-left: 5px;
        padding-right: 5px;
        max-width: 100%;
    }
    
    .community-specialization-page .row {
        margin-left: -3px;
        margin-right: -3px;
    }
    
    .community-specialization-page .col-md-4 {
        padding-left: 3px;
        padding-right: 3px;
    }
    
    /* تقليل هوامش الإعلان العلوي */
    .community-specialization-page .ad-banner-top {
        margin-bottom: 10px !important;
    }
    
    .community-specialization-page .ad-banner-top .ad-placeholder {
        padding: 6px !important;
    }
    
    /* تقليل هوامش الهيدر */
    .community-specialization-page .text-center.mb-4 {
        margin-bottom: 15px !important;
    }
}

.specialization-sidebar,
.ads-sidebar {
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    padding: 15px 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,.04);
    z-index: 2;
}

@media (min-width: 768px) {
    .community-specialization-page .container-fluid,
    .community-specialization-page .container,
    .community-specialization-page .row {
        overflow: visible;
    }

    .specialization-sidebar {
        position: static;
        top: auto;
        height: fit-content;
    }

    .community-specialization-page .sidebar-left,
    .community-specialization-page .sidebar-right {
        align-self: flex-start;
        position: relative;
    }
}

@media (min-width: 768px) {
    .sidebar-sticky-box {
        position: static;
        top: auto;
        display: flex;
        flex-direction: column;
        gap: 16px;
        align-self: flex-start;
        height: fit-content;
        z-index: 2;
    }

    .sidebar-right .ads-sidebar {
        position: static !important;
        top: auto !important;
    }
}

/* Ensure sticky sidebars work inside flex rows */
@media (min-width: 768px) {
  .community-specialization-page .sidebar-left,
  .community-specialization-page .sidebar-right {
      align-self: flex-start;
  }
}

.community-specialization-page,
.community-specialization-page .row {
    overflow: visible;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1f2937;
    letter-spacing: .5px;
    text-align: center;
}

.sidebar-title::after {
    content: "";
    display: block;
    width: 45px;
    height: 3px;
    margin: 10px auto 0;
    background: #166b43 !important;
    border-radius: 10px;
}

.specialization-sidebar .sidebar-title::after {
    background: #166b43 !important;
}

.sidebar-link {
    display: block;
    padding: 9px 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    color: #000;
    font-weight: 600;
    font-size: 1.02rem;
    text-decoration: none;
    transition: all .25s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-link:hover {
    background: #eef7f1;
    border-color: #cfe5d8;
    color: #000;
    transform: translateX(-2px);
}

.sidebar-link.active {
    background: #166b43;
    border-color: #166b43;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(22,107,67,.18);
}

.community-specialization-page .suggest-specialization-card {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    background: #fff;
    border: 1px solid #e4ebe6;
    color: #166b43 !important;
    font-weight: 800;
    padding: 14px 16px;
    border-radius: 18px;
    box-shadow: 0 10px 22px rgba(16, 24, 40, 0.06);
    transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease;
}

.community-specialization-page .suggest-specialization-card:hover {
    background: #f8fcf9;
    border-color: #cfe3d6;
    color: #166b43 !important;
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(16, 24, 40, 0.08);
    text-decoration: none;
}

.community-specialization-page .suggest-specialization-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #166b43;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    flex: 0 0 auto;
}

.community-specialization-page .suggest-specialization-card__text {
    line-height: 1.4;
    font-size: 0.98rem;
    flex: 1 1 auto;
}

/* Override global link color in specialization sidebar */
.community-specialization-page .sidebar-link {
    color: #000 !important;
}

.community-specialization-page .sidebar-link:hover {
    color: #000 !important;
}

.community-specialization-page .sidebar-link.active,
.community-specialization-page .sidebar-link.active:hover {
    color: #fff !important;
}

.community-specialization-page .sidebar-link--special {
    display: flex;
    align-items: center;
    gap: 10px;
}

.community-specialization-page .sidebar-link--special .sidebar-link__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: rgba(22, 107, 67, 0.12);
    color: #166b43;
    font-weight: 800;
    flex: 0 0 auto;
}

.community-specialization-page .sidebar-link--special .sidebar-link__text {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
}

.specialization-sidebar ul {
    max-height: 66vh;
    overflow-y: auto;
    padding: 2px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 105, 63, 0.24) transparent;
}

@media (min-width: 768px) {
    .specialization-sidebar ul {
        max-height: none;
        overflow: visible;
    }
}

@media (min-width: 992px) {
    .community-specialization-page .specialization-sidebar,
    .community-specialization-page .sidebar-sticky-box {
        position: sticky;
        top: 92px;
        align-self: flex-start;
        height: fit-content;
        z-index: 5;
    }

    .community-specialization-page .sidebar-sticky-box {
        display: flex;
        flex-direction: column;
        gap: 16px;
        max-height: calc(100vh - 112px);
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: rgba(15, 105, 63, 0.24) transparent;
    }

    .community-specialization-page .specialization-list-scroll {
        max-height: calc(100vh - 190px) !important;
        overflow-y: auto !important;
    }
}

.specialization-sidebar ul::-webkit-scrollbar {
    width: 8px;
}

.specialization-sidebar ul::-webkit-scrollbar-track {
    background: transparent;
}

.specialization-sidebar ul::-webkit-scrollbar-thumb {
    background: rgba(15, 105, 63, 0.22);
    border-radius: 999px;
}

.specialization-sidebar ul::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 105, 63, 0.34);
}

.community-specialization-page .community-inline-link {
    display: inline-block;
    font-weight: 700;
    color: #166b43 !important;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    transition: color .2s ease, opacity .2s ease;
}

.community-specialization-page .community-inline-link:hover,
.community-specialization-page .community-inline-link:focus {
    color: #0f5a38 !important;
    opacity: 0.96;
}

@media (max-width: 768px) {
    .specialization-sidebar {
        padding: 15px;
    }

    .sidebar-title {
        font-size: 1rem;
    }
	
	/* إعادة ترتيب التخصصات في نسخة الهاتف */
	.sidebar-left {
		order: 3 !important;
	}
	
	.sidebar-right {
		order: 2 !important;
	}
	
	/* المحتوى الرئيسي في المنتصف */
	.col-md-4.order-3.order-md-2 {
		order: 1 !important;
	}
}

/* =========================================================
   Create Topic Button
========================================================= */

.community-action {
    position: relative;
    text-align: center;
}

.community-action::after {
    content: "";
    display: block;
    width: 120px;
    height: 2px;
    margin: 20px auto 0;
    background: linear-gradient(90deg, transparent, #dee2e6, transparent);
}

.community-action button {
    border-radius: 999px;
    font-size: .95rem;
    box-shadow: 0 10px 24px rgba(0,0,0,0.12) !important;
    transition: all .25s ease;
}

.community-action button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.16) !important;
}

.community-action button:focus,
.community-action button:active,
.community-action button:focus-visible {
    box-shadow: none !important;
    outline: none !important;
    border-color: var(--primary-color) !important;
    -webkit-tap-highlight-color: transparent;
}

.community-action .btn-primary:focus,
.community-action .btn-primary:active,
.community-action .btn-check:focus + .btn-primary {
    box-shadow: none !important;
    outline: none !important;
    border-color: var(--primary-color) !important;
}

/* =========================================================
   Button Loading State
========================================================= */

.is-loading,
button.is-loading,
.btn.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}

.is-loading .btn-loading-spinner,
button.is-loading .btn-loading-spinner,
.btn.is-loading .btn-loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-inline-start: 6px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: maarifaBtnSpin 0.7s linear infinite;
  vertical-align: -2px;
}

@keyframes maarifaBtnSpin {
  to { transform: rotate(360deg); }
}

/* =========================================================
   Dropdown Fix (للقائمة داخل البطاقة) - منع التذبذب
========================================================= */

.post-card {
    overflow: visible;
}

.post-card .card-body {
    overflow: visible;
}

.post-dropdown .dropdown-menu {
    z-index: 1060;
    position: absolute;
    will-change: transform;
    min-width: 10rem;
}

/* منع القائمة من التذبذب عند وجود مشاركات تحتها */
.post-dropdown {
    position: relative;
}

.section-page .post-card {
    overflow: visible;
}

.dropdown-menu {
    z-index: 1060;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}


#toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 99999;
  width: auto;
  max-width: 90%;
  pointer-events: none;
}

#toast-container .toast {
  pointer-events: auto;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.18);
  font-weight: 600;
  animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* =======================================
   Community Cards Visual Hierarchy
======================================= */
.community-specialization-page {
    --community-accent: #1f7a56;
}

.community-specialization-page .badge-post-kind {
    background: #f7faf8 !important;
    color: var(--community-accent) !important;
    border: 1px solid var(--community-accent) !important;
    font-weight: 700;
}

.community-specialization-page .badge-top-interaction,
.community-specialization-page .badge-featured-answer {
    background: #f59e0b !important;
    color: #fff !important;
    border: 1px solid #f59e0b !important;
    font-weight: 700;
}

.community-specialization-page .post-card {
    border: 1px solid #d7dee7 !important;
    border-inline-start: 1px solid #d7dee7 !important;
    border-radius: 14px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.06);
    background: #ffffff;
    position: relative;
    overflow: visible;
}

.community-specialization-page .post-card:hover {
    border-color: #c1cedd !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.09);
}

.community-specialization-page .post-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid #166b43;
    border-radius: 14px;
    opacity: 0.9;
    pointer-events: none;
}
.community-archive-card {
    cursor: pointer;
}

.community-archive-card .card-body {
    gap: 6px;
    overflow: hidden;
}

.community-archive-card .archive-author-row {
    align-items: center;
}

.community-archive-card .archive-author-row > .flex-grow-1,
.community-archive-card .author-name-row {
    min-width: 0;
}

.community-archive-card .author-name-row {
    flex-wrap: wrap;
    row-gap: 4px;
}

.community-archive-card .follow-link {
    margin-inline-start: 6px;
    white-space: nowrap;
}

.community-archive-card .author-subtitle {
    line-height: 1.3;
}

.community-archive-card .card-body,
.community-archive-card .card-body * {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.community-archive-card h5,
.community-archive-card .author-subtitle,
.community-archive-card .small,
.community-archive-card p {
    max-width: 100%;
}

.community-post-content .footnote-title {
    font-weight: 600;
    font-size: 0.92rem;
    color: #6b7280;
    margin: 0.4rem 0;
}

.community-post-content .footnote-separator {
    border: 0;
    border-top: 2px solid #b8c7bf;
    width: 25%;
    max-width: 160px;
    margin: 0.8rem 0 0.5rem;
    margin-inline-start: 0;
    margin-inline-end: auto;
}

.community-post-content ol.footnotes {
    padding-right: 1.2rem;
    margin: 0.6rem 0 0;
    padding-top: 0.5rem;
    border-top: 0;
}

.community-post-content ol.footnotes li {
    margin-bottom: 0.25rem;
}

.community-post-content .footnote-ref a,
.community-post-content .footnote-backlink {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.community-post-content .footnote-ref a:hover,
.community-post-content .footnote-backlink:hover {
    text-decoration: underline;
}

.community-specialization-page .read-more-btn,
.single-community_post .read-more-btn {
    display: inline-block;
    margin-top: 8px;
    margin-bottom: 10px;
    font-size: 0.84rem;
    font-weight: 600;
    padding: 0.28rem 0.56rem;
    border-radius: 10px;
    line-height: 1.25;
    border: 1px solid var(--primary-color);
    background: var(--primary-color);
    color: #fff !important;
    cursor: pointer;
    transition: 0.2s ease;
}

.community-specialization-page .read-more-btn:hover,
.community-specialization-page .read-more-btn:focus,
.single-community_post .read-more-btn:hover,
.single-community_post .read-more-btn:focus {
    background: var(--primary-color);
    border-color: var(--primary-color);
    filter: brightness(0.96);
    color: #fff !important;
    transform: none;
    text-decoration: none;
    box-shadow: none;
}

.community-specialization-page .replies-section {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed #e2e8f0;
}

.community-specialization-page .reply-box {
    margin-top: 6px !important;
}

.community-specialization-page .replies-empty-state {
    margin-bottom: 2px !important;
}

.community-specialization-page .replies-section .replies-empty-state {
    margin: 4px 0;
}

.community-specialization-page .reply-box.reply-box--compact {
    margin-top: 8px !important;
}
.community-footnote-helper {
    border: 1px dashed #e5e7eb;
    border-radius: 12px;
    padding: 12px 14px;
    background: #f9fafb;
}
.community-footnote-title {
    font-weight: 700;
    color: #166b43;
    margin-bottom: 6px;
}
.community-footnote-desc,
.community-footnote-note {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.7;
    margin-bottom: 8px;
}
.community-footnote-note {
    margin-bottom: 0;
}

.community-specialization-page .replies-section .reply-item {
    border: 1px solid #edf2f7 !important;
    border-inline-start: 3px solid #cbd5e1 !important;
    border-radius: 12px;
    background: #fcfdff;
    padding: 10px 12px !important;
    margin-bottom: 10px;
}

.community-specialization-page .replies-section .reply-item .reply-content {
    color: #334155;
    font-size: 0.9rem;
    line-height: 1.65;
}

.community-specialization-page .featured-reply-preview {
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
}

.community-specialization-page .featured-reply-preview-title {
    color: #c2410c !important;
    font-weight: 700;
}

.community-specialization-page .featured-reply-preview .reply-item {
    margin-bottom: 0;
}

 /* toast إعادة إرسال التفعيل */

.toast-msg {
    min-width: 280px;
    padding: 14px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    text-align: center;
    opacity: 0;
    transform: translateY(-10px);
    transition: all .3s ease;
    box-shadow: 0 6px 20px rgba(0,0,0,.15);
}

.toast-msg.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: linear-gradient(135deg, #28a745, #218838);
}

.toast-error {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

/* تقليل المسافة الجانبية في صفحة التخصص */
.community-specialization-page .container {
    max-width: 100%;
    padding-left: 8px;
    padding-right: 8px;
}

/* =======================================
   Community UI Polish (Scoped + Safe)
======================================= */
.community-specialization-page .post-actions .btn,
.community-specialization-page .reply-actions-inline .btn,
.community-specialization-page .reply-actions .btn {
    font-size: 0.84rem;
    padding: 0.28rem 0.56rem;
    border-radius: 999px;
    line-height: 1.25;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}

.community-specialization-page .btn.btn-outline-primary,
.community-specialization-page .btn.btn-outline-secondary,
.community-specialization-page .btn.btn-outline-danger,
.community-specialization-page .btn.btn-outline-warning {
    border-width: 1px;
}

.community-specialization-page .btn.btn-outline-primary:hover,
.community-specialization-page .btn.btn-outline-primary:focus,
.community-specialization-page .btn.btn-outline-primary:active {
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
    background: rgba(22, 107, 67, 0.08) !important;
    box-shadow: 0 10px 20px rgba(22, 107, 67, 0.12) !important;
    transform: translateY(-1px);
}

.community-specialization-page .btn.btn-outline-secondary:hover,
.community-specialization-page .btn.btn-outline-secondary:focus,
.community-specialization-page .btn.btn-outline-secondary:active {
    background: #f3f4f6 !important;
    border-color: #d1d5db !important;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08) !important;
    transform: translateY(-1px);
}

.community-specialization-page .post-actions .btn:hover,
.community-specialization-page .reply-actions-inline .btn:hover,
.community-specialization-page .reply-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.community-archive-card .btn {
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    transition: all .2s ease;
}

.community-archive-card .btn:hover {
    transform: translateY(-1px);
}

.community-specialization-page .post-dropdown .dropdown-menu,
.community-specialization-page .reply-dropdown .dropdown-menu {
    border: 1px solid #e5e7eb;
    border-radius: 11px;
    padding: 0.22rem;
    min-width: 190px;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.08);
    z-index: 2200;
    margin-top: 0.2rem;
}

.community-specialization-page .create-topic-btn {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}

.community-specialization-page .create-topic-btn:hover,
.community-specialization-page .create-topic-btn:focus {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
    box-shadow: none;
}

/* Archive community card action */
.post-type-archive-community_post .community-archive-card a.btn.btn-outline-secondary.w-100.mt-auto {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
    box-shadow: 0 8px 18px rgba(22, 107, 67, 0.16);
}

.post-type-archive-community_post .community-archive-card a.btn.btn-outline-secondary.w-100.mt-auto:visited,
.post-type-archive-community_post .community-archive-card a.btn.btn-outline-secondary.w-100.mt-auto:hover,
.post-type-archive-community_post .community-archive-card a.btn.btn-outline-secondary.w-100.mt-auto:focus,
.post-type-archive-community_post .community-archive-card a.btn.btn-outline-secondary.w-100.mt-auto:active {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
    filter: brightness(0.96);
    box-shadow: 0 10px 22px rgba(22, 107, 67, 0.18);
    text-decoration: none;
}

.community-specialization-page .dropdown-menu .dropdown-item {
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: 8px;
    padding: 0.32rem 0.5rem;
    line-height: 1.25;
    display: flex;
    align-items: center;
    gap: 6px;
}

.community-specialization-page .dropdown-menu .dropdown-item:hover,
.community-specialization-page .dropdown-menu .dropdown-item:focus {
    background: rgba(22, 107, 67, 0.1);
    color: var(--primary-color);
    transform: translateX(-1px);
}

.community-specialization-page .dropdown-menu .dropdown-item .repost-icon {
    color: var(--primary-color);
    font-weight: 900;
    font-size: 0.98em;
    line-height: 1;
}

.community-specialization-page .follow-link {
    font-size: 13px;
    font-weight: 600;
}

.follow-btn.follow-link {
    appearance: none;
    -webkit-appearance: none;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: #1d4ed8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    padding: 0 !important;
    text-decoration: none;
    white-space: nowrap;
}

.follow-btn.follow-link:hover,
.follow-btn.follow-link:focus {
    background: transparent !important;
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.follow-btn.follow-link:focus-visible {
    outline: 2px solid rgba(29, 78, 216, 0.28);
    outline-offset: 2px;
}

.follow-btn.follow-link.is-following {
    color: var(--primary-color);
}

.follow-btn.follow-link.is-following:hover,
.follow-btn.follow-link.is-following:focus {
    color: var(--primary-color);
}

.community-moderator-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eaf6ef;
    border: 1px solid #cfe7d9;
    color: #0f693f;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.community-moderator-badge:hover {
    color: #0f693f;
}

@media (max-width: 767px) {
    .community-specialization-page {
        padding-bottom: 86px;
    }

    .community-specialization-page .dropdown-menu .dropdown-item {
        font-size: 0.86rem;
        padding: 0.38rem 0.55rem;
    }

    .community-specialization-page .navigation-buttons {
        position: fixed !important;
        right: 50% !important;
        bottom: max(16px, env(safe-area-inset-bottom)) !important;
        left: auto !important;
        top: auto !important;
        transform: translateX(50%);
        z-index: 1090;
        width: auto !important;
        margin: 0 !important;
        padding: 0;
        border: 0;
        border-radius: 999px;
        box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
    }

    .community-specialization-page .navigation-buttons .btn {
        border-radius: 999px;
        padding: 0.65rem 1.15rem;
        font-weight: 800;
        box-shadow: none;
    }

    .community-specialization-page .specialization-hero-title {
        padding: 16px 14px 14px;
        border-radius: 18px;
    }

    .community-specialization-page .specialization-main-title {
        font-size: 1.7rem;
    }

    .community-specialization-page .specialization-detail-title {
        font-size: 1rem;
    }

    .community-specialization-page .community-related-specializations {
        padding: 12px 12px 10px;
        border-radius: 16px;
    }

    .community-specialization-page .community-related-specializations__track {
        justify-content: flex-start !important;
        gap: 10px;
        padding-bottom: 6px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .community-specialization-page .community-related-specialization-link {
        padding: 9px 13px;
        font-size: 0.88rem;
        scroll-snap-align: start;
    }
}

/* Three-dots menu button polish (post/reply) */
.community-specialization-page .post-dropdown .dropdown-toggle,
.community-specialization-page .reply-dropdown .dropdown-toggle {
    min-width: 32px;
    height: 28px;
    padding: 0 7px;
    border-radius: 10px;
    border: 1px solid #d8dee7;
    background: #fff;
    color: #475569;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease;
}

.community-specialization-page .post-dropdown .dropdown-toggle:hover,
.community-specialization-page .post-dropdown .dropdown-toggle:focus,
.community-specialization-page .reply-dropdown .dropdown-toggle:hover,
.community-specialization-page .reply-dropdown .dropdown-toggle:focus {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(22, 107, 67, 0.08);
    box-shadow: 0 8px 16px rgba(22, 107, 67, 0.12);
    transform: translateY(-1px);
}

.community-specialization-page .post-dropdown .dropdown-menu .dropdown-item i,
.community-specialization-page .reply-dropdown .dropdown-menu .dropdown-item i {
    width: 18px;
    text-align: center;
}

.community-specialization-page .post-dropdown .dropdown-toggle::after,
.community-specialization-page .reply-dropdown .dropdown-toggle::after {
    display: none;
}

.community-writing-direction {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.community-writing-direction__label {
    color: #475569;
    font-size: 0.92rem;
    font-weight: 700;
}

.community-direction-btn {
    min-width: 108px;
    border-radius: 999px;
}

.community-direction-btn.is-active,
.community-direction-btn[aria-pressed="true"] {
    background: #166b43;
    border-color: #166b43;
    color: #fff;
}

.community-writing-direction--inline {
    margin-bottom: 0.5rem;
}

.community-writing-direction--inline .community-writing-direction__label {
    font-size: 0.85rem;
}

.community-direction-btn--compact {
    min-width: 72px;
    padding-inline: 0.7rem;
}
