/* RTL Support for Arabic Language */

/* Base RTL Layout */
.rtl {
    direction: rtl !important;
    text-align: right !important;
}

.rtl * {
    direction: inherit;
}

/* Logo RTL Support */
.rtl .logo-svg {
    direction: ltr !important; /* Keep SVG direction as LTR for proper rendering */
}

.rtl .header-logo {
    margin-left: 0 !important;
    margin-right: auto !important;
    /* Ensure logo is properly positioned in RTL header */
    order: 3 !important;
}

.rtl .footer-logo {
    margin-left: 0 !important;
    margin-right: auto !important;
}

.rtl .error-logo {
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* Logo container RTL */
.rtl .logo-container {
    text-align: right !important;
}

.rtl .navbar-brand {
    margin-right: 0 !important;
    margin-left: 1rem !important;
}

/* Section Titles RTL - More Specific */
.rtl .section-title,
.rtl h1.section-title,
.rtl h2.section-title,
.rtl h3.section-title,
.rtl .home-page .section-title,
.rtl .container .section-title,
.rtl .row .section-title,
.rtl .featured-section .section-title,
.rtl .main-content .section-title {
    text-align: right !important;
    direction: rtl !important;
    float: right !important;
    display: block !important;
    width: 100% !important;
}

/* All Headings RTL - More Specific */
.rtl h1, 
.rtl h2, 
.rtl h3, 
.rtl h4, 
.rtl h5, 
.rtl h6,
.rtl .home-page h1,
.rtl .home-page h2,
.rtl .home-page h3,
.rtl .container h1,
.rtl .container h2,
.rtl .container h3,
.rtl .row h1,
.rtl .row h2,
.rtl .row h3,
.rtl .featured-section h2,
.rtl .main-content h2 {
    text-align: right !important;
    direction: rtl !important;
}

/* Product Titles RTL */
.rtl .product-title,
.rtl .card-title,
.rtl .product-card h3,
.rtl .product-card .card-title {
    text-align: right !important;
    direction: rtl !important;
}

/* Card Content RTL */
.rtl .card-content,
.rtl .product-card .card-content,
.rtl .card-body {
    text-align: right !important;
    direction: rtl !important;
}

.rtl .card-content h3,
.rtl .card-body h3,
.rtl .product-card .card-content h3 {
    text-align: right !important;
    direction: rtl !important;
}

/* Product Meta RTL */
.rtl .product-meta,
.rtl .product-card .product-meta {
    flex-direction: row-reverse !important;
    text-align: right !important;
}

.rtl .product-meta span,
.rtl .product-card .product-meta span {
    text-align: right !important;
}

/* Header RTL Adjustments */
.rtl .header-content {
    flex-direction: row-reverse !important;
}

.rtl .search-container {
    order: 2 !important;
}

.rtl .header-user-actions {
    order: 1 !important;
}

/* Logo positioning in RTL header */
.rtl .logo {
    order: 3 !important;
    margin-left: 0 !important;
    margin-right: auto !important;
}

.rtl .trust-bar .d-flex {
    flex-direction: row-reverse !important;
}

.rtl .trust-features {
    flex-direction: row-reverse !important;
}

.rtl .language-selector .dropdown-menu {
    right: auto !important;
    left: 0 !important;
}

/* Navigation RTL */
.rtl .nav-list {
    flex-direction: row-reverse !important;
}

.rtl .dropdown-menu {
    right: auto !important;
    left: 0 !important;
    text-align: right !important;
}

.rtl .dropdown-item {
    text-align: right !important;
}

.rtl .dropdown-item i,
.rtl .dropdown-item img {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

.rtl .dropdown-item .fas.fa-arrow-right {
    transform: rotate(180deg) !important;
}

/* Cards Grid RTL */
.rtl .cards-grid {
    direction: rtl !important;
}

.rtl .product-card {
    direction: ltr !important;
}

/* Buttons RTL */
.rtl .btn i {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

.rtl .btn-outline-primary i {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

/* Footer RTL */
.rtl .footer-content {
    flex-direction: row-reverse !important;
}

.rtl .footer-links ul {
    padding-right: 0 !important;
    padding-left: 0 !important;
}

.rtl .footer-links li {
    text-align: right !important;
}

/* Section Headers RTL */
.rtl .section-header {
    flex-direction: row-reverse !important;
}

.rtl .section-footer {
    text-align: center !important;
}

/* Trust Bar RTL */
.rtl .trust-rating {
    flex-direction: row-reverse !important;
}

.rtl .rating-stars {
    flex-direction: row-reverse !important;
}

/* Language Selector RTL */
.rtl .language-selector .lang-current {
    flex-direction: row-reverse !important;
}

.rtl .language-selector .lang-current i {
    margin-left: 0 !important;
    margin-right: 0.5rem !important;
    transform: rotate(180deg) !important;
}

.rtl .lang-option {
    flex-direction: row-reverse !important;
}

.rtl .lang-option img {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

/* Theme Selector RTL */
.rtl .theme-selector {
    order: -1 !important;
}

/* Search Box RTL */
.rtl .search-box {
    flex-direction: row-reverse !important;
}

.rtl .search-icon {
    margin-left: 0 !important;
    margin-right: 0.5rem !important;
}

/* Status Badge RTL */
.rtl .status-badge {
    left: auto !important;
    right: 0.5rem !important;
}

/* Modal RTL */
.rtl .modal-header .btn-close,
.rtl .modal-header .btn-close-white {
    margin: 0 !important;
    margin-left: auto !important;
    margin-right: 0 !important;
}

.rtl .modal-header {
    flex-direction: row-reverse !important;
}

.rtl .modal-header .modal-title {
    margin-left: 0 !important;
    margin-right: auto !important;
}

.rtl .modal-footer {
    flex-direction: row-reverse !important;
}

/* Alert RTL */
.rtl .alert {
    text-align: right !important;
}

.rtl .alert .btn-close {
    margin: 0 !important;
    margin-right: auto !important;
}

/* Form Controls RTL */
.rtl .form-control {
    text-align: right !important;
}

.rtl .form-label {
    text-align: right !important;
}

/* Dropdown RTL */
.rtl .dropdown-toggle::after {
    margin-left: 0 !important;
    margin-right: 0.255em !important;
}

/* Pagination RTL */
.rtl .pagination {
    flex-direction: row-reverse !important;
}

.rtl .page-link {
    margin-left: 0 !important;
    margin-right: -1px !important;
}

/* Breadcrumb RTL */
.rtl .breadcrumb-item + .breadcrumb-item::before {
    padding-left: 0 !important;
    padding-right: 0.5rem !important;
}

/* List Group RTL */
.rtl .list-group-item {
    text-align: right !important;
}

/* Badge RTL */
.rtl .badge {
    margin-left: 0 !important;
    margin-right: 0.25rem !important;
}

/* Input Group RTL */
.rtl .input-group > .form-control {
    border-radius: 0 0.375rem 0.375rem 0 !important;
}

.rtl .input-group > .btn {
    border-radius: 0.375rem 0 0 0.375rem !important;
}

/* Card RTL */
.rtl .card-header {
    text-align: right !important;
}

.rtl .card-footer {
    text-align: right !important;
}

/* Table RTL */
.rtl .table th,
.rtl .table td {
    text-align: right !important;
}

/* Progress Bar RTL */
.rtl .progress-bar {
    float: right !important;
}

/* Tooltip RTL */
.rtl .tooltip {
    text-align: right !important;
}

/* Popover RTL */
.rtl .popover {
    text-align: right !important;
}

/* Responsive RTL Adjustments */
@media (max-width: 768px) {
    .rtl .header-content {
        flex-direction: column !important;
    }
    
    .rtl .nav-list {
        flex-direction: column !important;
    }
    
    .rtl .footer-content {
        flex-direction: column !important;
    }
    
    .rtl .section-header {
        flex-direction: column !important;
    }
    
    .rtl .trust-bar .d-flex {
        flex-direction: column !important;
    }
}

/* Animation RTL */
.rtl .fade-left {
    animation-name: fadeRight !important;
}

.rtl .fade-right {
    animation-name: fadeLeft !important;
}

@keyframes fadeRight {
    from {
        opacity: 0;
        transform: translate3d(100%, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeLeft {
    from {
        opacity: 0;
        transform: translate3d(-100%, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Exception: user profile dropdown should always be centered under the button in RTL */
.rtl .user-dropdown .dropdown-menu {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%);
    text-align: right !important;
    direction: rtl !important;
} 