/**
 * Responsive Fixer Pro - Main CSS
 * تضمین رسپانسیو بودن کامل سایت
 */

/* ========================================
   1. حذف کامل اسکرول افقی
======================================== */

html,
body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
}

* {
    box-sizing: border-box !important;
}

/* جلوگیری از بیرون‌زدگی هر المانی */
body.responsive-fixer-active * {
    max-width: 100% !important;
}

/* ========================================
   2. اصلاح تصاویر
======================================== */

/* تمام تصاویر */
body.responsive-fixer-active img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

/* تصاویر داخل لینک */
body.responsive-fixer-active a img {
    max-width: 100% !important;
    height: auto !important;
}

/* تصاویر پس‌زمینه */
body.responsive-fixer-active [style*="background-image"] {
    background-size: cover !important;
    background-position: center !important;
}

/* تصاویر با کلاس خاص */
img.responsive-fixer-img {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
}

/* ========================================
   3. اصلاح ویدیوها و iframe
======================================== */

body.responsive-fixer-active iframe,
body.responsive-fixer-active embed,
body.responsive-fixer-active object,
body.responsive-fixer-active video {
    max-width: 100% !important;
    height: auto !important;
}

/* wrapper برای iframe‌های رسپانسیو */
.responsive-fixer-iframe-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* نسبت 16:9 */
    height: 0;
    overflow: hidden;
    max-width: 100%;
}

.responsive-fixer-iframe-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

/* ========================================
   4. اصلاح جداول
======================================== */

body.responsive-fixer-active table {
    max-width: 100% !important;
    overflow-x: auto !important;
    display: block !important;
}

/* wrapper برای جداول */
.responsive-fixer-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1em 0;
}

.responsive-fixer-table-wrapper table {
    min-width: 100%;
    border-collapse: collapse;
}

/* ========================================
   5. اصلاح کانتینرها و div‌ها
======================================== */

body.responsive-fixer-active .container,
body.responsive-fixer-active .row,
body.responsive-fixer-active .col,
body.responsive-fixer-active div {
    max-width: 100vw !important;
}

/* المان‌هایی با عرض ثابت */
body.responsive-fixer-active [style*="width"] {
    max-width: 100% !important;
}

/* ========================================
   6. اصلاحات موبایل
======================================== */

@media (max-width: 768px) {
    /* حذف کامل اسکرول افقی در موبایل */
    html,
    body {
        overflow-x: hidden !important;
        position: relative !important;
        max-width: 100vw !important;
        width: 100vw !important;
    }
    
    /* اصلاح padding و margin زیاد */
    body.responsive-fixer-active * {
        max-width: 100vw !important;
    }
    
    /* اصلاح فرم‌ها */
    body.responsive-fixer-active input,
    body.responsive-fixer-active textarea,
    body.responsive-fixer-active select,
    body.responsive-fixer-active button {
        max-width: 100% !important;
    }
    
    /* اصلاح pre و code */
    body.responsive-fixer-active pre,
    body.responsive-fixer-active code {
        max-width: 100% !important;
        overflow-x: auto !important;
        word-wrap: break-word !important;
        white-space: pre-wrap !important;
    }
    
    /* اصلاح متن‌های طولانی */
    body.responsive-fixer-active p,
    body.responsive-fixer-active h1,
    body.responsive-fixer-active h2,
    body.responsive-fixer-active h3,
    body.responsive-fixer-active h4,
    body.responsive-fixer-active h5,
    body.responsive-fixer-active h6 {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    /* اصلاح لیست‌ها */
    body.responsive-fixer-active ul,
    body.responsive-fixer-active ol {
        padding-left: 20px !important;
        max-width: 100% !important;
    }
}

/* ========================================
   7. اصلاحات برای موبایل‌های کوچک
======================================== */

@media (max-width: 480px) {
    /* اصلاح فونت‌سایز برای خوانایی بهتر */
    body.responsive-fixer-active {
        font-size: 16px !important;
        line-height: 1.6 !important;
    }
    
    /* اصلاح padding صفحه */
    body.responsive-fixer-active .content,
    body.responsive-fixer-active .main,
    body.responsive-fixer-active article {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}

/* ========================================
   8. اصلاح المان‌های شناور
======================================== */

body.responsive-fixer-active .float-left,
body.responsive-fixer-active .float-right {
    float: none !important;
    width: 100% !important;
}

@media (max-width: 768px) {
    body.responsive-fixer-active .alignleft,
    body.responsive-fixer-active .alignright {
        float: none !important;
        margin: 0 auto !important;
        display: block !important;
    }
}

/* ========================================
   9. اصلاح sidebar و widget
======================================== */

@media (max-width: 768px) {
    body.responsive-fixer-active .sidebar,
    body.responsive-fixer-active .widget,
    body.responsive-fixer-active aside {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 15px !important;
    }
}

/* ========================================
   10. اصلاح گالری‌ها
======================================== */

body.responsive-fixer-active .gallery,
body.responsive-fixer-active .wp-block-gallery {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 10px !important;
    max-width: 100% !important;
}

@media (max-width: 480px) {
    body.responsive-fixer-active .gallery,
    body.responsive-fixer-active .wp-block-gallery {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)) !important;
    }
}

