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

[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

/* RTL Layout Adjustments */
[dir="rtl"] .container,
[dir="rtl"] .row,
[dir="rtl"] .col {
    direction: rtl;
}

/* RTL Flexbox Adjustments */
[dir="rtl"] .d-flex {
    flex-direction: row-reverse;
}

[dir="rtl"] .justify-content-start {
    justify-content: flex-end;
}

[dir="rtl"] .justify-content-end {
    justify-content: flex-start;
}

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

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

/* RTL Margin and Padding Adjustments */
[dir="rtl"] .me-1 {
    margin-left: 0.25rem !important;
    margin-right: 0 !important;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* RTL Border Adjustments */
[dir="rtl"] .border-start {
    border-right: 1px solid #dee2e6 !important;
    border-left: 0 !important;
}

[dir="rtl"] .border-end {
    border-left: 1px solid #dee2e6 !important;
    border-right: 0 !important;
}

/* RTL Position Adjustments */
[dir="rtl"] .start-0 {
    right: 0 !important;
    left: auto !important;
}

[dir="rtl"] .end-0 {
    left: 0 !important;
    right: auto !important;
}

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

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

/* RTL Navigation Adjustments */
[dir="rtl"] .navbar-nav {
    flex-direction: row-reverse;
}

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

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

/* RTL Professional Navbar Design - Same as LTR */
[dir="rtl"] .nav-container {
    gap: 2rem !important;
    /* Same as LTR */
    min-width: auto;
}

/* Removed - using nav-wrapper instead */

[dir="rtl"] nav ul {
    gap: 0.5rem !important;
    /* Same as LTR */
}

[dir="rtl"] nav ul li a {
    padding: 0.75rem 1rem !important;
    /* Same as LTR */
    white-space: nowrap;
    min-width: fit-content;
}

[dir="rtl"] .auth-buttons {
    gap: 1rem !important;
    /* Same as LTR */
}

[dir="rtl"] .auth-buttons .btn {
    padding: 0.75rem 1.5rem !important;
    /* Same as LTR */
    white-space: nowrap;
}

/* RTL Language Switcher Adjustments */
[dir="rtl"] .language-switcher {
    margin-left: 1rem !important;
    margin-right: 0 !important;
}

[dir="rtl"] .language-switcher .language-toggle {
    padding: 0.5rem 0.75rem !important;
    /* Same as LTR */
    min-width: auto !important;
    /* Same as LTR */
}

[dir="rtl"] .language-switcher .language-menu {
    right: 0 !important;
    left: auto !important;
    min-width: auto !important;
    /* Same as LTR */
}

[dir="rtl"] .language-switcher .language-option {
    padding: 0.5rem 0.75rem !important;
    /* Same as LTR */
    text-align: right !important;
}

/* RTL Logo Adjustments */
[dir="rtl"] .logo {
    margin-right: 0 !important;
    margin-left: 1rem !important;
}

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

/* RTL Navbar Overflow Handling */
[dir="rtl"] header {
    overflow: hidden !important;
    /* Remove scrollbar */
}

[dir="rtl"] .nav-wrapper {
    flex-wrap: nowrap !important;
    overflow: hidden !important;
    /* Prevent overflow */
}

[dir="rtl"] .nav-container {
    flex-shrink: 1 !important;
    /* Allow shrinking if needed */
    overflow: hidden !important;
}

[dir="rtl"] nav {
    flex-shrink: 1 !important;
    /* Allow shrinking if needed */
}

[dir="rtl"] .auth-buttons {
    flex-shrink: 0 !important;
    /* Keep auth buttons from shrinking */
}

/* RTL Navbar Text Overflow */
[dir="rtl"] nav ul li a span {
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: nowrap !important;
}

/* RTL Navbar Hover Effects */
[dir="rtl"] nav ul li a:hover {
    background-color: rgba(243, 151, 32, 0.08) !important;
    transform: translateX(-2px) !important;
    /* RTL hover effect */
}

[dir="rtl"] .auth-buttons .btn:hover {
    transform: translateY(-3px) translateX(-2px) !important;
    /* RTL hover effect */
}

/* RTL Professional Navbar Enhancements */
[dir="rtl"] #main-header {
    height: auto !important;
    /* Dynamic height */
    min-height: 70px !important;
    /* Minimum height for consistency */
}

[dir="rtl"] .nav-wrapper {
    height: auto !important;
    /* Dynamic height */
    min-height: 70px !important;
    align-items: center !important;
    padding: 0.75rem 1rem !important;
    max-width: 1280px !important;
    margin: 0 auto !important;
}

[dir="rtl"] .nav-container {
    height: auto !important;
    /* Dynamic height */
    align-items: center !important;
    justify-content: space-between !important;
    flex: 1 !important;
    /* Take available space */
    gap: 1.5rem !important;
}

[dir="rtl"] nav {
    flex: 1 !important;
    /* Take available space */
    display: flex !important;
    justify-content: center !important;
    /* Center nav items */
}

[dir="rtl"] nav ul {
    justify-content: center !important;
    /* Center nav items */
    flex-wrap: nowrap !important;
    /* Prevent wrapping */
    width: 100% !important;
    max-width: 600px !important;
    /* Limit max width for better spacing */
}

[dir="rtl"] .auth-buttons {
    flex-shrink: 0 !important;
    /* Don't shrink auth buttons */
    display: flex !important;
    align-items: center !important;
}

/* RTL Dynamic Spacing */
[dir="rtl"] nav ul li {
    flex: 0 0 auto !important;
    /* Don't grow or shrink */
}

[dir="rtl"] nav ul li a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px !important;
    /* Minimum touch target */
    transition: all 0.3s ease !important;
}

