/* RTL Support and YekanBakhFaNum Font for Persian Website */

/* YekanBakhFaNum Font Family */
* {
    font-family: 'YekanBakhFaNum', sans-serif !important;
}

/* Exclude Font Awesome icons from font family override */
.fa, .fas, .far, .fab, .fal, .fad, .fat, [class*="fa-"], [class^="fa-"] {
    font-family: "Font Awesome 5 Free", "Font Awesome 5 Brands", "Font Awesome 5 Pro" !important;
}

/* RTL Direction */
html[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

/* Force RTL for all text elements */
html[dir="rtl"] body,
html[dir="rtl"] p,
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6,
html[dir="rtl"] span,
html[dir="rtl"] div,
html[dir="rtl"] a,
html[dir="rtl"] li,
html[dir="rtl"] ul,
html[dir="rtl"] ol,
html[dir="rtl"] small,
html[dir="rtl"] strong,
html[dir="rtl"] em,
html[dir="rtl"] b,
html[dir="rtl"] i {
    direction: rtl;
    text-align: right;
}

/* RTL Bootstrap Overrides */
html[dir="rtl"] .container,
html[dir="rtl"] .container-fluid {
    direction: rtl;
}

/* RTL Navigation */
html[dir="rtl"] .navbar-nav {
    direction: rtl;
}

html[dir="rtl"] .navbar-brand {
    margin-left: 0;
    margin-right: 1rem;
}

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

html[dir="rtl"] .input-group-prepend {
    order: 2;
}

html[dir="rtl"] .input-group-append {
    order: 1;
}

/* RTL Social Icons */
html[dir="rtl"] .btn-social {
    margin-left: 0.5rem;
    margin-right: 0;
}

html[dir="rtl"] .btn-social:last-child {
    margin-left: 0;
}

/* RTL Team Cards */
html[dir="rtl"] .team-social .btn-social {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* RTL Blog Elements */
html[dir="rtl"] .d-flex .ml-2 {
    margin-left: 0 !important;
    margin-right: 0.5rem !important;
}

html[dir="rtl"] .d-flex .ml-4 {
    margin-left: 0 !important;
    margin-right: 1.5rem !important;
}

/* RTL Footer Links */
html[dir="rtl"] .nav-link {
    text-align: right;
}

/* RTL Icons */
html[dir="rtl"] .fa-angle-right {
    transform: scaleX(-1);
}

html[dir="rtl"] .fa-angle-left {
    transform: scaleX(-1);
}

/* RTL Text Alignment */
html[dir="rtl"] .text-left {
    text-align: right !important;
}

html[dir="rtl"] .text-right {
    text-align: left !important;
}

/* Force text to be right-aligned in RTL, but preserve center alignment */
html[dir="rtl"] p,
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6,
html[dir="rtl"] span,
html[dir="rtl"] div,
html[dir="rtl"] a,
html[dir="rtl"] li,
html[dir="rtl"] small,
html[dir="rtl"] strong,
html[dir="rtl"] em,
html[dir="rtl"] b,
html[dir="rtl"] i {
    text-align: right !important;
}

/* Override specific Bootstrap text utilities */
html[dir="rtl"] .text-center {
    text-align: center !important;
}

html[dir="rtl"] .text-justify {
    text-align: justify !important;
}

/* Preserve center alignment for specific elements that should stay centered */
html[dir="rtl"] .text-center,
html[dir="rtl"] .text-center *,
html[dir="rtl"] .jumbotron,
html[dir="rtl"] .jumbotron *,
html[dir="rtl"] .text-center h1,
html[dir="rtl"] .text-center h2,
html[dir="rtl"] .text-center h3,
html[dir="rtl"] .text-center h4,
html[dir="rtl"] .text-center h5,
html[dir="rtl"] .text-center h6,
html[dir="rtl"] .text-center p,
html[dir="rtl"] .text-center span,
html[dir="rtl"] .text-center div {
    text-align: center !important;
}

/* RTL Margin and Padding Utilities */
html[dir="rtl"] .ml-2 {
    margin-left: 0 !important;
    margin-right: 0.5rem !important;
}

html[dir="rtl"] .ml-3 {
    margin-left: 0 !important;
    margin-right: 1rem !important;
}

html[dir="rtl"] .ml-4 {
    margin-left: 0 !important;
    margin-right: 1.5rem !important;
}

html[dir="rtl"] .mr-2 {
    margin-right: 0 !important;
    margin-left: 0.5rem !important;
}

html[dir="rtl"] .mr-3 {
    margin-right: 0 !important;
    margin-left: 1rem !important;
}

html[dir="rtl"] .mr-4 {
    margin-right: 0 !important;
    margin-left: 1.5rem !important;
}

html[dir="rtl"] .pl-2 {
    padding-left: 0 !important;
    padding-right: 0.5rem !important;
}

html[dir="rtl"] .pr-2 {
    padding-right: 0 !important;
    padding-left: 0.5rem !important;
}

html[dir="rtl"] .pr-3 {
    padding-right: 0 !important;
    padding-left: 1rem !important;
}

/* RTL Float Utilities */
html[dir="rtl"] .float-left {
    float: right !important;
}

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

/* RTL Position Utilities */
html[dir="rtl"] .position-absolute[style*="right"] {
    right: auto !important;
    left: 30px !important;
}

/* RTL Carousel and Slider */
html[dir="rtl"] .owl-carousel {
    direction: rtl;
}

/* RTL Testimonial Carousel */
html[dir="rtl"] .testimonial-carousel {
    direction: rtl;
}

html[dir="rtl"] .testimonial-carousel .owl-item {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .testimonial-carousel .owl-stage {
    direction: rtl;
}

html[dir="rtl"] .testimonial-carousel .owl-stage-outer {
    direction: rtl;
}

html[dir="rtl"] .testimonial-carousel .position-relative {
    text-align: right;
    direction: rtl;
}

/* RTL Testimonial Quote Icon */
html[dir="rtl"] .testimonial-carousel .fa-quote-right {
    right: auto !important;
    left: 0 !important;
    transform: scaleX(-1);
}

/* RTL Testimonial Content */
html[dir="rtl"] .testimonial-carousel .d-flex {
    direction: rtl;
}

html[dir="rtl"] .testimonial-carousel .ml-3 {
    margin-left: 0 !important;
    margin-right: 1rem !important;
}

/* Fix carousel whitespace issues */
html[dir="rtl"] .testimonial-carousel .owl-item {
    width: 100%;
    min-height: 200px;
}

html[dir="rtl"] .testimonial-carousel .owl-stage {
    display: flex;
    align-items: stretch;
}

html[dir="rtl"] .testimonial-carousel .owl-item > div {
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

/* RTL Dropdown */
html[dir="rtl"] .dropdown-menu {
    right: 0;
    left: auto;
    text-align: right;
}

/* RTL Button Groups */
html[dir="rtl"] .btn-group > .btn:not(:last-child):not(.dropdown-toggle) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}

html[dir="rtl"] .btn-group > .btn:not(:first-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

/* RTL Input Groups */
html[dir="rtl"] .input-group > .form-control:not(:last-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}

html[dir="rtl"] .input-group > .form-control:not(:first-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

/* RTL List Items */
html[dir="rtl"] .list-inline-item:not(:last-child) {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* RTL Breadcrumb */
html[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    content: "\\";
    transform: scaleX(-1);
}

/* RTL Pagination */
html[dir="rtl"] .pagination {
    direction: rtl;
}

/* RTL Progress Bars */
html[dir="rtl"] .progress-bar {
    float: right;
}

/* RTL Tables */
html[dir="rtl"] .table {
    direction: rtl;
}

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

/* RTL Cards */
html[dir="rtl"] .card {
    text-align: right;
}

/* RTL Alerts */
html[dir="rtl"] .alert {
    text-align: right;
}

/* RTL Badges */
html[dir="rtl"] .badge {
    direction: rtl;
}

/* RTL Jumbotron */
html[dir="rtl"] .jumbotron {
    text-align: right;
}

/* RTL Media Objects */
html[dir="rtl"] .media {
    direction: rtl;
}

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

/* RTL Utilities for Persian */
html[dir="rtl"] .text-justify {
    text-align: justify;
    text-justify: inter-word;
}

/* RTL Go to Top Button */
html[dir="rtl"] .go-to-top-btn {
    right: auto;
    left: 30px;
}

/* RTL Testimonial Carousel */
html[dir="rtl"] .testimonial-carousel .owl-item {
    direction: rtl;
}

/* RTL Blog Post Meta */
html[dir="rtl"] .blog-meta {
    direction: rtl;
}

/* RTL Team Social Icons */
html[dir="rtl"] .team-social {
    direction: rtl;
}

/* RTL Footer Social Icons */
html[dir="rtl"] .footer-social {
    direction: rtl;
}

/* RTL Newsletter Form */
html[dir="rtl"] .newsletter-form {
    direction: rtl;
}

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

/* RTL Quote Form */
html[dir="rtl"] .quote-form {
    direction: rtl;
}

/* RTL Service Cards */
html[dir="rtl"] .service-card {
    text-align: right;
}

/* RTL Pricing Cards */
html[dir="rtl"] .pricing-card {
    text-align: right;
}

/* RTL Team Cards */
html[dir="rtl"] .team-card {
    text-align: right;
}

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

/* RTL Testimonial Cards */
html[dir="rtl"] .testimonial-card {
    text-align: right;
}

/* RTL Feature Cards */
html[dir="rtl"] .feature-card {
    text-align: right;
}

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

/* RTL Header Section */
html[dir="rtl"] .header-section {
    text-align: right;
}

/* RTL Footer Section */
html[dir="rtl"] .footer-section {
    text-align: right;
}

/* RTL Navigation Menu */
html[dir="rtl"] .navbar-nav .nav-link {
    text-align: right;
}

/* RTL Dropdown Menu */
html[dir="rtl"] .dropdown-menu .dropdown-item {
    text-align: right;
}

/* RTL Button Text */
html[dir="rtl"] .btn {
    text-align: center;
}

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

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

/* RTL Form Validation */
html[dir="rtl"] .invalid-feedback {
    text-align: right;
}

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

/* RTL Custom Overrides */
html[dir="rtl"] .text-primary {
    direction: rtl;
}

html[dir="rtl"] .text-secondary {
    direction: rtl;
}

html[dir="rtl"] .text-white {
    direction: rtl;
}

html[dir="rtl"] .text-dark {
    direction: rtl;
}

html[dir="rtl"] .text-muted {
    direction: rtl;
}

/* RTL Display Utilities */
html[dir="rtl"] .d-flex {
    direction: rtl;
}

html[dir="rtl"] .d-inline-flex {
    direction: rtl;
}

html[dir="rtl"] .d-block {
    direction: rtl;
}

html[dir="rtl"] .d-inline {
    direction: rtl;
}

html[dir="rtl"] .d-inline-block {
    direction: rtl;
}

/* RTL Grid System */
html[dir="rtl"] .row {
    direction: rtl;
}

html[dir="rtl"] .col,
html[dir="rtl"] .col-1,
html[dir="rtl"] .col-2,
html[dir="rtl"] .col-3,
html[dir="rtl"] .col-4,
html[dir="rtl"] .col-5,
html[dir="rtl"] .col-6,
html[dir="rtl"] .col-7,
html[dir="rtl"] .col-8,
html[dir="rtl"] .col-9,
html[dir="rtl"] .col-10,
html[dir="rtl"] .col-11,
html[dir="rtl"] .col-12 {
    direction: rtl;
}

/* RTL Responsive Utilities */
@media (max-width: 767.98px) {
    html[dir="rtl"] .d-md-none {
        display: none !important;
    }
    
    html[dir="rtl"] .d-md-block {
        display: block !important;
    }
}

@media (max-width: 991.98px) {
    html[dir="rtl"] .d-lg-none {
        display: none !important;
    }
    
    html[dir="rtl"] .d-lg-block {
        display: block !important;
    }
}

/* RTL Print Styles */
@media print {
    html[dir="rtl"] * {
        direction: rtl !important;
        text-align: right !important;
    }
}