/* ========================================
   11. اصلاح منوها
======================================== */

@media (max-width: 768px) {
    body.responsive-fixer-active nav ul,
    body.responsive-fixer-active .menu {
        display: block !important;
        width: 100% !important;
    }
    
    body.responsive-fixer-active nav li,
    body.responsive-fixer-active .menu li {
        display: block !important;
        width: 100% !important;
    }
}

/* ========================================
   12. اصلاح دکمه‌ها
======================================== */

@media (max-width: 768px) {
    body.responsive-fixer-active button,
    body.responsive-fixer-active .button,
    body.responsive-fixer-active .btn {
        width: 100% !important;
        max-width: 100% !important;
        margin: 5px 0 !important;
    }
}

/* ========================================
   13. اصلاح فرم‌ها
======================================== */

@media (max-width: 768px) {
    body.responsive-fixer-active form {
        max-width: 100% !important;
    }
    
    body.responsive-fixer-active input[type="text"],
    body.responsive-fixer-active input[type="email"],
    body.responsive-fixer-active input[type="password"],
    body.responsive-fixer-active input[type="tel"],
    body.responsive-fixer-active input[type="url"],
    body.responsive-fixer-active textarea,
    body.responsive-fixer-active select {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ========================================
   14. پیشگیری از zoom خودکار در iOS
======================================== */

@media (max-width: 768px) {
    body.responsive-fixer-active input,
    body.responsive-fixer-active textarea,
    body.responsive-fixer-active select {
        font-size: 16px !important;
    }
}

/* ========================================
   15. اصلاحات نهایی و پشتیبان
======================================== */

/* حذف هرگونه اسکرول افقی احتمالی */
body.responsive-fixer-active #page,
body.responsive-fixer-active #wrapper,
body.responsive-fixer-active #container,
body.responsive-fixer-active .site,
body.responsive-fixer-active .page-wrapper {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

/* اطمینان از عدم وجود فضای خالی */
body.responsive-fixer-active {
    margin: 0 !important;
    padding: 0 !important;
}

/* بهینه‌سازی برای RTL */
body.responsive-fixer-active.rtl {
    direction: rtl !important;
    text-align: right !important;
}

/* ========================================
   16. Animations و Transitions
======================================== */

body.responsive-fixer-active * {
    transition: max-width 0.3s ease !important;
}

/* ========================================
   17. Print Styles
======================================== */

@media print {
    body.responsive-fixer-active {
        max-width: 100% !important;
        overflow: visible !important;
    }
    
    body.responsive-fixer-active * {
        max-width: 100% !important;
        overflow: visible !important;
    }
}
