/* رفع مشکلات JavaScript و فونت‌ها */

/* رفع مشکل FontAwesome */
.fa {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900;
}

.far {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 400;
}

.fas {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900;
}

/* رفع مشکل Bootstrap Select */
.bootstrap-select .dropdown-toggle {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* رفع مشکل jQuery UI Tooltip */
.ui-tooltip {
    position: absolute;
    z-index: 9999;
    max-width: 200px;
    padding: 8px;
    background: #000;
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
}

.ui-tooltip::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 50%;
    margin-left: -5px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #000;
}

/* رفع مشکل owlCarousel */
.owl-carousel {
    display: none;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

.owl-carousel .owl-stage {
    position: relative;
    -ms-touch-action: pan-Y;
    touch-action: manipulation;
    -moz-backface-visibility: hidden;
}

.owl-carousel .owl-stage:after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
}

.owl-carousel .owl-stage-outer {
    position: relative;
    overflow: hidden;
    -webkit-transform: translate3d(0px, 0px, 0px);
}

.owl-carousel .owl-item {
    position: relative;
    min-height: 1px;
    float: left;
    -webkit-backface-visibility: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.owl-carousel .owl-item img {
    display: block;
    width: 100%;
}

.owl-carousel.owl-loaded {
    display: block;
}

/* رفع مشکل Fancybox */
.fancybox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    display: none;
    z-index: 9999;
    background: url('fancybox_overlay.png');
}

.fancybox-wrap {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
    outline: none;
}

.fancybox-skin {
    position: relative;
    background: #f9f9f9;
    color: #74a3c7;
    text-shadow: none;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
}

/* رفع مشکل Manifest */
.app-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

/* رفع مشکل Slow Network */
.slow-network-warning {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ff6b6b;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    z-index: 10000;
}

/* رفع مشکل Service Worker */
.sw-update-available {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #4CAF50;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    z-index: 10000;
    cursor: pointer;
}

/* رفع مشکل PWA */
.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #007cba;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    z-index: 10000;
    cursor: pointer;
}

/* رفع مشکل RTL */
[dir="rtl"] .owl-carousel .owl-item {
    float: right;
}

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

/* رفع مشکل Mobile */
@media (max-width: 768px) {
    .ui-tooltip {
        max-width: 150px;
        font-size: 11px;
    }
    
    .pwa-install-prompt {
        bottom: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
    }
}

/* Fallback برای owlCarousel */
.carousel-fallback {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.carousel-fallback > * {
    flex: 1 1 300px;
    min-width: 250px;
}

/* Fallback برای Bootstrap Select */
.selectpicker.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* رفع مشکل Form Accessibility */
input[type="text"], input[type="email"], input[type="password"], 
input[type="tel"], input[type="url"], textarea, select {
    autocomplete: "on";
}

label[for] {
    cursor: pointer;
}

/* رفع مشکل RTL */
[dir="rtl"] .carousel-fallback {
    direction: rtl;
}

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

/* رفع مشکل Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal.show {
    display: block;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 10px;
    pointer-events: none;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0,0,0,.2);
    border-radius: 0.3rem;
    outline: 0;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1rem;
    border-bottom: 1px solid #dee2e6;
    border-top-left-radius: calc(0.3rem - 1px);
    border-top-right-radius: calc(0.3rem - 1px);
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

.modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem;
    border-top: 1px solid #dee2e6;
    border-bottom-right-radius: calc(0.3rem - 1px);
    border-bottom-left-radius: calc(0.3rem - 1px);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    opacity: 0.5;
}

/* رفع مشکل Tooltip */
.tooltip {
    position: absolute;
    z-index: 1070;
    display: block;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-style: normal;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    text-decoration: none;
    text-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    word-break: normal;
    word-spacing: normal;
    white-space: normal;
    line-break: auto;
    font-size: 0.875rem;
    word-wrap: break-word;
    opacity: 0;
}

.tooltip.show {
    opacity: 0.9;
}

.tooltip-inner {
    max-width: 200px;
    padding: 0.25rem 0.5rem;
    color: #fff;
    text-align: center;
    background-color: #000;
    border-radius: 0.25rem;
}

/* رفع مشکل تکرار منوی جستجو */
.hero-form {
    position: relative;
}

.hero-form.duplicate {
    display: none !important;
}

/* رفع مشکل منوی جستجو */
.hero-form.open .ajaxResultBox {
    display: block;
}

.ajaxResultBox {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

/* رفع مشکل selectpicker در جستجو */
.hero-form select {
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
}

/* رفع مشکل دکمه جستجو */
.heroSearchBtn {
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
}
