/* تنسيقات الإشعارات المخصصة */
.custom-notify {
    font-family: 'Tajawal', sans-serif !important;
    direction: rtl !important;
    text-align: right !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.15) !important;
    padding: 1rem 1.25rem !important;
    min-width: 300px !important;
    max-width: 400px !important;
    border: none !important;
    border-right: 4px solid #28a745 !important;
    background-color: #ffffff !important;
    color: #212529 !important;
}

.custom-notify[data-notify="container"] {
    margin: 0 0 0.5rem 0 !important;
}

.custom-notify .close-btn {
    float: left !important;
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
    background: transparent !important;
    border: none !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    padding: 0 !important;
    line-height: 1 !important;
}

.custom-notify .close-btn i {
    font-size: 1.25rem !important;
    color: #6c757d !important;
    transition: all 0.3s ease !important;
}

.custom-notify .close-btn:hover {
    background-color: #f8f9fa !important;
    transform: scale(1.1) !important;
}

.custom-notify .close-btn:hover i {
    color: #212529 !important;
}

.custom-notify [data-notify="title"] {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: #696cff !important;
    display: block !important;
    margin-bottom: 0.5rem !important;
}

.custom-notify [data-notify="message"] {
    font-size: 0.9rem !important;
    color: #6c757d !important;
    line-height: 1.5 !important;
    margin-top: 0.25rem !important;
}

.custom-notify [data-notify="icon"] {
    font-size: 1.5rem !important;
    margin-left: 0.75rem !important;
    margin-right: 0 !important;
    color: #28a745 !important;
}

.custom-notify.alert-success {
    background-color: #ffffff !important;
    color: #212529 !important;
}

/* تنسيقات صناديق رمز التحقق OTP */
.otp-input {
    border: 2px solid #d9dee3 !important;
    border-radius: 0.5rem !important;
    transition: all 0.3s ease !important;
    background-color: #ffffff !important;
}

.otp-input:focus {
    border-color: #696cff !important;
    box-shadow: 0 0 0 0.2rem rgba(105, 108, 255, 0.25) !important;
    outline: none !important;
    background-color: #f8f9fa !important;
}

.otp-input:not(:placeholder-shown) {
    border-color: #696cff !important;
    background-color: #f8f9fa !important;
}

.otp-input-container {
    margin: 1rem 0 !important;
}

.notification-item.unread {
    background-color: #f8f9fa;
    border-left: 3px solid #007bff;
}

.notification-item:hover {
    background-color: #f8f9fa;
}

.dropdown-menu .notification-item .dropdown-item {
    padding: 0.5rem 1rem;
}

.avatar-sm {
    width: 2rem;
    height: 2rem;
}

