/* =====================================================
   CardMe Profiles - Full RTL Overrides
   Version: 3.2.0
   ===================================================== */

/* Global RTL Fixes */
body.rtl .cm-wrap,
body.rtl .cm-dash-wrap,
body.rtl .cp-auth-wrapper,
body.rtl .cm-dash-tabs,
body.rtl .cm-rescue-modal {
    direction: rtl;
    text-align: right;
}

/* Typography for Arabic */
body.rtl .cm-wrap,
body.rtl .cm-dash-wrap,
body.rtl .cp-auth-wrapper,
body.rtl .cm-rescue-modal {
    font-family: 'Cairo', 'Tajawal', system-ui, -apple-system, sans-serif;
}

/* Mobile Sidebar & Floating Menu */
body.rtl .cm-mobile-nav-wrap {
    right: auto;
    left: 0;
    justify-content: flex-start;
}

body.rtl .cm-mobile-nav {
    border-radius: 0 20px 20px 0;
    border-right: 1px solid var(--cp-border);
    border-left: none;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.1);
}

body.rtl .cm-mobile-nav-toggle.rotated i {
    transform: rotate(0deg); /* Flip back in RTL */
}

body.rtl .cm-mobile-nav-toggle i {
    transform: rotate(180deg);
}

body.rtl .cm-dash-tab-mobile i {
    margin-right: 0;
    margin-left: 15px;
}

body.rtl .cm-mobile-nav:not(.expanded) .cm-dash-tab-mobile i {
    margin-left: 0;
}

body.rtl .cm-dash-tab-mobile.active {
    border-right: none;
    border-left: 3px solid var(--cp-primary);
}

body.rtl .cm-floating-menu {
    left: auto;
    right: 50%;
    transform: translateX(50%);
}

/* Dashboard Header */
body.rtl .cm-dash-profile {
    flex-direction: row;
}

body.rtl .cm-dash-info {
    margin-right: var(--cp-space-6);
    margin-left: 0;
}

body.rtl .cm-dash-info h1,
body.rtl .cm-dash-info .job,
body.rtl .cm-dash-info .company {
    text-align: right;
}

/* Dashboard Tabs */
body.rtl .cm-dash-tab {
    text-align: right;
}

body.rtl .cm-dash-tab .cm-tab-badge {
    margin-left: 0;
    margin-right: var(--cp-space-2);
}

/* Stats Grid */
body.rtl .cm-stat-card {
    text-align: center;
}

/* Info Rows & Tables */
body.rtl .cm-info-row {
    flex-direction: row;
}

body.rtl .cm-info-label {
    text-align: right;
    padding-left: var(--cp-space-4);
    padding-right: 0;
}

body.rtl .cm-info-value {
    text-align: right;
}

body.rtl .cm-location-table th,
body.rtl .cm-location-table td {
    text-align: right;
}

body.rtl .cm-location-table th {
    text-align: right;
}

/* Social Links */
body.rtl .cm-social-links,
body.rtl .cm-actions,
body.rtl .cm-socials {
    flex-direction: row;
    justify-content: center;
}

/* Forms (Auth & Edit Profile) */
body.rtl .cp-form label,
body.rtl .cm-rescue-form-group label {
    text-align: right;
}

body.rtl .cp-form input[type="text"],
body.rtl .cp-form input[type="email"],
body.rtl .cp-form input[type="password"],
body.rtl .cp-form input[type="url"],
body.rtl .cp-form select,
body.rtl .cm-rescue-form-group input,
body.rtl .cm-rescue-form-group textarea {
    text-align: right;
    direction: rtl;
}

body.rtl .cp-checkbox-label {
    flex-direction: row;
    justify-content: flex-start;
}

body.rtl .cp-checkbox-label input {
    margin-left: var(--cp-space-2);
    margin-right: 0;
}

/* Edit Profile Specifics */
body.rtl .cp-avatar-wrapper {
    flex-direction: row;
}

body.rtl .cp-avatar-actions {
    text-align: right;
}

body.rtl .cp-avatar-actions .button {
    margin: var(--cp-space-1) 0 var(--cp-space-1) var(--cp-space-2);
}

body.rtl .cover-placeholder {
    text-align: center;
}

/* Modals & Alerts */
body.rtl .cm-alert {
    flex-direction: row;
}

body.rtl .cm-rescue-modal-header h3 {
    text-align: right;
}

/* Fix Inputs inline styles from Edit Profile */
body.rtl input[name="phone_primary"],
body.rtl input[name="phone_secondary"],
body.rtl input[name="whatsapp_number"],
body.rtl input[name="first_name"],
body.rtl input[name="last_name"],
body.rtl input[name="job_title"],
body.rtl input[name="company"],
body.rtl input[name="public_email"],
body.rtl input[name="website"] {
    text-align: right !important;
    padding-right: 16px !important;
    padding-left: 16px !important;
}

/* Social Media Settings table in Edit Profile */
body.rtl table[style*="width:100%"] td {
    text-align: right;
}

body.rtl table[style*="width:100%"] input[type="url"] {
    text-align: right;
}

/* Chart Filters */
body.rtl .cm-chart-filters {
    flex-direction: row;
}

/* Public Profile Adjustments */
body.rtl .cm-qr-box,
body.rtl .cp-auth-content {
    text-align: center;
}

body.rtl .cp-auth-tab {
    text-align: center;
}

body.rtl .cm-footer {
    text-align: center;
}

/* Mobile Sidebar Text Align */
@media (max-width: 991px) {
    body.rtl .cm-dash-tab-mobile {
        text-align: right;
    }
    
    body.rtl .cm-dash-profile {
        text-align: right;
    }
}