/* RTL Responsive Text Sizing */
[dir="rtl"] nav ul li a span {
    font-size: 0.95rem !important;
    /* Slightly smaller for better fit */
    font-weight: 600 !important;
    line-height: 1.2 !important;
}

[dir="rtl"] .auth-buttons .btn {
    min-height: 44px !important;
    /* Minimum touch target */
    font-size: 0.9rem !important;
    /* Slightly smaller for better fit */
    font-weight: 600 !important;
}

/* RTL Large Screen Adjustments */
@media (min-width: 1200px) {
    [dir="rtl"] .nav-wrapper {
        max-width: 1280px !important;
        /* Same as LTR */
        padding: 0.75rem 2rem !important;
        /* Normal padding */
    }

    [dir="rtl"] .nav-container {
        gap: 2rem !important;
        /* Normal gap */
    }

    [dir="rtl"] nav ul {
        gap: 0.5rem !important;
        /* Same as LTR */
    }

    [dir="rtl"] nav ul li a {
        padding: 0.75rem 1rem !important;
        /* Same as LTR */
        font-size: 1rem !important;
        /* Same as LTR */
    }

    [dir="rtl"] .auth-buttons {
        gap: 1rem !important;
        /* Same as LTR */
    }

    [dir="rtl"] .auth-buttons .btn {
        padding: 0.75rem 1.5rem !important;
        /* Same as LTR */
        font-size: 1rem !important;
    }
}

/* RTL Extra Large Screen Adjustments */
@media (min-width: 1400px) {
    [dir="rtl"] .nav-wrapper {
        max-width: 1280px !important;
        /* Same as LTR */
        padding: 0.75rem 2rem !important;
        /* Normal padding */
    }

    [dir="rtl"] .nav-container {
        gap: 2rem !important;
        /* Normal gap */
    }

    [dir="rtl"] nav ul {
        gap: 0.5rem !important;
        /* Same as LTR */
    }
}

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

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

[dir="rtl"] .input-group .form-control {
    border-radius: 0.375rem 0 0 0.375rem;
}

[dir="rtl"] .input-group .btn {
    border-radius: 0 0.375rem 0.375rem 0;
}

[dir="rtl"] .input-group-text {
    border-radius: 0 0.375rem 0.375rem 0;
}

/* RTL Auth Page Specific Styles */
[dir="rtl"] .login-card,
[dir="rtl"] .register-card,
[dir="rtl"] .verify-card {
    text-align: center;
}

[dir="rtl"] .login-header,
[dir="rtl"] .register-header,
[dir="rtl"] .verify-header {
    text-align: center;
}

[dir="rtl"] .login-title,
[dir="rtl"] .register-title,
[dir="rtl"] .verify-title {
    text-align: center;
}

[dir="rtl"] .login-subtitle,
[dir="rtl"] .register-subtitle,
[dir="rtl"] .verify-subtitle {
    text-align: center;
}

[dir="rtl"] .signup-link,
[dir="rtl"] .login-link {
    text-align: center;
}

/* RTL Password Toggle */
[dir="rtl"] .password-toggle {
    right: auto;
    left: 12px;
}

/* RTL Form Options */
[dir="rtl"] .form-options {
    flex-direction: row-reverse;
}

/* RTL Form Check */
[dir="rtl"] .form-check {
    flex-direction: row-reverse;
}

[dir="rtl"] .form-check-input {
    margin-right: 0;
    margin-left: 8px;
}

/* RTL Phone Input Container */
[dir="rtl"] .phone-input-container {
    flex-direction: row-reverse;
}

[dir="rtl"] .country-code {
    border-right: 1px solid var(--gray-200);
    border-left: none;
    border-radius: 0 8px 8px 0;
}