.avatar-sm .avatar-initial {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

/* إصلاح مشكلة الـ dropdown في الشاشات الصغيرة */
@media (max-width: 1199.98px) {

    /* السماح للـ dropdown بالظهور خارج الـ navbar - إزالة overflow من جميع العناصر */
    #layout-navbar.layout-navbar.container-xxl,
    nav.layout-navbar.container-xxl,
    .layout-navbar.container-xxl {
        overflow: visible !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
    }

    .layout-navbar {
        overflow: visible !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
    }

    .navbar-nav-right {
        overflow: visible !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
        position: relative;
    }

    .navbar-nav {
        overflow: visible !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
    }

    .nav-item {
        overflow: visible !important;
    }

    /* التأكد من أن الـ dropdown يظهر بشكل صحيح */
    .navbar-dropdown {
        position: static !important;
    }

    /* استخدام position: fixed للـ dropdown في الشاشات الصغيرة */
    .navbar-dropdown .dropdown-menu {
        position: fixed !important;
        z-index: 1055 !important;
        margin-top: 0.5rem;
        max-width: calc(100vw - 2rem);
        transform: none !important;
        will-change: transform, top, right;
    }

    /* إزالة overflow من layout-container و layout-wrapper */
    .layout-container {
        overflow-x: visible !important;
    }

    .layout-wrapper {
        overflow-x: visible !important;
    }

    /* تعديل عرض dropdown الإشعارات في الشاشات الصغيرة */
    .navbar-dropdown.dropdown-user .dropdown-menu {
        width: 90vw !important;
        max-width: 400px !important;
        min-width: 280px;
    }

    /* التأكد من أن الـ dropdown لا يقطع */
    .dropdown-menu {
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    }

    /* إزالة overflow من layout-page و content-wrapper */
    .layout-page {
        overflow-x: visible !important;
    }

    .content-wrapper {
        overflow-x: visible !important;
    }
}

/* للشاشات الصغيرة جداً */
@media (max-width: 575.98px) {
    .navbar-dropdown.dropdown-user .dropdown-menu {
        width: calc(100vw - 1rem) !important;
        max-width: calc(100vw - 1rem) !important;
        min-width: auto !important;
    }

    .navbar-dropdown .dropdown-menu {
        max-width: calc(100vw - 1rem) !important;
    }
}

/* زر الدعم الفني */
.btn-support-whatsapp {
    background-color: #25D366 !important;
    border-color: #25D366 !important;
    color: white !important;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    white-space: nowrap;
}

.btn-support-whatsapp:hover {
    background-color: #20BA5A !important;
    border-color: #20BA5A !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 211, 102, 0.3);
}

.btn-support-whatsapp i {
    color: white !important;
    font-size: 1.2rem;
}

.btn-support-whatsapp span {
    color: white !important;
}

/* تعديل الزر في الشاشات الصغيرة */
@media (max-width: 1199.98px) {
    .btn-support-whatsapp {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.875rem;
    }

    .navbar-nav-left .btn-support-whatsapp span {
        display: none;
    }

    .navbar-nav-left .btn-support-whatsapp i {
        font-size: 1.3rem;
    }
}

@media (max-width: 575.98px) {
    .btn-support-whatsapp {
        padding: 0.35rem 0.7rem !important;
    }
}

/* تنسيقات رسائل الخطأ في النماذج */
.invalid-feedback {
    display: block !important;
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #ea5455;
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
    text-align: right;
    animation: slideDown 0.3s ease-out;
}

.invalid-feedback i {
    font-size: 1rem;
    vertical-align: middle;
    margin-left: 0.25rem;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #ea5455 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23ea5455'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6 .4.4.4-.4m0 4.8h.8'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    background-size: 1rem 1rem;
    padding-left: 2.5rem;
    transition: all 0.3s ease;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #ea5455 !important;
    box-shadow: 0 0 0 0.2rem rgba(234, 84, 85, 0.25) !important;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تنسيقات رسائل النجاح والخطأ المخصصة */
.custom-message {
    margin-bottom: 1.5rem;
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
    animation: slideDown 0.3s ease-out;
}

.custom-message-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.1);
    position: relative;
}

.custom-message-error .custom-message-content {
    background-color: #fff5f5;
    border-right: 4px solid #ea5455;
}

.custom-message-success .custom-message-content {
    background-color: #f0f9ff;
    border-right: 4px solid #28a745;
}

.custom-message-icon {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.custom-message-error .custom-message-icon {
    background-color: #fee;
    color: #ea5455;
}

.custom-message-success .custom-message-icon {
    background-color: #e8f5e9;
    color: #28a745;
}

.custom-message-text {
    flex: 1;
    min-width: 0;
}

.custom-message-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #212529;
}

.custom-message-error .custom-message-title {
    color: #ea5455;
}

.custom-message-success .custom-message-title {
    color: #28a745;
}

.custom-message-body {
    font-size: 0.9rem;
    color: #6c757d;
    line-height: 1.6;
}

.custom-message-list {
    margin: 0;
    padding-right: 1.25rem;
    list-style: none;
}

.custom-message-list li {
    position: relative;
    padding-right: 1rem;
    margin-bottom: 0.5rem;
}

.custom-message-list li:before {
    content: "•";
    position: absolute;
    right: 0;
    color: #ea5455;
    font-weight: bold;
    font-size: 1.2rem;
}

