/* گالری رسانه اخبار — الهام از question-manager */
.nmg-section-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #334155;
    margin: 1rem 0 0.65rem;
    text-align: right;
}

.nmg-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    direction: rtl;
}

.nmg-media-card {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: right;
}

.nmg-media-thumb {
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: 8px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    font-size: 26px;
    border: none;
    padding: 0;
    transition: transform .15s, box-shadow .15s;
}

.nmg-media-thumb:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(13, 148, 136, .28);
}

.nmg-media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nmg-media-name {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #334155;
}

.nmg-media-desc {
    font-size: 10px;
    color: #64748b;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* مودال خبر — راست‌چین */
.news-detail-modal .modal-content {
    direction: rtl;
    text-align: right;
}

.news-detail-modal .modal-header {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
}

.news-detail-modal .modal-header .close {
    margin: 0;
    padding: 0;
}

.news-detail-modal .modal-title {
    text-align: right;
    flex: 1;
}

.news-detail-modal-meta {
    text-align: right;
    font-size: 0.82rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.news-detail-modal-body {
    text-align: right;
    direction: rtl;
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.85;
}

.news-detail-modal-body img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

/* گالری تمام‌صفحه */
body.nmg-gallery-open { overflow: hidden; }

.nmg-gallery-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, .94);
    direction: rtl;
    padding: 48px 72px 24px;
}

.nmg-gallery-close {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    z-index: 3;
}

.nmg-gallery-close:hover { background: rgba(255, 255, 255, .25); }

.nmg-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    z-index: 3;
}

.nmg-gallery-nav:hover:not(:disabled) { background: rgba(255, 255, 255, .28); }
.nmg-gallery-nav:disabled { opacity: .35; cursor: default; }
.nmg-gallery-prev { right: 16px; }
.nmg-gallery-next { left: 16px; }

.nmg-gallery-main {
    width: 100%;
    max-width: 1100px;
    height: 100%;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.nmg-gallery-main > * { pointer-events: auto; }

.nmg-gallery-stage {
    flex: 1;
    width: 100%;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    border-radius: 12px;
    background: rgba(0, 0, 0, .35);
}

.nmg-gallery-stage--audio,
.nmg-gallery-stage--video { overflow: visible; }

.nmg-gallery-img {
    max-width: 100%;
    max-height: min(70vh, 640px);
    object-fit: contain;
    border-radius: 8px;
}

.nmg-gallery-video {
    max-width: 100%;
    max-height: min(70vh, 640px);
    border-radius: 8px;
}

.nmg-gallery-audio-wrap {
    width: min(480px, 90vw);
    padding: 24px;
    text-align: center;
}

.nmg-gallery-audio-title {
    color: #fff;
    margin-bottom: 16px;
}

.nmg-gallery-audio { width: 100%; }

.nmg-gallery-pdf {
    width: min(900px, 92vw);
    height: min(70vh, 640px);
    border: none;
    border-radius: 8px;
    background: #fff;
}

.nmg-gallery-file {
    text-align: center;
    color: #fff;
    padding: 24px;
}

.nmg-gallery-file-icon { font-size: 64px; margin-bottom: 12px; }

.nmg-gallery-file-name {
    margin-bottom: 16px;
    word-break: break-word;
}

.nmg-gallery-caption {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: #e2e8f0;
    font-size: 13px;
    padding: 0 4px;
}

.nmg-gallery-title {
    flex: 1;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nmg-gallery-counter { flex-shrink: 0; opacity: .85; }

.nmg-gallery-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    max-width: 100%;
    padding: 4px 2px 8px;
    direction: rtl;
}

.nmg-gallery-thumb {
    flex: 0 0 auto;
    width: 64px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, .1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    padding: 0;
}

.nmg-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nmg-gallery-thumb:hover { transform: scale(1.05); }
.nmg-gallery-thumb.active { border-color: #2dd4bf; }
