/**
 * RTL (Right-to-Left) Styles for Peligent for WooCommerce
 * This file contains styles to properly display the plugin interface in RTL languages
 * 
 * Note: These styles are loaded only when is_rtl() returns true
 */

/* Main container */
.peligent-settings-wrap {
    direction: rtl;
}

/* Header */
.peligent-header {
    flex-direction: row-reverse;
}

.peligent-title {
    flex-direction: row-reverse;
}

.peligent-icon {
    order: 2;
}

/* Status badge */
.peligent-status-badge {
    flex-direction: row-reverse;
}

/* Form elements */
.peligent-form-label {
    text-align: right;
}

.peligent-required {
    margin-left: 0;
    margin-right: 4px;
}

.peligent-input-wrapper {
    direction: ltr; /* Keep input direction LTR for technical values */
}

.peligent-form-input {
    text-align: right;
    padding: 10px 12px 10px 40px;
}

.peligent-input-status {
    right: auto;
    left: 12px;
}

.peligent-form-help {
    flex-direction: row-reverse;
    text-align: right;
}

/* Buttons */
.peligent-button {
    flex-direction: row-reverse;
}

.peligent-form-actions {
    text-align: right;
}

/* Status items */
.peligent-status-item {
    flex-direction: row-reverse;
}

.peligent-status-content {
    text-align: right;
}

.peligent-status-content strong {
    text-align: right;
}

.peligent-status-content p {
    text-align: right;
}

/* User list */
.peligent-user-item {
    flex-direction: row-reverse;
    text-align: right;
}

.peligent-user-info {
    text-align: right;
}

/* Empty state */
.peligent-empty-state {
    text-align: center; /* Keep center for empty states */
}

/* Section title */
.peligent-section-title {
    text-align: right;
}

/* Card description */
.peligent-card-description {
    text-align: right;
}

/* Tab navigation */
.peligent-tab-nav {
    flex-direction: row-reverse;
}

.peligent-tab-link {
    flex-direction: row-reverse;
}

/* Card title */
.peligent-card-title {
    flex-direction: row-reverse;
}

/* Onboarding modal RTL styles */
.peligent-onboarding-modal {
    direction: rtl;
}

.peligent-onboarding-header {
    flex-direction: row-reverse;
}

.peligent-onboarding-close {
    left: 20px;
    right: auto;
}

.peligent-onboarding-content {
    text-align: right;
}

.peligent-onboarding-step-title {
    text-align: right;
}

.peligent-onboarding-step-description {
    text-align: right;
}

.peligent-onboarding-step-list {
    text-align: right;
}

.peligent-onboarding-step-list li {
    text-align: right;
    padding-right: 24px;
    padding-left: 0;
}

.peligent-onboarding-step-list li::before {
    right: 0;
    left: auto;
}

.peligent-onboarding-field-label {
    text-align: right;
}

.peligent-onboarding-field-input {
    text-align: right;
    direction: ltr; /* Keep input direction LTR for technical values */
}

.peligent-onboarding-field-status {
    left: 12px;
    right: auto;
}

.peligent-onboarding-field-help {
    flex-direction: row-reverse;
    text-align: right;
}

.peligent-onboarding-footer {
    flex-direction: row-reverse;
}

.peligent-onboarding-button {
    flex-direction: row-reverse;
}

.peligent-onboarding-dashboard-button {
    text-align: right;
}

/* Progress bar */
.peligent-onboarding-progress {
    direction: ltr; /* Keep progress bar LTR */
}

/* Step indicators */
.peligent-onboarding-steps {
    flex-direction: row-reverse;
}

/* Sidebar RTL styles */
.peligent-ai-fixed-sidebar {
    right: auto !important;
    left: 0 !important;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1) !important;
    border-left: 0 !important;
    border-right: 1px solid #e5e7eb !important;
    transition: width 0.2s ease, left 0.2s ease !important;
}

.peligent-ai-fixed-sidebar.peligent-ai-fullscreen {
    left: 0 !important;
    right: 0 !important;
}

.peligent-ai-resize-handle {
    left: auto !important;
    right: 0 !important;
}

/* Adjust WordPress admin content margin for RTL */
/* In RTL: WordPress menu is on the right, Peligent sidebar is on the left */
body.wp-admin:not(.peligent-ai-sidebar-hidden) #wpcontent,
body.wp-admin:not(.peligent-ai-sidebar-hidden) #wpbody-content {
    /* Add margin-left for Peligent sidebar */
    margin-left: 480px !important;
    transition: margin-left 0.2s ease, margin-right 0.2s ease !important;
}

body.wp-admin.folded:not(.peligent-ai-sidebar-hidden) #wpcontent,
body.wp-admin.folded:not(.peligent-ai-sidebar-hidden) #wpbody-content {
    /* WordPress menu is 36px when folded */
    margin-right: 36px !important;
    margin-left: 480px !important;
}

body.wp-admin.peligent-ai-sidebar-hidden #wpcontent,
body.wp-admin.peligent-ai-sidebar-hidden #wpbody-content {
    /* When Peligent sidebar is hidden, keep WordPress menu margin */
    margin-left: 0 !important;
}

body.wp-admin.folded.peligent-ai-sidebar-hidden #wpcontent,
body.wp-admin.folded.peligent-ai-sidebar-hidden #wpbody-content {
    margin-right: 36px !important;
}

body.wp-admin.peligent-ai-fullscreen #wpcontent,
body.wp-admin.peligent-ai-fullscreen #wpbody-content {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

body:not(.peligent-ai-sidebar-hidden):not(.peligent-ai-fullscreen) .media-modal {
    right: auto !important;
    left: 520px !important;
}

/* Sidebar header RTL */
.peligent-ai-sidebar-header > div {
    flex-direction: row-reverse !important;
}

.peligent-ai-sidebar-header > div > div:first-child {
    flex-direction: row-reverse !important;
}

.peligent-ai-sidebar-header > div > div:last-child {
    flex-direction: row-reverse !important;
}

/* Responsive adjustments for RTL */
@media (max-width: 782px) {
    .peligent-header {
        flex-direction: column;
    }
    
    .peligent-status-badge {
        align-self: flex-start;
        margin-top: 16px;
    }
    
    .peligent-tab-nav {
        flex-direction: row-reverse;
    }
    
    /* Hide sidebar on mobile */
    .peligent-ai-fixed-sidebar {
        display: none !important;
    }
    
    /* Remove Peligent sidebar margin on mobile, but keep WordPress menu margin */
    body.wp-admin #wpcontent,
    body.wp-admin #wpbody-content {
        margin-left: 0 !important;
    }
    
    body.wp-admin.folded #wpcontent,
    body.wp-admin.folded #wpbody-content {
        margin-right: 36px !important;
    }
    
    .media-modal {
        left: 0 !important;
        right: 0 !important;
    }
}

/* Floating fullscreen exit bar — position on left in RTL */
.peligent-ai-fixed-sidebar.peligent-ai-fullscreen .peligent-ai-fullscreen-bar {
    right: auto !important;
    left: 12px !important;
}