.custom-message-list li:last-child {
    margin-bottom: 0;
}

.custom-message-close {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    color: #6c757d;
}

.custom-message-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #212529;
    transform: scale(1.1);
}

.custom-message-close i {
    font-size: 1.25rem;
}

/* تنسيقات صورة الموظف في الجدول */
.employee-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.employee-avatar:hover {
    border-color: #696cff;
    transform: scale(1.05);
}

.rating-value {
    min-width: 35px;
    color: #696cff;
    font-size: 0.95rem;
}

.rating-stars {
    display: flex;
    gap: 2px;
}

/* تنسيقات محسنة لمقدمة رقم الجوال السعودي */
.saudi-phone-input {
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: 0 0 0 0.0625rem rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.saudi-phone-input:focus-within {
    box-shadow: 0 0 0 0.125rem rgba(105, 108, 255, 0.25), 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    border-color: #696cff;
}

.saudi-phone-prefix {
    background: #ffffff !important;
    color: #212529 !important;
    font-weight: 600;
    font-size: 0.9375rem;
    border: none !important;
    border-right: 0.0625rem solid rgba(0, 0, 0, 0.1) !important;
    padding: 0.625rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 90px;
    justify-content: center;
    box-shadow: none;
    position: relative;
}

.saudi-flag {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    display: inline-block;
    vertical-align: middle;
    box-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1);
}

.saudi-code {
    letter-spacing: 0.05em;
    color: #495057;
}

.saudi-phone-input .form-control {
    border: none !important;
    border-left: 0.0625rem solid rgba(0, 0, 0, 0.1) !important;
    padding: 0.625rem 0.9375rem;
    font-size: 0.9375rem;
    transition: all 0.3s ease;
}

.saudi-phone-input .form-control:focus {
    border-color: transparent !important;
    box-shadow: none !important;
    background-color: #f8f9fa;
}

.saudi-phone-input:hover .saudi-phone-prefix {
    background: #f8f9fa !important;
}

@media (max-width: 576px) {
    .saudi-phone-prefix {
        min-width: 80px;
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
        gap: 0.375rem;
    }

    .saudi-flag {
        font-size: 1.125rem;
    }

    .saudi-code {
        font-size: 0.875rem;
    }
}

/* إصلاح مشكلة الجداول - منع المحتوى من الخروج خارج الجداول */
.table-responsive {
    display: block !important;
    width: 100% !important;
    overflow-x: scroll !important;
    overflow-y: visible !important;
    position: relative !important;
    max-width: 100% !important;
}

.table-responsive table {
    width: 100% !important;
    margin-bottom: 0 !important;
    table-layout: auto !important;
    word-wrap: break-word !important;
    max-width: 100% !important;
}

/* منع المحتوى من الخروج خارج الخلايا */
.table-responsive table td,
.table-responsive table th {
    overflow: hidden !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    max-width: 100% !important;
}

/* منع النصوص الطويلة من الخروج */
.table-responsive table td>div,
.table-responsive table td>span:not(.badge):not(.rating-value) {
    max-width: 100% !important;
    overflow: hidden !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
}

/* السماح للصور والأيقونات والـ badges بالظهور بشكل صحيح */
.table-responsive table td img,
.table-responsive table td .badge,
.table-responsive table td .dropdown,
.table-responsive table td .rating-stars,
.table-responsive table td .rating-value {
    flex-shrink: 0 !important;
    overflow: visible !important;
}