[dir="rtl"] .country-code img {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .phone-input {
    border-radius: 8px 0 0 8px;
}

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

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

/* RTL Verify Steps */
[dir="rtl"] .verify-steps {
    text-align: center;
}

[dir="rtl"] .verify-steps-list {
    text-align: right;
}

[dir="rtl"] .verify-steps-list li {
    flex-direction: row-reverse;
}

[dir="rtl"] .step-number {
    margin-right: 0;
    margin-left: 12px;
}

/* RTL Button Adjustments */
[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.375rem;
    border-bottom-right-radius: 0.375rem;
}

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

/* RTL Card Adjustments */
[dir="rtl"] .card-header {
    text-align: right;
}

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

/* RTL List Adjustments */
[dir="rtl"] .list-group-item {
    text-align: right;
}

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

/* RTL Table Adjustments */
[dir="rtl"] .table {
    text-align: right;
}

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

/* RTL Modal Adjustments */
[dir="rtl"] .modal-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .modal-footer {
    flex-direction: row-reverse;
}

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

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

/* RTL Breadcrumb Adjustments */
[dir="rtl"] .breadcrumb {
    flex-direction: row-reverse;
}

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

/* RTL Pagination Adjustments */
[dir="rtl"] .pagination {
    flex-direction: row-reverse;
}

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

/* RTL Progress Adjustments */
[dir="rtl"] .progress {
    direction: rtl;
}

/* RTL Badge Adjustments */
[dir="rtl"] .badge {
    text-align: center;
}

/* RTL Spinner Adjustments */
[dir="rtl"] .spinner-border,
[dir="rtl"] .spinner-grow {
    animation-direction: reverse;
}

/* RTL Custom Components */
[dir="rtl"] .language-switcher {
    direction: rtl;
}

[dir="rtl"] .language-switcher .dropdown-toggle::after {
    margin-left: 0;
    margin-right: 0.255em;
}

/* RTL Font Adjustments */
[dir="rtl"] body {
    font-family: 'Cairo', 'Tajawal', 'Amiri', 'Noto Sans Arabic', sans-serif;
}

/* RTL Icon Adjustments */
[dir="rtl"] .fa-arrow-left::before {
    content: "\\f061";
}

[dir="rtl"] .fa-arrow-right::before {
    content: "\\f060";
}

[dir="rtl"] .fa-chevron-left::before {
    content: "\\f054";
}

[dir="rtl"] .fa-chevron-right::before {
    content: "\\f053";
}

/* RTL Animation Adjustments */
[dir="rtl"] .slide-in-left {
    animation: slideInRight 0.3s ease-out;
}

[dir="rtl"] .slide-in-right {
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

/* RTL Loading Spinner */
[dir="rtl"] .loading-spinner {
    animation: spinRTL 1s linear infinite;
}

@keyframes spinRTL {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(-360deg);
    }
}

/* RTL Responsive Adjustments */
@media (max-width: 768px) {
    [dir="rtl"] .navbar-nav {
        flex-direction: column;
    }

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

    /* RTL Mobile Navbar Adjustments - Same as LTR */
    [dir="rtl"] .nav-container {
        width: 80% !important;
        /* Same as LTR */
        padding: 5rem 2rem 2rem !important;
        /* Same as LTR */
    }

    [dir="rtl"] .nav-wrapper {
        padding: 0.75rem 1.5rem !important;
        /* Same as LTR */
    }

    [dir="rtl"] nav ul li a {
        padding: 1rem !important;
        /* Same as LTR */
        font-size: 1rem !important;
        /* Same as LTR */
    }

    [dir="rtl"] .auth-buttons .btn {
        padding: 0.75rem 1.5rem !important;
        /* Same as LTR */
        font-size: 1rem !important;
        /* Same as LTR */
    }
}

@media (max-width: 480px) {
    [dir="rtl"] .nav-container {
        width: 85% !important;
        /* Same as LTR */
        padding: 5rem 1.5rem 2rem !important;
        /* Same as LTR */
    }

    [dir="rtl"] .nav-wrapper {
        padding: 0.75rem 1rem !important;
        /* Same as LTR */
    }

    [dir="rtl"] nav ul li a {
        padding: 1rem 1.25rem !important;
        /* Same as LTR */
        font-size: 1rem !important;
        /* Same as LTR */
    }
}

/* RTL Print Styles */
@media print {
    [dir="rtl"] {
        direction: rtl;
    }

    [dir="rtl"] .no-print {
        display: none !important;
    }
}

/* RTL High Contrast Mode */
@media (prefers-contrast: high) {
    [dir="rtl"] {
        border: 1px solid;
    }
}

/* RTL Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    [dir="rtl"] * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}