/* Global RTL adjustments */
[dir="rtl"] .me-1, [dir="rtl"] .me-2, [dir="rtl"] .me-3, [dir="rtl"] .me-4, [dir="rtl"] .me-5 {
    margin-right: 0 !important;
}

[dir="rtl"] .ms-1, [dir="rtl"] .ms-2, [dir="rtl"] .ms-3, [dir="rtl"] .ms-4, [dir="rtl"] .ms-5 {
    margin-left: 0 !important;
}

/* Location and route RTL styles */
[dir="rtl"] .location-marker,
[dir="rtl"] .route-location-icon {
    margin-right: 0;
    margin-left: 10px;
}

[dir="rtl"] .location-divider {
    margin: 0 15px;
}

[dir="rtl"] .location-divider:before {
    right: auto;
    left: -5px;
}

/* Icon spacing RTL fixes */
[dir="rtl"] .transport-icon {
    margin-right: 0;
    margin-left: 10px;
}

[dir="rtl"] .rating-star {
    margin-right: 0;
    margin-left: 5px;
}

[dir="rtl"] .verified-icon {
    margin-right: 0;
    margin-left: 5px;
}

[dir="rtl"] .info-label {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .reset-filters i {
    margin-right: 0;
    margin-left: 5px;
}

[dir="rtl"] .filter-toggle i {
    margin-right: 0;
    margin-left: 8px;
}

/* Items RTL fixes */
[dir="rtl"] .item-icon {
    margin-right: 0;
    margin-left: 15px;
}

[dir="rtl"] .item-size {
    margin-left: 0;
    margin-right: 10px;
}

/* Specific icon RTL fixes */
[dir="rtl"] .fas.fa-tag {
    margin-right: 0;
    margin-left: 5px;
}

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

[dir="rtl"] .fas.fa-check-circle {
    margin-right: 0;
    margin-left: 5px;
}

[dir="rtl"] .fas.fa-clock {
    margin-right: 0;
    margin-left: 5px;
}

[dir="rtl"] .fas.fa-weight-hanging {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .fas.fa-chevron-down {
    margin-right: 0;
    margin-left: 5px;
}

/* Review and rating RTL fixes */
[dir="rtl"] .review-avatar {
    margin-right: 0;
    margin-left: 15px;
}

[dir="rtl"] .rating-value {
    margin-left: 0;
    margin-right: 5px;
}

[dir="rtl"] .rating-stars {
    margin-left: 0;
    margin-right: auto;
}

/* Map RTL fixes */
[dir="rtl"] .custom-div-icon {
    direction: ltr; /* Keep map icons in LTR direction */
}

/* Mobile RTL fixes */
@media (max-width: 767.98px) {
    [dir="rtl"] .location-divider {
        margin: 5px 20px 5px 0;
        border-left: none;
        border-right: 2px dashed #ddd;
    }
    
    [dir="rtl"] .location-divider:before {
        left: auto;
        right: -4px;
    }
    
    [dir="rtl"] .mobile-location-row .location-marker {
        margin-right: 0;
        margin-left: 10px;
    }
    
    [dir="rtl"] .route-text {
        align-items: flex-start;
    }
}

/* Additional Bootstrap layout fixes for RTL */
[dir="rtl"] .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

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

/* Button group and input group RTL fixes */
[dir="rtl"] .btn-group > .btn:not(:last-child):not(.dropdown-toggle),
[dir="rtl"] .btn-group > .btn-group:not(:last-child) > .btn {
    border-radius: 0 0.25rem 0.25rem 0;
}

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

/* Form and input RTL fixes */
[dir="rtl"] .form-check {
    padding-right: 1.5em;
    padding-left: 0;
}

[dir="rtl"] .form-check .form-check-input {
    float: right;
    margin-right: -1.5em;
    margin-left: 0;
}

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

/* Modal RTL fixes */
[dir="rtl"] .modal-header .btn-close {
    margin: -0.5rem auto -0.5rem -0.5rem;
}

/* Fix capacity badge and price badge spacing for RTL */
[dir="rtl"] .capacity-badge {
    margin-right: 0;
    margin-left: 10px;
}

/* Price and capacity badge base styles */
.price-badge {
    margin-right: 10px;
}

/* RTL-specific overrides */
[dir="rtl"] .price-badge {
    margin-right: 0;
    margin-left: 10px;
}

/* Enhanced Traveler Profile */
.traveler-stats {
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.stat-item {
    position: relative;
}

[dir="rtl"] .stat-item:not(:last-child)::after {
    right: auto;
    left: 0;
}

/* Review Form Styles */
.add-review-section {
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    margin-top: 30px;
}

.rating-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rating-star {
    font-size: 1.5rem;
    color: #ddd;
    cursor: pointer;
    transition: color 0.2s ease;
}

.rating-star.fas {
    color: #ffc107;
}

.rating-star:hover {
    transform: scale(1.1);
}

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

.review-form textarea {
    resize: vertical;
    min-height: 100px;
}

.review-form .btn-primary {
    min-width: 150px;
}

/* Improve card appearance */
.details-card {
    transition: box-shadow 0.3s ease;
}

.details-card:hover {
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
}

.phone-number {
    unicode-bidi:embed;
    direction:ltr;
}

/* Improve mobile responsiveness for review section */
@media (max-width: 767.98px) {
    .review-header {
        flex-direction: column;
    }
    
    .rating-stars {
        margin-left: 0;
        margin-top: 10px;
    }
    
    [dir="rtl"] .rating-stars {
        margin-right: 0;
    }
    
    .add-review-section {
        padding: 15px;
    }
    
    .rating-input {
        justify-content: center;
    }
}

/* Animation for star rating */
@keyframes star-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.rating-star.fas {
    animation: star-pulse 0.3s ease-in-out;
}

/* Simplified Step Numbering for RTL/LTR compatibility */
.simplified-steps {
    padding: 0;
    list-style: none;
    counter-reset: step-counter;
}

.simplified-steps li {
    position: relative;
    padding-left: 3.5rem;
    padding-right: 3.5rem;
    margin-bottom: 1.5rem;
    min-height: 3rem;
    counter-increment: step-counter;
}

.simplified-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 2.5rem;
    height: 2.5rem;
    background-color: #0d6efd;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.25rem;
    border: 2px solid #0d6efd;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.25);
}

[dir="rtl"] .simplified-steps li::before {
    left: auto;
    right: 0;
}

.simplified-steps li::after {
    content: "";
    position: absolute;
    left: 1.25rem;
    top: 2.5rem;
    bottom: -1.5rem;
    width: 2px;
    background-color: #dee2e6;
    z-index: 1;
}

[dir="rtl"] .simplified-steps li::after {
    left: auto;
    right: 1.25rem;
}

.simplified-steps li:last-child::after {
    display: none;
}

.simplified-steps .step-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
    display: block;
}

.simplified-steps .step-description {
    color: #6c757d;
    margin: 0;
}
