/* RTL Support for Persian Language with Vazirmatn Font */

/* Import Vazirmatn Font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;200;300;400;500;600;700;800;900&display=swap');

/* RTL Direction and Font Settings - Higher Specificity */
html[dir="rtl"], html[dir="rtl"] body {
    direction: rtl !important;
    text-align: right !important;
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Body Settings */
html[dir="rtl"] body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    direction: rtl !important;
    text-align: right !important;
}

/* RTL Typography - Higher Specificity */
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: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

html[dir="rtl"] p, html[dir="rtl"] span, html[dir="rtl"] div {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Navigation */
html[dir="rtl"] .navbar-nav {
    padding-right: 0 !important;
}

html[dir="rtl"] .navbar-nav .nav-link {
    text-align: right !important;
}

/* RTL Buttons */
html[dir="rtl"] .btn {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Forms */
html[dir="rtl"] .form-control {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

html[dir="rtl"] .form-label {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

/* RTL Cards */
html[dir="rtl"] .card {
    text-align: right !important;
}

html[dir="rtl"] .card-title {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

html[dir="rtl"] .card-text {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

/* RTL Lists */
html[dir="rtl"] ul, html[dir="rtl"] ol {
    padding-right: 0.5rem !important;
    padding-left: 0 !important;
}

html[dir="rtl"] .list-group-item {
    text-align: right !important;
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Tables */
html[dir="rtl"] .table {
    text-align: right !important;
}

html[dir="rtl"] .table th, html[dir="rtl"] .table td {
    text-align: right !important;
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Alerts */
html[dir="rtl"] .alert {
    text-align: right !important;
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Modals */
html[dir="rtl"] .modal-header {
    text-align: right !important;
}

html[dir="rtl"] .modal-title {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

html[dir="rtl"] .modal-body {
    text-align: right !important;
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Dropdowns */
html[dir="rtl"] .dropdown-menu {
    text-align: right !important;
}

html[dir="rtl"] .dropdown-item {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

/* RTL Pagination */
html[dir="rtl"] .pagination {
    justify-content: flex-start !important;
}

/* RTL Breadcrumbs */
html[dir="rtl"] .breadcrumb-item + .breadcrumb-item {
    padding-right: 0.5rem !important;
    padding-left: 0 !important;
}

html[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    float: right !important;
    padding-left: 0.5rem !important;
    padding-right: 0 !important;
}

/* RTL Input Groups */
html[dir="rtl"] .input-group > .form-control {
    border-radius: 0 0.25rem 0.25rem 0 !important;
}

html[dir="rtl"] .input-group > .form-control:not(:last-child) {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

html[dir="rtl"] .input-group > .form-control:not(:first-child) {
    border-top-right-radius: 0.25rem !important;
    border-bottom-right-radius: 0.25rem !important;
}

/* RTL Badges */
html[dir="rtl"] .badge {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Progress */
html[dir="rtl"] .progress {
    direction: ltr !important;
}

/* RTL Tooltips */
html[dir="rtl"] .tooltip {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Popovers */
html[dir="rtl"] .popover {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Accordion */
html[dir="rtl"] .accordion-button {
    text-align: right !important;
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

html[dir="rtl"] .accordion-body {
    text-align: right !important;
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Carousel */
html[dir="rtl"] .carousel-caption {
    text-align: right !important;
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Spinners */
html[dir="rtl"] .spinner-border, html[dir="rtl"] .spinner-grow {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Text Utilities */
html[dir="rtl"] .text-start {
    text-align: right !important;
}

html[dir="rtl"] .text-end {
    text-align: left !important;
}

/* RTL Float Utilities */
html[dir="rtl"] .float-start {
    float: right !important;
}

html[dir="rtl"] .float-end {
    float: left !important;
}

/* RTL Margin Utilities */
html[dir="rtl"] .me-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

html[dir="rtl"] .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

/* RTL Margin Classes */
html[dir="rtl"] .me-1 { margin-left: 0.25rem !important; margin-right: 0 !important; }
html[dir="rtl"] .me-2 { margin-left: 0.5rem !important; margin-right: 0 !important; }
html[dir="rtl"] .me-3 { margin-left: 1rem !important; margin-right: 0 !important; }
html[dir="rtl"] .me-4 { margin-left: 1.5rem !important; margin-right: 0 !important; }
html[dir="rtl"] .me-5 { margin-left: 3rem !important; margin-right: 0 !important; }

html[dir="rtl"] .ms-1 { margin-right: 0.25rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ms-2 { margin-right: 0.5rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ms-3 { margin-right: 1rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ms-4 { margin-right: 1.5rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ms-5 { margin-right: 3rem !important; margin-left: 0 !important; }

/* RTL Padding Classes */
html[dir="rtl"] .pe-1 { padding-left: 0.25rem !important; padding-right: 0 !important; }
html[dir="rtl"] .pe-2 { padding-left: 0.5rem !important; padding-right: 0 !important; }
html[dir="rtl"] .pe-3 { padding-left: 1rem !important; padding-right: 0 !important; }
html[dir="rtl"] .pe-4 { padding-left: 1.5rem !important; padding-right: 0 !important; }
html[dir="rtl"] .pe-5 { padding-left: 3rem !important; padding-right: 0 !important; }

html[dir="rtl"] .ps-1 { padding-right: 0.25rem !important; padding-left: 0 !important; }
html[dir="rtl"] .ps-2 { padding-right: 0.5rem !important; padding-left: 0 !important; }
html[dir="rtl"] .ps-3 { padding-right: 1rem !important; padding-left: 0 !important; }
html[dir="rtl"] .ps-4 { padding-right: 1.5rem !important; padding-left: 0 !important; }
html[dir="rtl"] .ps-5 { padding-right: 3rem !important; padding-left: 0 !important; }

/* RTL Border Radius */
html[dir="rtl"] .rounded-start {
    border-top-left-radius: 0.25rem !important;
    border-bottom-left-radius: 0.25rem !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

html[dir="rtl"] .rounded-end {
    border-top-right-radius: 0.25rem !important;
    border-bottom-right-radius: 0.25rem !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

/* RTL Flex Utilities */
html[dir="rtl"] .flex-row {
    flex-direction: row-reverse !important;
}

html[dir="rtl"] .flex-row-reverse {
    flex-direction: row !important;
}

/* RTL Grid */
html[dir="rtl"] .row {
    flex-direction: row-reverse !important;
}

/* RTL Icons */
html[dir="rtl"] .icon {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

/* RTL Hero Sections */
html[dir="rtl"] .hero-1-title {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

html[dir="rtl"] .hero-1-subtitle {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

/* RTL Welcome Cards */
html[dir="rtl"] .wc-title {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

html[dir="rtl"] .wc-subtitle {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

/* RTL Footer */
html[dir="rtl"] footer {
    text-align: right !important;
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Testimonials */
html[dir="rtl"] .testimonial-text {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

html[dir="rtl"] .testimonial-author {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

/* RTL Pricing */
html[dir="rtl"] .pricing-title {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

html[dir="rtl"] .pricing-price {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: right !important;
}

/* RTL Contact Forms */
html[dir="rtl"] .contact-form {
    text-align: right !important;
}

html[dir="rtl"] .contact-form input,
html[dir="rtl"] .contact-form textarea {
    text-align: right !important;
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* RTL Numbers and Currency */
html[dir="rtl"] .price {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: bidi-override !important;
}

/* RTL Date and Time */
html[dir="rtl"] .date-time {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: bidi-override !important;
}

/* RTL Phone Numbers */
html[dir="rtl"] .phone-number {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: bidi-override !important;
}

/* RTL Email Addresses */
html[dir="rtl"] .email-address {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: bidi-override !important;
}

/* RTL URLs */
html[dir="rtl"] .url {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: bidi-override !important;
}

/* RTL Code Blocks */
html[dir="rtl"] code, html[dir="rtl"] pre {
    font-family: 'Courier New', Courier, monospace !important;
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: bidi-override !important;
}

/* AdminLTE Specific RTL Fixes */
html[dir="rtl"] .main-sidebar {
    right: 0 !important;
    left: auto !important;
}

html[dir="rtl"] .content-wrapper {
    margin-right: 250px !important;
    margin-left: 0 !important;
}

html[dir="rtl"] .main-header {
    margin-right: 250px !important;
    margin-left: 0 !important;
}

html[dir="rtl"] .main-footer {
    margin-right: 250px !important;
    margin-left: 0 !important;
}

html[dir="rtl"] body.sidebar-collapse .content-wrapper,
html[dir="rtl"] body.sidebar-collapse .main-header,
html[dir="rtl"] body.sidebar-collapse .main-footer {
    margin-right: 4.6rem !important;
    margin-left: 0 !important;
}

html[dir="rtl"] .nav-sidebar .nav-link {
    text-align: right !important;
    padding: 0.5rem 1rem 0.5rem 0 !important;
}

html[dir="rtl"] .nav-sidebar .nav-icon {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

html[dir="rtl"] .nav-sidebar .nav-treeview {
    padding-right: 0 !important;
    margin-right: 0 !important;
}

html[dir="rtl"] .nav-treeview .nav-link {
    padding-right: 2.5rem !important;
    padding-left: 1rem !important;
}

html[dir="rtl"] .brand-text {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-align: center !important;
}

html[dir="rtl"] .small-box {
    text-align: right !important;
}

html[dir="rtl"] .small-box .icon {
    right: auto !important;
    left: 10px !important;
}

html[dir="rtl"] .small-box .inner {
    text-align: right !important;
}

html[dir="rtl"] .small-box .small-box-footer {
    text-align: center !important;
}

html[dir="rtl"] .info-box {
    text-align: right !important;
}

html[dir="rtl"] .info-box-icon {
    right: auto !important;
    left: 0 !important;
}

html[dir="rtl"] .info-box-content {
    margin-right: 0 !important;
    margin-left: 50px !important;
}

html[dir="rtl"] .card-header > .card-tools {
    right: auto !important;
    left: 1rem !important;
}

html[dir="rtl"] .alert-dismissible {
    padding-right: 1.25rem !important;
    padding-left: 4rem !important;
}

html[dir="rtl"] .alert-dismissible .close {
    right: auto !important;
    left: 0 !important;
}

html[dir="rtl"] .form-check-input {
    margin-right: -1.25rem !important;
    margin-left: 0 !important;
}

html[dir="rtl"] .form-check-label {
    padding-right: 1.25rem !important;
    padding-left: 0 !important;
}

html[dir="rtl"] .dropdown-menu-right {
    right: auto !important;
    left: 0 !important;
}

html[dir="rtl"] .float-sm-right {
    float: left !important;
}

html[dir="rtl"] .float-sm-left {
    float: right !important;
}

/* Mobile RTL Fixes */
@media (max-width: 767.98px) {
    html[dir="rtl"] .content-wrapper,
    html[dir="rtl"] .main-header,
    html[dir="rtl"] .main-footer {
        margin-right: 0 !important;
    }
    
    html[dir="rtl"] .main-sidebar {
        margin-right: -250px !important;
    }
    
    html[dir="rtl"] body.sidebar-open .main-sidebar {
        margin-right: 0 !important;
    }
}

/* RTL Print Styles */
@media print {
    html[dir="rtl"] {
        direction: rtl !important;
        text-align: right !important;
        font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    }
}

/* RTL Focus States */
html[dir="rtl"] .form-control:focus {
    border-color: #80bdff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* RTL Hover States */
html[dir="rtl"] .btn:hover {
    transform: translateY(-1px) !important;
}

/* RTL Animations */
html[dir="rtl"] .animate-float {
    animation: float-rtl 3s ease-in-out infinite !important;
}

@keyframes float-rtl {
    0%, 100% { transform: translateY(0px) translateX(0px); }
    50% { transform: translateY(-10px) translateX(-5px); }
}

/* RTL Mobile Responsive */
@media (max-width: 768px) {
    html[dir="rtl"] .container {
        padding-right: 15px !important;
        padding-left: 15px !important;
    }
    
    html[dir="rtl"] .row {
        margin-right: -15px !important;
        margin-left: -15px !important;
    }
    
    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 {
        padding-right: 15px !important;
        padding-left: 15px !important;
    }
}

/* RTL Dark Theme Support */
html[data-bs-theme="dark"] html[dir="rtl"] {
    color-scheme: dark !important;
}

html[data-bs-theme="dark"] html[dir="rtl"] .card {
    background-color: #212529 !important;
    border-color: #495057 !important;
}

html[data-bs-theme="dark"] html[dir="rtl"] .form-control {
    background-color: #495057 !important;
    border-color: #6c757d !important;
    color: #f8f9fa !important;
}

/* RTL Screen Reader Support */
html[dir="rtl"] .sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* RTL High Contrast Support */
@media (prefers-contrast: high) {
    html[dir="rtl"] {
        border: 2px solid !important;
    }
}

/* RTL Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    html[dir="rtl"] * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
} 