/* بسم الله الرحمن الرحيم
   منتقي لغات منصة النور — تصميم نظيف منسجم مع الهوية البصرية للمنصة */

#noor-lang-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 23, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}
#noor-lang-overlay.show {
    display: flex;
    opacity: 1;
}

#noor-lang-modal {
    background: #ffffff;
    width: 100%;
    max-width: 720px;
    max-height: 92vh;
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25), 0 8px 24px rgba(5,150,105,0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.34, 1.3, 0.64, 1);
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
}
#noor-lang-overlay.show #noor-lang-modal {
    transform: translateY(0) scale(1);
}

.noor-lang-header {
    background: linear-gradient(135deg, #047857 0%, #059669 60%, #10b981 100%);
    padding: 28px 28px 22px;
    color: #ffffff;
    position: relative;
    overflow: hidden;
}
.noor-lang-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.12) 0, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.08) 0, transparent 50%);
    pointer-events: none;
}

.noor-lang-basmala {
    font-family: 'Amiri', serif;
    font-size: 1.1rem;
    text-align: center;
    opacity: 0.95;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    position: relative;
}

.noor-lang-title {
    font-size: 1.75rem;
    font-weight: 800;
    text-align: center;
    margin: 0;
    line-height: 1.3;
    position: relative;
}

.noor-lang-subtitle {
    font-size: 0.95rem;
    text-align: center;
    margin: 8px 0 0;
    opacity: 0.95;
    line-height: 1.6;
    position: relative;
}

.noor-lang-close {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #ffffff;
    font-size: 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
}
.noor-lang-close:hover {
    background: rgba(255,255,255,0.28);
    transform: rotate(90deg);
}

.noor-lang-search-bar {
    padding: 16px 24px 0;
    background: #ffffff;
    flex-shrink: 0;
}

.noor-lang-search-wrap {
    position: relative;
}
.noor-lang-search-icon {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    color: #78716c;
    pointer-events: none;
}
#noor-lang-search {
    width: 100%;
    padding: 14px 48px 14px 16px;
    border: 2px solid #e7e5e4;
    border-radius: 14px;
    font-size: 1rem;
    font-family: inherit;
    background: #fafaf9;
    color: #1c1917;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    outline: none;
    direction: rtl;
}
#noor-lang-search:focus {
    border-color: #059669;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(5,150,105,0.12);
}
#noor-lang-search::placeholder {
    color: #a8a29e;
}

.noor-lang-counter {
    margin-top: 10px;
    font-size: 0.78rem;
    color: #78716c;
    text-align: left;
    direction: ltr;
    padding: 0 4px;
}
.noor-lang-counter strong {
    color: #047857;
    font-weight: 700;
}

.noor-lang-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px 24px;
    background: #ffffff;
}

.noor-lang-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #44403c;
    margin: 8px 4px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.noor-lang-section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 14px;
    background: #059669;
    border-radius: 2px;
}

.noor-lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}

.noor-lang-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1.5px solid #e7e5e4;
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: right;
    width: 100%;
    font-family: inherit;
}
.noor-lang-item:hover {
    border-color: #059669;
    background: #f0fdf4;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5,150,105,0.10);
}
.noor-lang-item.selected {
    border-color: #047857;
    background: #d1fae5;
    box-shadow: 0 0 0 2px #047857 inset;
}

.noor-lang-flag {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
    line-height: 1;
}

/* شارة رمز ISO الرسمية (تحل محل الإيموجي) */
.noor-lang-badge {
    flex-shrink: 0;
    min-width: 40px;
    height: 30px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #d6d3d1;
    border-radius: 8px;
    background: #fafaf9;
    color: #44403c;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    direction: ltr;
    line-height: 1;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.noor-lang-item:hover .noor-lang-badge {
    background: #ffffff;
    border-color: #059669;
    color: #047857;
}
.noor-lang-item.selected .noor-lang-badge {
    background: #047857;
    border-color: #047857;
    color: #ffffff;
}

.noor-lang-text {
    flex: 1;
    min-width: 0;
}

.noor-lang-name-ar {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1c1917;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.noor-lang-name-en {
    font-size: 0.72rem;
    color: #78716c;
    margin-top: 2px;
    direction: ltr;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.noor-lang-name-native {
    font-size: 0.78rem;
    color: #047857;
    font-weight: 600;
    margin-top: 2px;
    direction: ltr;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.noor-lang-item[data-dir="rtl"] .noor-lang-name-native,
.noor-lang-item[data-dir="rtl"] .noor-lang-name-en {
    direction: rtl;
    text-align: right;
}

mark.noor-hl {
    background: #fef08a;
    color: #1c1917;
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 700;
}

.noor-lang-empty {
    text-align: center;
    padding: 40px 20px;
    color: #78716c;
}
.noor-lang-empty .noor-lang-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}
.noor-lang-empty p {
    margin: 0;
    font-size: 0.95rem;
}

.noor-lang-footer {
    padding: 16px 24px;
    border-top: 1px solid #e7e5e4;
    background: #fafaf9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.noor-lang-skip {
    background: transparent;
    border: none;
    color: #57534e;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
.noor-lang-skip:hover {
    background: #e7e5e4;
    color: #1c1917;
}

.noor-lang-confirm {
    background: #059669;
    color: #ffffff;
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    padding: 10px 22px;
    border-radius: 10px;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(5,150,105,0.25);
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.noor-lang-confirm:hover:not(:disabled) {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(5,150,105,0.35);
}
.noor-lang-confirm:disabled {
    background: #d6d3d1;
    color: #78716c;
    cursor: not-allowed;
    box-shadow: none;
}

/* زر التغيير في الترويسة */
.noor-lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    background: #ffffff;
    border: 1.5px solid #e7e5e4;
    color: #44403c;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
}
.noor-lang-trigger:hover {
    border-color: #059669;
    color: #047857;
    background: #f0fdf4;
}
.noor-lang-trigger .noor-lang-trigger-flag {
    font-size: 1.05rem;
    line-height: 1;
}

/* شارة رمز ISO في زر الترويسة */
.noor-lang-trigger-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    padding: 0 6px;
    border-radius: 5px;
    background: #047857;
    color: #ffffff;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    direction: ltr;
    line-height: 1;
}

/* شارة رمز ISO في توست التأكيد */
.noor-lang-toast-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    padding: 0 6px;
    border-radius: 5px;
    background: rgba(255,255,255,0.22);
    color: #ffffff;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    direction: ltr;
    line-height: 1;
}

/* تأكيد سريع (Toast) بعد الاختيار */
.noor-lang-toast {
    position: fixed;
    top: 88px;
    left: 50%;
    transform: translate(-50%, -10px);
    background: #047857;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    opacity: 0;
    z-index: 110;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Tajawal', sans-serif;
}
.noor-lang-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* تجاوب الشاشات الصغيرة */
@media (max-width: 540px) {
    #noor-lang-modal {
        max-height: 96vh;
        border-radius: 18px;
    }
    .noor-lang-header { padding: 22px 20px 18px; }
    .noor-lang-title { font-size: 1.4rem; }
    .noor-lang-grid {
        grid-template-columns: 1fr;
    }
    .noor-lang-search-bar { padding: 14px 16px 0; }
    .noor-lang-body { padding: 14px 16px 18px; }
    .noor-lang-footer { padding: 14px 16px; }
}
