/**
 * BookWellNow admin RTL overrides.
 * Loaded when WordPress locale direction is RTL.
 * All rules are scoped under .bookwellab_page_wrapper-rtl
 */

/* -------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------- */
.bookwellab_page_wrapper-rtl {
    direction: rtl;
    text-align: right;
}

.bookwellab_page_wrapper-rtl .bw-branding-header {
    left: auto !important;
    right: 0 !important;
    flex-direction: row-reverse;
}

.bookwellab_page_wrapper-rtl .bw-admin-head .bw-mlc-left {
    text-align: right;
}

/* Header action buttons (Add Appointment, Add New, Add Service, etc.) — align left in RTL */
.bookwellab_page_wrapper-rtl .bw-admin-head .bw-right-align {
    justify-content: flex-end !important;
}

.bookwellab_page_wrapper-rtl .bw-services-page .bw-admin-head .bw-right-align {
    gap: 12px;
}

.bookwellab_page_wrapper-rtl .bw-services-page .bw-services-manage-categories-btn.el-button {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

.bookwellab_page_wrapper-rtl .bw-appointments-primary-btn svg,
.bookwellab_page_wrapper-rtl .bw-customers-primary-btn svg {
    margin-right: 0 !important;
    margin-left: 5px;
}

/* -------------------------------------------------------------------------
   Shortcode generator
   ------------------------------------------------------------------------- */
.bookwellab_page_wrapper-rtl .bw-shortcode-generator-page-v2 .bw-sc-shortcode-bar {
    grid-template-columns: 1fr auto;
    gap: 0;
    overflow: hidden;
}

.bookwellab_page_wrapper-rtl .bw-shortcode-generator-page-v2 .bw-sc-code-wrap {
    border-left: none;
    border-right: 5px solid #5700b4;
    border-top: 1px solid #e8dff8;
    border-bottom: 1px solid #e8dff8;
    border-radius: 0 10px 10px 0;
    padding: 0 18px 0 16px;
}

.bookwellab_page_wrapper-rtl .bw-shortcode-generator-page-v2 .bw-sc-copy-btn {
    border-radius: 10px 0 0 10px !important;
    border-right: 1px solid #5700b4 !important;
    border-left: none !important;
}

.bookwellab_page_wrapper-rtl .bw-shortcode-generator-page-v2 .bw-sc-behavior-alert.el-alert {
    flex-direction: row-reverse;
    text-align: right;
}

.bookwellab_page_wrapper-rtl .bw-shortcode-generator-page-v2 .bw-sc-behavior-alert.el-alert--info .el-alert__icon {
    margin-right: 0;
    margin-left: 4px;
}

.bookwellab_page_wrapper-rtl .bw-shortcode-generator-page-v2 .bw-sc-behavior-alert.el-alert--success .el-alert__icon {
    margin-right: 0;
    margin-left: 8px;
}

/* Success / error toasts — Element Plus teleports to body; scope via admin page + RTL wrapper */
body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-message {
    left: 20px;
    right: auto;
    top: 28px;
    transform: none;
    gap: 12px;
    flex-direction: row-reverse;
}

body.bookwellab-admin-page.admin-bar:has(.bookwellab_page_wrapper-rtl) .el-message {
    top: 52px;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-message-fade-enter-from,
body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-message-fade-leave-to {
    opacity: 0;
    transform: translateY(-100%);
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-notification,
body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-notification.right {
    left: 20px !important;
    right: auto !important;
    margin-top: 8px;
    direction: rtl;
    text-align: right;
    gap: 12px;
    padding-left: 42px;
    padding-right: 14px;
}

body.bookwellab-admin-page.admin-bar:has(.bookwellab_page_wrapper-rtl) .el-notification,
body.bookwellab-admin-page.admin-bar:has(.bookwellab_page_wrapper-rtl) .el-notification.right {
    margin-top: 40px;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-notification-fade-enter-from.right {
    left: 0;
    right: auto;
    transform: translateX(-100%);
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-notification__group {
    margin-left: var(--el-notification-group-margin-right, 8px);
    margin-right: var(--el-notification-group-margin-left, 13px);
}

/* Status icon ↔ close button spacing in RTL */
body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-notification .el-notification__closeBtn {
    left: 15px;
    right: auto;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-notification .el-notification__icon {
    margin-left: 8px;
    margin-right: 0;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-message .el-message__closeBtn {
    margin-left: 8px;
    margin-right: 0;
}

/* WP admin bar — mobile height 46px */
@media screen and (max-width: 782px) {
    body.bookwellab-admin-page.admin-bar:has(.bookwellab_page_wrapper-rtl) .el-message {
        top: 66px;
    }

    body.bookwellab-admin-page.admin-bar:has(.bookwellab_page_wrapper-rtl) .el-notification,
    body.bookwellab-admin-page.admin-bar:has(.bookwellab_page_wrapper-rtl) .el-notification.right {
        margin-top: 54px;
    }
}

/* -------------------------------------------------------------------------
   Calendar — flip navigation arrows for RTL
   ------------------------------------------------------------------------- */
.bookwellab_page_wrapper-rtl .bw-cal-nav-btn .dashicons-arrow-left-alt2,
.bookwellab_page_wrapper-rtl .bw-cal-nav-btn .dashicons-arrow-right-alt2 {
    transform: scaleX(-1);
}

.bookwellab_page_wrapper-rtl .bw-calendar-header-toolbar,
.bookwellab_page_wrapper-rtl .bw-calendar-controls,
.bookwellab_page_wrapper-rtl .bw-cal-day-toolbar {
    direction: rtl;
}

.bookwellab_page_wrapper-rtl .bw-cal-day-strip-wrap {
    direction: rtl;
}

.bookwellab_page_wrapper-rtl .bw-calendar-navigation {
    gap: 16px;
}

.bookwellab_page_wrapper-rtl .bw-cal-day-toolbar-right {
    gap: 10px;
    flex-wrap: nowrap;
}

/* -------------------------------------------------------------------------
   Tables — action button spacing (edit / delete)
   ------------------------------------------------------------------------- */
.bookwellab_page_wrapper-rtl .bw-appointments-page .bw-appointments-table-wrap .bw-appointments-table td.bw-actions-column .cell,
.bookwellab_page_wrapper-rtl .bw-appointments-page .bw-appointments-table-wrap .bw-appointments-table td.el-table__cell:has(.el-button.is-circle) .cell,
.bookwellab_page_wrapper-rtl .bw-services-page .bw-services-table td.el-table__cell:has(.el-button.is-circle) .cell,
.bookwellab_page_wrapper-rtl .bw-services-page .bw-services-table .el-table__fixed-right td.el-table__cell:has(.el-button.is-circle) .cell,
.bookwellab_page_wrapper-rtl .bw-customers-page .bw-customers-table-wrap .bw-custom-table td.el-table__cell:has(.el-button.is-circle) .cell,
.bookwellab_page_wrapper-rtl .bw-staff-page .bw-staff-table-wrap .bw-staff-table td.el-table__cell:has(.el-button.is-circle) .cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.bookwellab_page_wrapper-rtl .bw-svc-mobile-actions,
.bookwellab_page_wrapper-rtl .bw-customer-mobile-actions,
.bookwellab_page_wrapper-rtl .bw-appt-mobile-actions,
.bookwellab_page_wrapper-rtl .bw-staff-mobile-actions {
    gap: 10px;
}

.bookwellab_page_wrapper-rtl .bw-category-action-buttons {
    gap: 10px;
}

/* -------------------------------------------------------------------------
   General admin UI
   ------------------------------------------------------------------------- */
.bookwellab_page_wrapper-rtl .bw-service-drawer-footer,
.bookwellab_page_wrapper-rtl .bw-dialog-footer {
    flex-direction: row-reverse;
}

.bookwellab_page_wrapper-rtl .bw-main-drawer.el-overlay {
    direction: rtl;
}

/* Shift management drawer — teleported to body; scope via admin page + RTL wrapper */
body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer,
body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-overlay.bw-main-drawer .bw-shifts-drawer {
    direction: rtl;
    text-align: right;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer .bw-shifts-drawer-title {
    text-align: right;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer .bw-shift-row {
    gap: 12px;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer .bw-shift-day {
    flex: 0 0 auto;
    min-width: 90px;
    text-align: right;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer .bw-shift-times {
    flex: 0 1 auto;
    justify-content: flex-start;
    gap: 12px;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer .bw-shift-actions {
    flex: 0 0 auto;
    margin-inline-start: auto;
    justify-content: flex-start;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer .bw-shift-off-text {
    margin-left: 0;
    margin-right: 10px;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer .bw-break-list {
    padding-left: 0;
    padding-right: 90px;
    text-align: right;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer .bw-break-item {
    margin-right: 0;
    margin-left: 10px;
    padding: 6px 8px 6px 18px;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer .bw-break-remove {
    right: auto;
    left: -6px;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer .bw-shifts-drawer-footer {
    flex-direction: row-reverse;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer .el-switch {
    gap: 10px;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer .el-switch .el-switch__label--left {
    margin-right: 0;
    margin-inline-end: 10px;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .bw-shifts-drawer .el-switch .el-switch__label--right {
    margin-left: 0;
    margin-inline-start: 10px;
}

/* Break dialog — space between Cancel and Confirm (teleported to body) */
body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-dialog__footer,
body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-dialog__footer .dialog-footer,
body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-dialog__footer .bw-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    flex-direction: row-reverse;
}

body.bookwellab-admin-page:has(.bookwellab_page_wrapper-rtl) .el-dialog__footer .el-button {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.bookwellab_page_wrapper-rtl .el-form-item__label {
    text-align: right;
}

.bookwellab_page_wrapper-rtl .el-table th.el-table__cell,
.bookwellab_page_wrapper-rtl .el-table td.el-table__cell {
    text-align: right;
}

.bookwellab_page_wrapper-rtl .bw-dashboard-section-title {
    text-align: right;
}

.bookwellab_page_wrapper-rtl .el-pagination {
    direction: rtl;
}

.bookwellab_page_wrapper-rtl .el-tabs__nav {
    float: right;
}

.bookwellab_page_wrapper-rtl .book-now-adm--container-settings .bw-settings-tabs.el-tabs--left .el-tabs__item.is-left {
    text-align: right;
    justify-content: flex-end;
}

.bookwellab_page_wrapper-rtl .book-now-adm--container-settings .bw-settings-tabs.el-tabs--left .el-tabs__item.is-left .bw-settings-tab-label {
    flex-direction: row-reverse;
}

/* Notifications — space between sub-tabs (To Customer / To Staff Member) */
.bookwellab_page_wrapper-rtl .bw-notifications-page .bw-notifications-sub-tabs .el-tabs__nav {
    gap: 24px;
}

.bookwellab_page_wrapper-rtl .bw-notifications-page .bw-notifications-sub-tabs .el-tabs__item {
    padding: 0 8px;
}

.bookwellab_page_wrapper-rtl .bw-notifications-page .bw-notifications-sidebar {
    border-right: 0;
    border-left: 1px solid #e8dff5;
}

.bookwellab_page_wrapper-rtl .bw-notifications-page .bw-notifications-sidebar-item {
    text-align: right;
    flex-direction: row-reverse;
}

.bookwellab_page_wrapper-rtl .bw-category-action-buttons .el-button--small [class*=el-icon]+span {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

@media (max-width: 991px) {
    .bookwellab_page_wrapper-rtl .bw-shortcode-generator-page-v2 .bw-sc-shortcode-bar {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .bookwellab_page_wrapper-rtl .bw-shortcode-generator-page-v2 .bw-sc-code-wrap {
        border-radius: 10px 10px 0 0;
        border-right: 1px solid #e8dff8;
        border-left: none;
    }

    .bookwellab_page_wrapper-rtl .bw-shortcode-generator-page-v2 .bw-sc-copy-btn {
        width: 100%;
        justify-content: center;
        border-radius: 0 0 10px 10px !important;
        border-left: 1px solid #5700b4 !important;
        border-right: 1px solid #5700b4 !important;
        margin-top: 10px;
    }
}