/* التأكد من أن الـ card يحتوي على الجدول */
.card .table-responsive {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

.card {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

/* منع overflow للصفحة في الشاشات الصغيرة */
@media (max-width: 991.98px) {

    html,
    body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    .layout-wrapper {
        overflow-x: hidden !important;
    }

    .layout-page {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }

    .content-wrapper {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }

    .container-xxl:not(.layout-navbar):not(nav) {
        overflow-x: hidden !important;
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* السماح للـ navbar بالظهور بشكل صحيح */
    .layout-navbar.container-xxl,
    nav.container-xxl,
    #layout-navbar.container-xxl {
        overflow: visible !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
    }

    /* التأكد من أن الجداول فقط لديها scroll */
    .card {
        overflow: visible !important;
        max-width: 100% !important;
    }

    .card-body {
        overflow: visible !important;
        padding: 1rem !important;
    }

    /* التأكد من أن table-responsive لا تحتوي على scroll ولا يخرج المحتوى */
    .table-responsive {
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        overflow-x: hidden !important;
        overflow-y: visible !important;
    }

    .table-responsive table {
        table-layout: auto !important;
        width: 100% !important;
    }

    .table-responsive table td,
    .table-responsive table th {
        max-width: 100% !important;
        overflow: hidden !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
    }
}

/* إزالة السهم التلقائي من قائمة الخدمات (السهم على اليسار) */
.menu-toggle::after {
    display: none !important;
}

/* تنسيق السهم المخصص على اليمين في قائمة الخدمات */
#services-chevron {
    font-size: 1rem;
    transition: transform 0.3s ease;
    margin-right: 66px;
}

/* تنسيق موحّد لقوائم الإجراءات (قائمة الثلاث نقاط) في كل الصفحات */
.table-actions-dropdown {
    position: relative !important;
}

.table-actions-dropdown>.btn {
    z-index: 1 !important;
}

.table-actions-menu {
    position: absolute !important;
    top: 100% !important;
    inset-inline-end: 0 !important;
    inset-inline-start: auto !important;
    margin-top: 0.25rem !important;
    min-width: 12rem !important;
    z-index: 2000 !important;
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.2) !important;
}

.table-actions-menu.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* التأكد أن خلايا الإجراءات تسمح للقائمة بالخروج فوق كل شيء */
.table-responsive table tbody tr td:last-child {
    position: relative !important;
    overflow: visible !important;
    white-space: normal !important;
}

/* جعل صور الأشخاص دائرية وموحّدة في كل الجداول */
.avatar-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
}

/* أزرار الإجراءات داخل الجداول (عرض / تعديل / حذف ...) */
.table-action-btn {
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: none;
}

.table-action-btn i {
    font-size: 0.95rem;
}

.table-action-btn-view {
    background-color: #f0f5ff;
    color: #4361ee;
}

.table-action-btn-edit {
    background-color: #fff4e5;
    color: #f59e0b;
}

.table-action-btn-delete {
    background-color: #fef2f2;
    color: #dc2626;
}

.table-action-btn-view:hover {
    background-color: #dbe4ff;
    color: #1d4ed8;
}

.table-action-btn-edit:hover {
    background-color: #ffedd5;
    color: #c2410c;
}

.table-action-btn-delete:hover {
    background-color: #fee2e2;
    color: #b91c1c;
}

.avatar-circle-lg {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
}

/* منع المحتوى من الخروج خارج الـ card في لوحة الحلاقين */
.partner .card,
.partner .card-body,
.content-wrapper .card,
.content-wrapper .card-body {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

/* معالجة خاصة للجداول مع text-nowrap - منع المحتوى من الخروج */
.table-responsive.text-nowrap {
    overflow-x: scroll !important;
}

.table-responsive.text-nowrap table {
    width: 100% !important;
    table-layout: auto !important;
}

.table-responsive.text-nowrap table td {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
}

/* السماح للخلايا الأخيرة (الإجراءات) بالظهور بشكل كامل */
.table-responsive table td:last-child {
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
}

/* إظهار أسهم حقل الرقم دائماً على الجوال */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1 !important;
    display: inline-block !important;
    height: 20px !important;
    width: 20px !important;
    margin: 0 !important;
    cursor: pointer !important;
}

/* إظهار الأسهم على Firefox */
input[type="number"] {
    -moz-appearance: textfield !important;
}

input[type="number"]::-moz-number-spin-box {
    opacity: 1 !important;
}

input[type="number"]::-moz-number-spin-up,
input[type="number"]::-moz-number-spin-down {
    opacity: 1 !important;
    height: 15px !important;
}