/* RTL Enhancements for Better Arabic Support */

/* ============================================
   GLOBAL ICON FIX FOR RTL
   ============================================ */
/* Fix all FontAwesome icons in RTL */
html[dir="rtl"] .fa,
html[dir="rtl"] [class^="fa-"],
html[dir="rtl"] [class*=" fa-"] {
    font-family: 'FontAwesome' !important;
    font-style: normal !important;
    display: inline-block !important;
}

/* Ensure icons are visible */
html[dir="rtl"] i.fa,
html[dir="rtl"] i[class^="fa-"],
html[dir="rtl"] i[class*=" fa-"] {
    font-family: 'FontAwesome' !important;
    font-style: normal !important;
    font-weight: normal !important;
    font-variant: normal !important;
    text-transform: none !important;
    line-height: 1 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* ============================================
   GLOBAL BUTTON FIX FOR RTL
   ============================================ */
/* Override all button gradients and colors in RTL */
html[dir="rtl"] .btn,
html[dir="rtl"] .button,
html[dir="rtl"] .btn-primary,
html[dir="rtl"] .btn-default,
html[dir="rtl"] button[type="submit"],
html[dir="rtl"] .action.btn-cart {
    background: #01A0BE !important;
    background-image: none !important;
    background-color: #01A0BE !important;
    color: white !important;
    border: 2px solid #01A0BE !important;
}

html[dir="rtl"] .btn:hover,
html[dir="rtl"] .button:hover,
html[dir="rtl"] .btn-primary:hover,
html[dir="rtl"] .btn-default:hover,
html[dir="rtl"] button[type="submit"]:hover,
html[dir="rtl"] .action.btn-cart:hover {
    background: white !important;
    background-image: none !important;
    background-color: white !important;
    color: #01A0BE !important;
    border-color: #01A0BE !important;
}

/* Fix button icons spacing in RTL */
html[dir="rtl"] .btn i,
html[dir="rtl"] .button i {
    margin-left: 5px;
    margin-right: 0;
}

html[dir="ltr"] .btn i,
html[dir="ltr"] .button i {
    margin-right: 5px;
    margin-left: 0;
}

/* Custom RTL Classes for Header */
html[dir="rtl"] .rtl-header .nav-right-rtl {
    float: right !important;
}

html[dir="rtl"] .rtl-header .nav-left-rtl {
    float: left !important;
}

html[dir="rtl"] .rtl-header .nav-mind-rtl {
    text-align: right;
}

html[dir="rtl"] .rtl-header .ui-menu-rtl {
    text-align: right;
}

html[dir="rtl"] .rtl-header .ui-menu-rtl > li {
    float: right;
}

html[dir="rtl"] .rtl-header .megamenu-rtl {
    right: 0;
    left: auto;
    text-align: right;
}

html[dir="rtl"] .rtl-header .megamenu-rtl .col-md-3 {
    text-align: right;
}

html[dir="rtl"] .rtl-header .megamenu-rtl .img-categori {
    text-align: center;
}

html[dir="rtl"] .rtl-header .megamenu-rtl .title {
    text-align: right;
}

html[dir="rtl"] .rtl-header .megamenu-rtl .list-submenu {
    text-align: right;
}

html[dir="rtl"] .rtl-header .megamenu-rtl .list-submenu li {
    text-align: right;
}

/* Language Switcher Enhancements */
html[dir="rtl"] .switcher-language .dropdown-menu {
    right: 0;
    left: auto;
    min-width: 120px;
}

html[dir="rtl"] .switcher-language .switcher-option a {
    text-align: right;
    padding: 8px 15px;
}

html[dir="rtl"] .switcher-language .switcher-option a i.fa-check {
    float: left;
    margin-left: 0;
    margin-right: 8px;
}

html[dir="rtl"] .switcher-language .switcher-option a i.invisible {
    visibility: hidden;
}

/* Custom RTL Classes for Footer */
html[dir="rtl"] .rtl-footer .footer-column-rtl {
    direction: rtl;
}

html[dir="rtl"] .rtl-footer .column-right-rtl {
    float: right !important;
}

html[dir="rtl"] .rtl-footer .column-left-rtl {
    float: left !important;
}

html[dir="rtl"] .rtl-footer .social-content-rtl a {
    margin-left: 10px;
    margin-right: 0;
}

html[dir="rtl"] .rtl-footer .social-content-rtl a:first-child {
    margin-left: 0;
}

html[dir="rtl"] .rtl-footer .newsletter-form-rtl {
    direction: rtl;
}

html[dir="rtl"] .rtl-footer .input-group-rtl {
    direction: rtl;
}

html[dir="rtl"] .rtl-footer .input-group-rtl .form-control {
    text-align: right;
    border-radius: 0 3px 3px 0;
}

html[dir="rtl"] .rtl-footer .input-group-rtl .input-group-btn {
    right: 0;
    left: auto;
}

html[dir="rtl"] .rtl-footer .input-group-rtl .btn {
    border-radius: 3px 0 0 3px;
}

html[dir="rtl"] .rtl-footer .footer-bottom-rtl {
    text-align: right;
}

html[dir="rtl"] .rtl-footer .copyright-rtl {
    float: right;
    text-align: right;
}

html[dir="rtl"] .rtl-footer .links-rtl {
    float: left;
    text-align: left;
}

html[dir="rtl"] .rtl-footer .links-rtl ul li {
    float: right;
    margin-left: 20px;
    margin-right: 0;
}

html[dir="rtl"] .rtl-footer .links-rtl ul li:first-child {
    margin-left: 0;
}

html[dir="rtl"] .rtl-footer .payment-rtl {
    float: left;
    text-align: left;
}

html[dir="rtl"] .rtl-footer .payment-rtl img {
    margin-left: 5px;
    margin-right: 0;
}

html[dir="rtl"] .rtl-footer .payment-rtl img:first-child {
    margin-left: 0;
}

/* Product Grid RTL Enhancements */
html[dir="rtl"] .product-item .product-info {
    text-align: right;
}

html[dir="rtl"] .product-item .product-title {
    text-align: right;
}

html[dir="rtl"] .product-item .product-price {
    text-align: right;
}

html[dir="rtl"] .product-item .product-actions {
    text-align: right;
}

html[dir="rtl"] .product-item .product-actions .btn {
    margin-left: 5px;
    margin-right: 0;
}

html[dir="rtl"] .product-item .product-actions .btn:first-child {
    margin-left: 0;
}

/* Breadcrumb RTL Enhancements */
html[dir="rtl"] .breadcrumb-bg {
    text-align: right;
}

html[dir="rtl"] .breadcrumb ol {
    text-align: right;
}

html[dir="rtl"] .breadcrumb ol li {
    float: right;
}

html[dir="rtl"] .breadcrumb ol li:after {
    content: "\\";
    margin: 0 5px;
}

html[dir="rtl"] .breadcrumb ol li:last-child:after {
    content: "";
}

/* Sidebar RTL Enhancements */
html[dir="rtl"] .sidebar-block {
    text-align: right;
}

html[dir="rtl"] .sidebar-block .block-title {
    text-align: right;
}

html[dir="rtl"] .sidebar-block .block-content {
    text-align: right;
}

html[dir="rtl"] .sidebar-block .block-content ul {
    text-align: right;
}

html[dir="rtl"] .sidebar-block .block-content ul li {
    text-align: right;
}

html[dir="rtl"] .sidebar-block .block-content ul li a {
    text-align: right;
}

/* Category Page RTL Enhancements */
html[dir="rtl"] .category-info {
    text-align: right;
}

html[dir="rtl"] .category-description {
    text-align: right;
}

html[dir="rtl"] .category-filters {
    text-align: right;
}

html[dir="rtl"] .category-filters .filter-item {
    text-align: right;
}

html[dir="rtl"] .category-filters .filter-item label {
    text-align: right;
}

/* Product Details RTL Enhancements */
html[dir="rtl"] .product-details-info {
    text-align: right;
}

html[dir="rtl"] .product-details-title {
    text-align: right;
}

html[dir="rtl"] .product-details-price {
    text-align: right;
}

html[dir="rtl"] .product-details-description {
    text-align: right;
}

html[dir="rtl"] .product-options {
    text-align: right;
}

html[dir="rtl"] .product-options .option-group {
    text-align: right;
}

html[dir="rtl"] .product-options .option-group label {
    text-align: right;
}

/* Cart RTL Enhancements */
html[dir="rtl"] .cart-table table {
    text-align: right;
}

html[dir="rtl"] .cart-table table th,
html[dir="rtl"] .cart-table table td {
    text-align: right;
}

html[dir="rtl"] .cart-summary {
    text-align: right;
}

html[dir="rtl"] .cart-summary .summary-row {
    text-align: right;
}

html[dir="rtl"] .cart-summary .summary-row .label {
    float: right;
}

html[dir="rtl"] .cart-summary .summary-row .value {
    float: left;
}

/* Blog RTL Enhancements */
html[dir="rtl"] .blog-item {
    text-align: right;
}

html[dir="rtl"] .blog-item .blog-title {
    text-align: right;
}

html[dir="rtl"] .blog-item .blog-excerpt {
    text-align: right;
}

html[dir="rtl"] .blog-item .blog-meta {
    text-align: right;
}

html[dir="rtl"] .blog-item .blog-date {
    text-align: right;
}

/* Gallery RTL Enhancements */
html[dir="rtl"] .gallery-item {
    text-align: right;
}

html[dir="rtl"] .gallery-item .gallery-title {
    text-align: right;
}

html[dir="rtl"] .gallery-item .gallery-description {
    text-align: right;
}

/* Search RTL Enhancements */
html[dir="rtl"] .search-results {
    text-align: right;
}

html[dir="rtl"] .search-results .result-item {
    text-align: right;
}

html[dir="rtl"] .search-results .result-title {
    text-align: right;
}

html[dir="rtl"] .search-results .result-description {
    text-align: right;
}

/* Contact Form RTL Enhancements */
html[dir="rtl"] .contact-form {
    text-align: right;
}

html[dir="rtl"] .contact-form .form-group {
    text-align: right;
}

html[dir="rtl"] .contact-form .form-group label {
    text-align: right;
}

html[dir="rtl"] .contact-info {
    text-align: right;
}

html[dir="rtl"] .contact-info .info-item {
    text-align: right;
}

/* About Page RTL Enhancements */
html[dir="rtl"] .about-content {
    text-align: right;
}

html[dir="rtl"] .about-features {
    text-align: right;
}

html[dir="rtl"] .about-features .feature-item {
    text-align: right;
}

html[dir="rtl"] .about-features .feature-title {
    text-align: right;
}

html[dir="rtl"] .about-features .feature-description {
    text-align: right;
}

/* Slider RTL Enhancements */
html[dir="rtl"] .slider-content {
    text-align: right;
}

html[dir="rtl"] .slider-title {
    text-align: right;
}

html[dir="rtl"] .slider-description {
    text-align: right;
}

html[dir="rtl"] .slider-buttons {
    text-align: right;
}

/* Categories Grid RTL Enhancements */
html[dir="rtl"] .categories-grid .category-item {
    text-align: right;
}

html[dir="rtl"] .categories-grid .category-title {
    text-align: right;
}

html[dir="rtl"] .categories-grid .category-count {
    text-align: right;
}

/* Brands RTL Enhancements */
html[dir="rtl"] .brands-slider .brand-item {
    text-align: center;
}

/* Newsletter RTL Enhancements */
html[dir="rtl"] .newsletter-section {
    text-align: right;
}

html[dir="rtl"] .newsletter-title {
    text-align: right;
}

html[dir="rtl"] .newsletter-description {
    text-align: right;
}

/* Mobile RTL Enhancements */
@media (max-width: 768px) {
    html[dir="rtl"] .rtl-header .nav-right-rtl,
    html[dir="rtl"] .rtl-header .nav-left-rtl {
        float: none;
        text-align: center;
    }
    
    html[dir="rtl"] .rtl-header .ui-menu-rtl > li {
        float: none;
        display: block;
        text-align: right;
    }
    
    html[dir="rtl"] .rtl-footer .column-right-rtl,
    html[dir="rtl"] .rtl-footer .column-left-rtl {
        float: none;
        text-align: right;
    }
    
    html[dir="rtl"] .rtl-footer .copyright-rtl,
    html[dir="rtl"] .rtl-footer .links-rtl,
    html[dir="rtl"] .rtl-footer .payment-rtl {
        float: none;
        text-align: center;
        margin-bottom: 15px;
    }
    
    html[dir="rtl"] .rtl-footer .links-rtl ul li {
        float: none;
        display: inline-block;
        margin: 0 10px;
    }
}

/* Additional Typography for Arabic */
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3, 
html[dir="rtl"] h4, html[dir="rtl"] h5, html[dir="rtl"] h6 {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 600;
}

html[dir="rtl"] p, html[dir="rtl"] span, html[dir="rtl"] div {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

html[dir="rtl"] .btn {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 600;
}

/* Fix for Arabic Numbers and Prices */
html[dir="rtl"] .price-value,
html[dir="rtl"] .number-value,
html[dir="rtl"] .quantity-value,
html[dir="rtl"] .counter-number,
html[dir="rtl"] .cart-count {
    direction: ltr;
    display: inline-block;
    font-family: 'Arial', sans-serif;
}

/* Enhanced Form Styling for RTL */
html[dir="rtl"] .form-control:focus {
    border-color: #01A0BE;
    box-shadow: 0 0 5px rgba(255, 105, 0, 0.3);
}

html[dir="rtl"] .form-control::placeholder {
    color: #999;
    font-style: italic;
}

/* Enhanced Button Styling for RTL */
html[dir="rtl"] .btn-primary {
    background: linear-gradient(45deg, #01A0BE, #ff8533);
    border: none;
    transition: all 0.3s ease;
}

html[dir="rtl"] .btn-primary:hover {
    background: linear-gradient(45deg, #e55a00, #01A0BE);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 105, 0, 0.3);
}

/* Enhanced Animation for RTL */
html[dir="rtl"] .fade-in-right {
    animation: fadeInRight 0.6s ease-out;
}

html[dir="rtl"] .fade-in-left {
    animation: fadeInLeft 0.6s ease-out;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
