/**
 * Share Profile modal - RTL/LTR layout.
 * Loaded after page Styles sections so profile CSS cannot override it.
 */

#shareProfileModal.show.share-profile-modal--rtl .modal-content,
#shareProfileModal.show[dir="rtl"] .modal-content {
    direction: rtl !important;
    text-align: right !important;
}

#shareProfileModal.show:not(.share-profile-modal--rtl) .modal-content,
#shareProfileModal.show[dir="ltr"] .modal-content {
    direction: ltr !important;
    text-align: left !important;
}

#shareProfileModal.show.share-profile-modal--rtl .modal-header,
#shareProfileModal.show[dir="rtl"] .modal-header {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    direction: rtl !important;
    width: 100% !important;
}

/* RTL: pin × to the physical top-left corner */
#shareProfileModal.show.share-profile-modal--rtl .modal-header .btn-close,
#shareProfileModal.show[dir="rtl"] .modal-header .btn-close {
    position: absolute !important;
    top: 50% !important;
    left: 1rem !important;
    right: auto !important;
    margin: 0 !important;
    transform: translateY(-50%) !important;
    z-index: 2 !important;
}

#shareProfileModal.show.share-profile-modal--rtl .modal-header .modal-title,
#shareProfileModal.show[dir="rtl"] .modal-header .modal-title {
    width: 100% !important;
    text-align: right !important;
    padding-inline-end: 2.5rem !important;
}

/* LTR: pin × to the physical top-right corner */
#shareProfileModal.show:not(.share-profile-modal--rtl):not([dir="rtl"]) .modal-header {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    direction: ltr !important;
    width: 100% !important;
}

#shareProfileModal.show:not(.share-profile-modal--rtl):not([dir="rtl"]) .modal-header .btn-close {
    position: absolute !important;
    top: 50% !important;
    right: 1rem !important;
    left: auto !important;
    margin: 0 !important;
    transform: translateY(-50%) !important;
    z-index: 2 !important;
}

#shareProfileModal.show:not(.share-profile-modal--rtl):not([dir="rtl"]) .modal-header .modal-title {
    width: 100% !important;
    text-align: left !important;
    padding-inline-end: 2.5rem !important;
}

#shareProfileModal.show.share-profile-modal--rtl .modal-body,
#shareProfileModal.show[dir="rtl"] .modal-body {
    direction: rtl !important;
    text-align: right !important;
}

#shareProfileModal.show:not(.share-profile-modal--rtl) .modal-body,
#shareProfileModal.show[dir="ltr"] .modal-body {
    direction: ltr !important;
    text-align: left !important;
}

#shareProfileModal.show.share-profile-modal--rtl .modal-footer,
#shareProfileModal.show[dir="rtl"] .modal-footer {
    direction: ltr !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-end !important;
    align-items: center !important;
    width: 100% !important;
}

#shareProfileModal.show.share-profile-modal--rtl .modal-footer .btn,
#shareProfileModal.show[dir="rtl"] .modal-footer .btn {
    direction: rtl !important;
}

#shareProfileModal.show.share-profile-modal--rtl .form-label,
#shareProfileModal.show[dir="rtl"] .form-label {
    text-align: right !important;
    width: 100% !important;
    display: block !important;
}

#shareProfileModal.show:not(.share-profile-modal--rtl) .form-label,
#shareProfileModal.show[dir="ltr"] .form-label {
    text-align: left !important;
    width: 100% !important;
    display: block !important;
}

/* Profile URL row: label follows modal direction; input+button stay LTR */
#shareProfileModal.show.share-profile-modal--rtl .share-profile-url-group .share-profile-url-label,
#shareProfileModal.show[dir="rtl"] .share-profile-url-group .share-profile-url-label {
    text-align: right !important;
}

#shareProfileModal .share-profile-url-input-group {
    direction: ltr !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
}

#shareProfileModal .share-profile-url-input-group .form-control {
    direction: ltr !important;
    text-align: left !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

#shareProfileModal .share-profile-url-input-group .btn {
    direction: ltr !important;
    flex-shrink: 0 !important;
}

#shareProfileModal.show.share-profile-modal--rtl .share-profile-social-buttons,
#shareProfileModal.show[dir="rtl"] .share-profile-social-buttons {
    direction: rtl !important;
    justify-content: flex-start !important;
}

#shareProfileModal.show.share-profile-modal--rtl #friendsFollowersList .form-check,
#shareProfileModal.show[dir="rtl"] #friendsFollowersList .form-check {
    direction: rtl !important;
    text-align: right !important;
}

#shareProfileModal.show.share-profile-modal--rtl #friendsFollowersList .form-check-label,
#shareProfileModal.show[dir="rtl"] #friendsFollowersList .form-check-label {
    flex-direction: row-reverse !important;
}

/* English/LTR: dialog below navbar, top-right */
#shareProfileModal.show:not(.share-profile-modal--rtl):not([dir="rtl"]) .modal-dialog.modal-dialog-scrollable {
    margin: 0.5rem 0.5rem 0.5rem auto !important;
}

/* Persian/RTL: dialog below navbar, top-left */
#shareProfileModal.show.share-profile-modal--rtl .modal-dialog.modal-dialog-scrollable,
#shareProfileModal.show[dir="rtl"] .modal-dialog.modal-dialog-scrollable {
    margin: 0.5rem auto 0.5rem 0.5rem !important;
}
