/* استایل‌های مخصوص موبایل */
@media (max-width: 1200px) {
    /* نوار آبی بالایی */
    .top-bar {
        padding: 6px 0;
        font-size: 0.8rem;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 999;
        min-height: 33px;
        transition: transform 0.3s ease;
    }
    
    .top-bar.hidden {
        transform: translateY(-100%);
    }
    
    .top-bar-content {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .slogan {
        font-size: 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 65%;
    }
    
    .contact-info {
        white-space: nowrap;
    }
    
    .contact-info a {
        font-size: 0.75rem;
        display: inline-block;
    }
    
    /* تنظیمات هدر */
    .main-header {
        padding: 10px 0;
        position: fixed;
        top: 33px; /* ارتفاع نوار آبی در موبایل */
        left: 0;
        right: 0;
        z-index: 990;
        background-color: white;
        border-bottom: 1px solid #eee;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        transition: top 0.3s ease;
        height: 61px; /* ارتفاع ثابت برای هدر اصلی در موبایل */
    }
    
    .main-header.scrolled {
        top: 0;
    }
    
    .header-content {
        align-items: center;
    }
    
    .logo img {
        height: 40px;
    }
    
    .header-search {
        margin: 0 10px;
    }
    
    .search-form input {
        padding: 6px 15px;
        background-color: #f5f5f5;
        border: none;
    }
    
    .header-actions .user-account span, 
    .header-actions .shopping-cart span {
        display: none;
    }
    
    /* تعداد محصولات سبد خرید در موبایل */
    .shopping-cart {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 5px;
    }
    
    .cart-count {
        top: -5px;
        right: -5px;
        width: 18px;
        height: 18px;
        font-size: 10px;
        background-color: #ff0000;
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        position: absolute;
        z-index: 5;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    
    .shopping-cart i {
        font-size: 1.5rem;
        color: var(--primary-color);
    }
    
    /* منوی اصلی */
    .main-navigation {
        display: none;
    }
    
    /* منوی اصلی در موبایل (همبرگر) */
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #333;
        cursor: pointer;
    }
    
    /* منوی موبایل - اصلاح شده */
    .mobile-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100%;
        background: #fff;
        z-index: 1000;
        transition: right 0.3s ease;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .mobile-menu.active {
        right: 0;
    }
    
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .menu-overlay.active {
        display: block;
    }
    
    .mobile-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px;
        border-bottom: 1px solid #eee;
    }
    
    .mobile-menu-header h3 {
        margin: 0;
        font-size: 18px;
    }
    
    .mobile-menu-close {
        background: none;
        border: none;
        font-size: 20px;
        cursor: pointer;
    }
    
    .mobile-menu-content {
        display: flex;
        flex: 1;
        overflow: hidden;
        height: calc(100% - 55px);
    }
    
    .mobile-menu-items {
        width: 40%;
        height: 100%;
        overflow-y: auto;
        background-color: #fff;
        border-left: 1px solid #eee;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain;
        touch-action: pan-y !important;
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .mobile-menu-items ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    
    .mobile-menu-item {
        display: block;
        padding: 12px 15px;
        color: #333;
        text-decoration: none;
        position: relative;
        border-bottom: 1px solid #f5f5f5;
        font-size: 14px;
    }
    
    .mobile-menu-item:hover,
    .mobile-menu-item.active {
        background-color: #f8f8f8;
        color: #4a6bef;
    }
    
    .mobile-menu-item.has-submenu:after {
        content: "\f104";
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        position: absolute;
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        color: #999;
        display: inline-block;
    }
    
    .has-submenu.active:after {
        transform: translateY(-50%) rotate(-90deg);
        color: #4a6bef;
    }
    
    .mobile-submenu-container {
        width: 60%;
        height: 100%;
        overflow-y: auto;
        background-color: #f8f8f8;
        display: block !important;
    }
    
    .mobile-submenu-categories {
        display: none;
        width: 100%;
        background-color: #f5f5f5;
        padding: 0;
        margin: 0;
        list-style: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain;
        touch-action: pan-y !important;
        user-select: none;
        -webkit-user-select: none;
    }
    
    .books-menu.active .mobile-submenu-categories {
        display: block;
        max-height: 400px;
        overflow-y: auto;
    }
    
    .mobile-submenu-categories ul {
        padding: 0;
        margin: 0;
        list-style: none;
    }
    
    .mobile-submenu-categories li a {
        display: block;
        padding: 10px 15px;
        color: #333;
        text-decoration: none;
        font-size: 14px;
        border-bottom: 1px solid #eee;
    }
    
    .mobile-submenu-categories li a:hover,
    .mobile-submenu-categories li a.active {
        background-color: #e9e9e9;
        color: #4a6bef;
    }
    
    .grade-submenu,
    .mobile-submenu {
        display: none;
        height: 100%;
        overflow-y: auto;
        background-color: #f8f8f8;
        padding: 10px 0;
        width: 100%;
        position: relative;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
    }
    
    .grade-submenu.active,
    .mobile-submenu.active {
        display: block !important;
    }
    
    .grade-submenu ul,
    .mobile-submenu ul {
        padding: 0;
        margin: 0;
        list-style: none;
    }
    
    .grade-submenu li,
    .mobile-submenu li {
        margin-bottom: 2px;
    }
    
    .grade-submenu a,
    .mobile-submenu li a {
        display: block;
        padding: 10px 15px;
        color: #333;
        text-decoration: none;
        font-size: 14px;
        border-radius: 4px;
    }
    
    .grade-submenu a:hover,
    .mobile-submenu li a:hover {
        background-color: #e9e9e9;
        color: #4a6bef;
    }
    
    /* اسکرول‌بار سفارشی */
    .mobile-menu-items::-webkit-scrollbar,
    .mobile-submenu-categories::-webkit-scrollbar,
    .grade-submenu::-webkit-scrollbar {
        width: 3px;
    }
    
    .mobile-menu-items::-webkit-scrollbar-track,
    .mobile-submenu-categories::-webkit-scrollbar-track,
    .grade-submenu::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }
    
    .mobile-menu-items::-webkit-scrollbar-thumb,
    .mobile-submenu-categories::-webkit-scrollbar-thumb,
    .grade-submenu::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 3px;
    }
    
    .mobile-menu-items::-webkit-scrollbar-thumb:hover,
    .mobile-submenu-categories::-webkit-scrollbar-thumb:hover,
    .grade-submenu::-webkit-scrollbar-thumb:hover {
        background: #aaa;
    }
    
    .mobile-menu-items li.active > a {
        background-color: #f0f3ff;
        color: #4a6bef;
    }
    
    .books-menu {
        position: relative;
    }
    
    .has-submenu {
        position: relative;
    }
    
    /* خط جدا کننده بین دو ستون منو */
    .mobile-submenu-container::before {
        content: "";
        position: absolute;
        top: 0;
        right: 40%;
        width: 1px;
        height: 100%;
        background-color: transparent;
        z-index: 5;
        display: none;
    }
    
    /* اسلایدر اصلی و پرفروش‌ها */
    .banner-bestsellers-section {
        flex-direction: column;
        gap: 15px;
        margin: 15px auto;
        padding: 0 15px;
    }
    
    .banner-section {
        flex: 1;
        width: 100%;
        margin: 0;
        height: 280px; /* ارتفاع ثابت */
        min-height: 280px;
        max-height: 280px;
        position: relative;
        overflow: hidden;
        border-radius: 12px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        transform: translateZ(0);
        will-change: transform;
    }
    
    /* بنر اصلی - بهینه‌سازی کامل */
    .main-slider {
        position: relative;
        width: 100%;
        height: 280px; /* ارتفاع ثابت */
        min-height: 280px;
        max-height: 280px;
        overflow: hidden;
        border-radius: 12px;
        background-color: #fff;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        transform: translateZ(0);
        perspective: 1000;
        touch-action: pan-x pan-y; /* اجازه هر دو حرکت افقی و عمودی */
        user-select: none;
        -webkit-user-select: none;
    }
    
    .slide {
        position: absolute;
        top: 0;
        right: 0;
        width: 100%;
        height: 280px; /* ارتفاع ثابت */
        min-height: 280px;
        max-height: 280px;
        opacity: 0;
        visibility: hidden;
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 20px;
        background: #fff;
        transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
        transform: translateX(100%) translateZ(0);
        will-change: transform, opacity;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    .slide.active {
        opacity: 1;
        visibility: visible;
        transform: translateX(0) translateZ(0);
        z-index: 10;
    }
    
    .slide-content {
        flex: 1;
        padding: a4px 5px 4px 0;
        z-index: 5;
    }
    
    .slide-image {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        padding-right: 5px;
        z-index: 5;
    }
    
    .slide-image img {
        max-width: 100%;
        max-height: 200px;
        object-fit: contain;
    }
    
    .slide-content h2 {
        font-size: 1.3rem;
        margin-bottom: 10px;
        color: #333;
    }
    
    .slide-content p {
        font-size: 0.9rem;
        margin-bottom: 15px;
        color: #666;
    }
    
    .slide-description {
        display: none;
    }
    
    .slide .btn {
        display: inline-block;
        background-color: var(--primary-color);
        color: white;
        padding: 8px 16px;
        border-radius: 6px;
        font-size: 0.9rem;
        text-decoration: none;
        margin-top: 10px;
        font-weight: 500;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        transition: all 0.3s ease;
    }
    
    .slide .btn:hover {
        background-color: #0e61b5;
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
    
    /* کنترل‌های اسلایدر */
    .slider-controls {
        position: absolute;
        bottom: 15px;
        left: 0;
        right: 0;
        width: 100%;
        display: flex;
        justify-content: space-between;
        padding: 0 15px;
        z-index: 50;
        pointer-events: none;
    }
    
    .slider-prev, .slider-next {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background-color: rgba(255, 255, 255, 0.9);
        border: 1px solid #eee;
        color: #333;
        cursor: pointer;
        box-shadow: 0 3px 8px rgba(0,0,0,0.15);
        z-index: 100;
        outline: none;
        -webkit-tap-highlight-color: transparent;
        -webkit-user-select: none;
        user-select: none;
        touch-action: manipulation;
        transition: all 0.2s ease-in-out;
        pointer-events: auto;
        position: relative;
    }
    
    .slider-prev:active, .slider-next:active {
        background-color: #f0f0f0;
        transform: scale(0.95);
    }
    
    .slider-prev i, .slider-next i {
        font-size: 16px;
        pointer-events: none;
    }
    
    .slider-prev::after, .slider-next::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 50%;
        background: rgba(0,0,0,0.1);
        opacity: 0;
        transition: opacity 0.2s ease;
    }
    
    .slider-prev:hover::after, .slider-next:hover::after {
        opacity: 1;
    }
    
    /* بخش پرفروش ها */
    .bestsellers-section {
        display: none; /* مخفی کردن بخش پرفروش‌ها در موبایل */
    }
    
    /* تنظیمات دکمه‌های ناوبری پرفروش‌ها در موبایل */
    .bestseller-nav-btns {
        bottom: 15px; /* افزایش فاصله از پایین */
    }

    .bestseller-nav-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .bestseller-nav-btn.prev-bestseller {
        right: 15px; /* افزایش فاصله از لبه راست */
        bottom: 0;
    }

    .bestseller-nav-btn.next-bestseller {
        left: 15px; /* افزایش فاصله از لبه چپ */
        bottom: 0;
    }
    
    .bestsellers-box {
        flex-direction: column-reverse;
        padding: 15px;
        height: 280px; /* ارتفاع ثابت برای جلوگیری از تغییر اندازه */
        overflow-x: hidden;
        touch-action: pan-x;
        -webkit-overflow-scrolling: touch;
        -webkit-tap-highlight-color: transparent;
        will-change: transform;
        transform: translateZ(0);
        backface-visibility: hidden;
        transition: transform 0.2s ease;
    }
    
    .bestseller-content {
        text-align: center;
        padding: 15px 10px 0;
        height: 80px; /* ارتفاع ثابت برای محتوا */
        display: flex;
        flex-direction: column;
        justify-content: center;
        box-sizing: border-box;
    }
    
    .bestseller-title {
        font-size: 1rem;
        line-height: 1.3;
        height: 42px; /* ارتفاع دقیقاً دو خط */
        min-height: 42px; /* حداقل ارتفاع دو خط */
        max-height: 42px; /* حداکثر ارتفاع دو خط */
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        margin: 0;
        padding: 0;
    }
    
    .bestseller-image {
        height: 180px; /* ارتفاع ثابت برای تصویر */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .bestseller-image img {
        max-height: 180px;
        touch-action: none;
        -webkit-user-drag: none;
        user-select: none;
        -webkit-user-select: none;
        object-fit: contain;
    }
    
    .bestseller-item {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%; /* ارتفاع کامل برای پر کردن باکس والد */
        opacity: 0;
        visibility: hidden;
        transform: translateX(100%);
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0.25s;
        will-change: transform, opacity;
        display: flex;
        flex-direction: column;
    }
    
    .bestseller-item.active {
        position: relative;
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
        transition: opacity 0.25s ease, transform 0.25s ease;
        height: 100%; /* ارتفاع کامل برای آیتم فعال */
    }
    
    .bestseller-nav {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
        margin-top: 15px;
    }
    
    .bestseller-nav-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background-color: #f5f5f5;
        border: none;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        color: #333;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        transition: background-color 0.2s ease, transform 0.2s ease;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .bestseller-nav-btn:active {
        transform: scale(0.95);
        background-color: #e0e0e0;
    }
    
    @supports (-webkit-touch-callout: none) {
        /* Специфические стили для iOS устройств */
        .bestseller-item {
            -webkit-transform: translate3d(100%, 0, 0);
            transform: translate3d(100%, 0, 0);
        }
        
        .bestseller-item.active {
            -webkit-transform: translate3d(0, 0, 0);
            transform: translate3d(0, 0, 0);
        }
        
        .bestsellers-box {
            -webkit-backface-visibility: hidden;
            -webkit-perspective: 1000;
        }
    }
    
    /* اصلاح مشکل اندروید برای bestseller-item */
    @media (hover: none) and (pointer: coarse) {
        .bestsellers-box {
            /* تنظیمات بهینه‌شده برای صفحات لمسی */
            touch-action: manipulation;
            user-select: none;
            -webkit-user-select: none;
        }
        
        .bestseller-item {
            transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0.2s;
        }
        
        .bestseller-item.active {
            transition: opacity 0.2s ease, transform 0.2s ease;
        }
        
        .bestseller-nav-btn {
            min-width: 44px;
            min-height: 44px;
        }
    }
    
    /* بنرهای تبلیغاتی */
    .promo-section {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
        margin: 20px 0;
    }
    
    .promo-banner {
        height: 200px;
        min-height: 110px;
        border-radius: 10px;
    }
    
    /* استایل بنر کودک توانا در موبایل */
    .promo-banner[style*="background-image: url('../images/child-box.png')"] {
        background-size: cover;
        background-position: center;
    }
    
    /* استایل بنر مجله تیزهوشان در موبایل */
    .promo-banner[style*="background-color: #e1e9f8"] {
        background-size: 50% auto;
        background-position: bottom left;
    }
    
    /* استایل مجموعه 12 آزمون در موبایل */
    .promo-banner[style*="background: linear-gradient(to bottom, #E1E9F8 70%, #F9BE25 30%)"] {
        background: linear-gradient(to bottom, #E1E9F8 70%, #F9BE25 30%) !important;
    }

    .promo-banner[style*="background: linear-gradient(to bottom, #E1E9F8 70%, #F9BE25 30%)"] .promo-content {
        background: transparent;
        color: #333;
    }

    .promo-banner[style*="background: linear-gradient(to bottom, #E1E9F8 70%, #F9BE25 30%)"] .promo-title,
    .promo-banner[style*="background: linear-gradient(to bottom, #E1E9F8 70%, #F9BE25 30%)"] .promo-text,
    .promo-banner[style*="background: linear-gradient(to bottom, #E1E9F8 70%, #F9BE25 30%)"] .promo-grade {
        color: #333;
    }
    
    .promo-content {
        width: 100%;
        padding: 15px;
        background: linear-gradient(to right, rgba(0,0,0,0.7), transparent);
    }
    
    .promo-title {
        color: white;
        font-size: 1.2rem;
        margin-bottom: 5px;
    }
    
    .promo-text {
        color: rgba(255,255,255,0.9);
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
    
    .see-all-link {
        color: white;
    }
    
    .promo-image {
        width: 35%;
        height: 200px;
    }
    
    /* بخش کتاب ها */
    .section-header {
        margin-bottom: 15px;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .book-card {
        flex: 0 0 150px;
    }
    
    .book-img {
        height: 170px;
    }
    
    .book-title {
        font-size: 0.85rem;
    }
    
    .book-grade {
        font-size: 0.7rem;
    }
    
    .book-price {
        font-size: 0.9rem;
    }
    
    /* فوتر */
    .site-footer {
        padding: 30px 0 20px;
        margin-top: 30px;
    }
    
    .footer-content {
        display: flex;
        flex-direction: column;
        gap: 25px;
    }
    
    .footer-about {
        text-align: center;
        flex-direction: column;
        align-items: center;
        padding-bottom: 15px;
    }
    
    .footer-about p {
        text-align: center;
        margin: 0;
    }
    
    .footer-bottom-section {
        display: grid;
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .footer-offices {
        margin-top: 0;
    }
    
    .footer-logo {
        margin: 0 auto 15px;
        height: 45px;
    }
    
    .footer-title {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .footer-links,
    .social-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .footer-links li {
        margin: 0 10px 5px 0;
    }
    
    /* ایجاد فضای خالی برای جلوگیری از پوشاندن محتوا توسط هدر فیکس شده */
    body {
        padding-top: 94px; /* ارتفاع نوار آبی + هدر در موبایل */
    }
    
    .tabs-nav {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none;
        scroll-behavior: smooth;
        touch-action: pan-x;
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
        padding-bottom: 5px;
        transform: translateZ(0);
        will-change: scroll-position;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        position: relative;
        z-index: 5;
        scroll-snap-type: x mandatory;
        display: flex;
        gap: 8px;
        padding: 0 10px;
    }
    
    .tabs-nav::-webkit-scrollbar {
        display: none;
    }
    
    .tabs-nav .tab-btn {
        scroll-snap-align: start;
        flex-shrink: 0;
        min-width: max-content;
        margin: 0;
        padding: 12px 16px;
        font-size: 0.85rem;
    }
    
    /* برای موبایل‌های کوچک‌تر */
    @media (max-width: 480px) {
        .tabs-nav {
            gap: 6px;
            padding: 0 8px;
        }
        
        .tabs-nav .tab-btn {
            padding: 10px 12px;
            font-size: 0.8rem;
        }
    }
    
    .books-slider {
        display: flex;
        gap: 15px;
        overflow-x: auto;
        padding: 10px 5px;
        scroll-snap-type: x mandatory;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth;
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
        transform: translateZ(0);
        will-change: scroll-position;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        overscroll-behavior-x: contain;
        overscroll-behavior-y: auto;
    }
    
    .books-slider::-webkit-scrollbar {
        height: 3px;
    }
    
    .books-slider::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }
    
    .books-slider::-webkit-scrollbar-thumb {
        background: #ddd;
        border-radius: 3px;
    }
    
    .books-slider .book-card {
        scroll-snap-align: start;
        transform: translateZ(0);
    }
    
    /* منوی موبایل - استایل زیرمنوها */
    .mobile-menu-items .dropdown .mobile-dropdown-menu {
        display: none;
        padding-right: 15px;
        border-right: 1px solid #eee;
        margin: 5px 15px 5px 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }
    
    .mobile-menu-items .dropdown.active .mobile-dropdown-menu {
        display: block;
        max-height: 2000px; /* یک مقدار بزرگ برای نمایش همه آیتم‌ها */
    }
    
    .mobile-dropdown-menu li {
        position: relative;
    }
    
    .mobile-dropdown-menu li.has-submenu > a {
        display: flex;
        justify-content: space-between;
        position: relative;
        padding-left: 25px;
    }
    
    .mobile-dropdown-menu li.has-submenu > a::after {
        content: "\f107";
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.3s ease;
    }
    
    .mobile-dropdown-menu li.has-submenu.active > a::after {
        transform: translateY(-50%) rotate(180deg);
    }
    
    .mobile-dropdown-menu li.has-submenu .mobile-submenu {
        display: none;
        padding-right: 15px;
        border-right: 1px solid #eee;
        margin: 5px 15px 5px 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }
    
    .mobile-dropdown-menu li.has-submenu.active .mobile-submenu {
        display: block;
        max-height: 2000px; /* یک مقدار بزرگ برای نمایش همه آیتم‌ها */
    }
    
    .mobile-submenu li {
        padding-right: 15px;
    }
    
    .mobile-submenu li a {
        font-size: 0.9rem;
        color: #737373 !important;
    }
    
    .mobile-menu .has-submenu.active > a {
        color: var(--primary-color);
    }
    
    .mobile-menu .has-submenu.active > a::after {
        transform: rotate(180deg);
    }
    
    /* طراحی اسکرول منوهای موبایل */
    .mobile-dropdown-menu::-webkit-scrollbar,
    .mobile-submenu::-webkit-scrollbar {
        width: 4px;
    }
    
    .mobile-dropdown-menu::-webkit-scrollbar-track,
    .mobile-submenu::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }
    
    .mobile-dropdown-menu::-webkit-scrollbar-thumb,
    .mobile-submenu::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 4px;
    }
    
    .mobile-dropdown-menu::-webkit-scrollbar-thumb:hover,
    .mobile-submenu::-webkit-scrollbar-thumb:hover {
        background: #aaa;
    }
    
    /* پرفروش‌ها در موبایل */
    .bestseller-nav {
        position: absolute;
        width: 100%;
        top: 40%;
        left: 0;
        right: 0;
        z-index: 3;
        display: flex !important;
        justify-content: space-between;
        padding: 0 10px;
    }
    
    .bestseller-nav-btn {
        width: 35px;
        height: 35px;
        border-radius: 50%;
        background-color: rgba(255, 255, 255, 0.9);
        border: 1px solid #eee;
        display: flex !important;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
        opacity: 0.9;
    }
    
    .bestseller-nav-btn:hover {
        background-color: var(--primary-color);
        color: white;
    }

    /* استایل‌های پاپ آپ ورود و ثبت نام در موبایل */
    .user-dropdown {
        width: 90%;
        max-width: 350px;
        height: 100vh;
        max-height: 100vh;
        overflow-y: auto;
        padding-bottom: 20px;
    }
    
    .user-dropdown-header {
        position: sticky;
        top: 0;
        background-color: white;
        z-index: 10;
        padding-top: 10px;
    }
    
    .auth-tabs {
        position: sticky;
        top: 50px;
        background-color: white;
        z-index: 10;
    }
    
    .auth-content {
        max-height: none;
        overflow-y: visible;
        padding-right: 5px;
        padding-bottom: 50px;
    }
    
    .form-group {
        margin-bottom: 10px;
    }
    
    .form-group label {
        font-size: 0.8rem;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 7px 10px;
        font-size: 0.85rem;
    }
    
    .auth-btn {
        padding: 8px;
    }
}

@media (max-width: 576px) {
    .top-bar {
        padding: 5px 0;
        font-size: 0.7rem;
        min-height: 30px;
    }
    
    .slogan {
        display: none; /* مخفی کردن اسلوگان در صفحات کوچک */
    }
    
    .contact-info {
        width: 100%;
        text-align: center;
    }
    
    .contact-info a {
        font-size: 0.7rem;
    }
    
    .main-header {
        padding: 8px 0;
        top: 30px; /* ارتفاع نوار آبی در صفحات کوچکتر */
        transition: top 0.3s ease;
        height: 57px; /* ارتفاع ثابت برای هدر اصلی در صفحات کوچکتر */
    }
    
    .main-header.scrolled {
        top: 0;
    }
    
    .logo img {
        height: 35px;
    }
    
    .search-form input {
        font-size: 0.8rem;
    }
    
    .bestseller-image img {
        max-height: 150px;
    }
    
    .promo-content {
        width: 70%;
    }
    
    .promo-image {
        width: 30%;
    }
    
    .book-card {
        flex: 0 0 140px;
    }
    
    .book-img {
        height: 150px;
    }
    
    .footer-bottom {
        font-size: 0.8rem;
    }
    
    body {
        padding-top: 87px; /* ارتفاع نوار آبی + هدر در صفحات کوچکتر */
    }
    
    .promo-banner {
        height: 180px;
    }
    
    /* استایل بنر کودک توانا در موبایل کوچک */
    .promo-banner[style*="background-image: url('../images/child-box.png')"] {
        background-size: cover;
        background-position: center;
    }
    
    /* استایل بنر مجله تیزهوشان در موبایل کوچک */
    .promo-banner[style*="background-color: #e1e9f8"] {
        background-size: 45% auto;
        background-position: bottom left;
    }
    
    .promo-content {
        padding: 12px;
    }
    
    .promo-title {
        font-size: 1.1rem;
    }
    
    .promo-text {
        font-size: 0.85rem;
    }
    
    /* بهبود اسلایدر اصلی در صفحات کوچک */
    .main-slider {
        height: 300px;
    }
    
    .slide-content h2 {
        font-size: 1.1rem;
        margin-bottom: 5px;
    }
    
    .slide-content p {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }
    
    .slide-image img {
        max-height: 150px;
    }
    
    .slide .btn {
        padding: 6px 14px;
        font-size: 0.85rem;
    }
    
    .slider-prev, .slider-next {
        width: 35px;
        height: 35px;
    }
    
    .slider-prev i, .slider-next i {
        font-size: 14px;
    }
}

/* انیمیشن زیرمنوها در موبایل */
.mobile-submenu {
    position: relative;
    transform: none;
    opacity: 1;
    visibility: visible;
    transition: none;
}

.mobile-menu .has-submenu.active > a {
    color: var(--primary-color);
}

.mobile-menu .has-submenu.active > a::after {
    transform: rotate(180deg);
}

/* اسکرول منو */
.mobile-menu-content::-webkit-scrollbar {
    width: 4px;
}

.mobile-menu-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.mobile-menu-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.mobile-menu-content::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* اسلایدر در موبایل */
@media (max-width: 767px) {
    .slide-content h2 {
        font-size: 1.2rem;
    }
    
    .slide-content p {
        font-size: 0.9rem;
    }
    
    .slider-prev, .slider-next {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        transform: translateZ(0);
    }
    
    /* تنظیمات بهتر برای اسلایدر اصلی */
    .main-slider {
        height: 280px;
        -webkit-transform-style: preserve-3d;
        transform-style: preserve-3d;
    }
    
    /* بهبود کارت کتاب‌ها */
    .book-card {
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* بهبود تب‌ها در موبایل */
    .tabs {
        margin-bottom: 20px;
        position: relative;
    }
    
    .tabs-content {
        position: relative;
        min-height: 200px;
        overflow: hidden;
    }
    
    .tab-pane {
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
        position: relative;
    }
    
    .tab-pane.active {
        display: block;
        opacity: 1;
    }
    
    /* بهبود دکمه‌های تب در موبایل */
    .tab-btn {
        white-space: nowrap;
        padding: 12px 16px;
        border: none;
        background-color: transparent;
        font-family: 'IRANSans';
        font-weight: 500;
        font-size: 0.9rem;
        color: #666;
        position: relative;
        margin: 0 3px;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.3s ease;
        border-radius: 8px;
        min-width: 80px;
        text-align: center;
        touch-action: manipulation;
        -webkit-user-select: none;
        user-select: none;
    }
    
    .tab-btn.active {
        color: var(--primary-color);
        background-color: rgba(75, 123, 236, 0.1);
    }
    
    .tab-btn.active::after {
        content: '';
        position: absolute;
        bottom: -1px;
        right: 0;
        left: 0;
        height: 2px;
        background-color: var(--primary-color);
        border-radius: 1px;
    }
    
    /* بهبود عملکرد touch در تب‌ها */
    .tabs-nav.touching {
        cursor: grabbing;
    }
    
    .tabs-nav.scrolling {
        pointer-events: none;
    }
    
    .tabs-nav.scrolling .tab-btn {
        pointer-events: none;
    }
    
    /* بهبود نمایش تب‌ها در موبایل */
    .tabs-content {
        overflow: hidden;
    }
    
    .tab-pane {
        width: 100%;
    }
    
    /* کاهش زمان انیمیشن‌ها */
    .tab-pane {
        transition: opacity 0.3s ease;
    }
    
    /* بهبود عملکرد تصاویر در موبایل */
    img {
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

.cart-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    background-color: white;
    z-index: 9999;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cart-sidebar.open {
    left: 0;
}

/* اضافه کردن استایل دسکتاپ برای سبد خرید */
@media (min-width: 769px) {
    .cart-sidebar {
        width: 400px;
        right: auto;
        left: -400px;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
    }
    
    .cart-sidebar.open {
        left: 0;
    }
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    height: calc(100vh - 160px);
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain;
    touch-action: pan-y !important;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

/* استایل هدر سبد خرید */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background-color: #fff;
    z-index: 10;
    position: relative;
}

.cart-header h3 {
    margin: 0;
    font-size: 16px;
}

.close-cart {
    border: none;
    background: transparent;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 5px;
}

/* استایل فوتر سبد خرید */
.cart-footer {
    background-color: #fff;
    padding: 15px 20px;
    border-top: 1px solid #eee;
    position: relative;
    z-index: 10;
    /* اضافه کردن padding-bottom برای جلوگیری از پوشاندن دکمه توسط نوار ناوبری دستگاه */
    padding-bottom: calc(25px + env(safe-area-inset-bottom, 20px));
    margin-bottom: env(safe-area-inset-bottom, 0);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: bold;
}

.btn-checkout {
    display: block;
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s;
    border: none;
    /* تنظیم ارتفاع مناسب برای دکمه‌ها در موبایل */
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: env(safe-area-inset-bottom, 15px);
    position: relative;
    z-index: 100;
}

.btn-checkout:hover,
.btn-checkout:active {
    background-color: #3a55d1;
}

.cart-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    position: relative;
    display: flex;
    align-items: center;
}

/* استایل تصاویر محصولات در سبد خرید موبایل */
.cart-item-image {
    width: 50px;
    height: 70px;
    margin-left: 12px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #f0f0f0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info {
    flex: 1;
}

.cart-item-info h4 {
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: var(--text-color);
    font-weight: 500;
}

.cart-item-price {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
}

.cart-item-price .discount {
    font-size: 0.75rem;
    color: #999;
    text-decoration: line-through;
    margin-left: 5px;
    display: inline-block;
    font-weight: normal;
}

.cart-item-price .final-price {
    color: var(--primary-color);
    font-weight: 600;
}

.remove-item {
    background: none;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    padding: 6px;
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

/* اطمینان از نمایش صحیح منوی موبایل و زیرمنوها */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* اضافه کردن padding-bottom برای فضای بیشتر در پایین منو */
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100% - 55px - env(safe-area-inset-bottom, 0px));
}

.mobile-menu-header {
    z-index: 2;
    background: #fff;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.mobile-menu-close {
    background: transparent;
    border: none;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* بهبود اسکرول‌بار همه بخش‌ها */
*::-webkit-scrollbar {
    width: 3px;
    height: 3px;
}

*::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
    width: 3px;
    height: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* بهبود انیمیشن اسلایدر و تب‌ها در موبایل */
@media (max-width: 767px) {
    /* سرعت دادن به انیمیشن‌ها برای عملکرد روان‌تر */
    * {
        transition-duration: 0.3s !important;
    }
    
    /* اضافه کردن CSS خاص برای دستگاه‌های اندروید */
    @supports (padding-bottom: constant(safe-area-inset-bottom)) or (padding-bottom: env(safe-area-inset-bottom)) {
        .cart-footer {
            padding-bottom: calc(15px + env(safe-area-inset-bottom, 15px));
        }
        
        .mobile-menu {
            height: calc(100% - env(safe-area-inset-bottom, 0px));
        }
        
        .mobile-menu-content {
            height: calc(100% - 55px - env(safe-area-inset-bottom, 15px));
        }
        
        /* اضافه کردن padding-bottom برای بخش‌هایی که ممکن است با نوار پایین گوشی تداخل پیدا کنند */
        .main-content {
            padding-bottom: env(safe-area-inset-bottom, 15px);
        }
    }
    
    /* فیکس مشکل اندروید با افزودن فاصله بیشتر در پایین */
    .cart-footer {
        padding-bottom: 25px;
    }
    
    .btn-checkout {
        position: relative;
        z-index: 10;
        margin-bottom: 10px;
    }
}

/* اصلاح مشکل مخفی شدن دکمه در اندروید */
@media (max-width: 767px) {
    /* کاهش ارتفاع بخش آیتم‌های سبد خرید برای اطمینان از نمایش فوتر */
    .cart-items {
        height: calc(100vh - 220px);
        padding-bottom: 40px;
    }
    
    /* اضافه کردن CSS خاص برای دستگاه‌های اندروید */
    @supports (-webkit-touch-callout: none) {
        .cart-footer {
            padding-bottom: 60px;
            bottom: 0;
            position: sticky;
            box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        }
        
        .btn-checkout {
            margin-bottom: 30px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
        }
    }
    
    /* تنظیمات خاص برای مرورگر کروم اندروید */
    @supports (-webkit-appearance: none) {
        .cart-footer {
            padding-bottom: 70px;
        }
        
        .btn-checkout {
            margin-bottom: 45px;
        }
    }
}

@media (max-width: 480px) {
    /* تنظیمات مخصوص موبایل کوچک برای منوی کاربری */
    .user-dropdown {
        width: 100%;
        max-width: 100%;
        left: -100%;
    }
    
    .user-dropdown.show {
        left: 0;
    }
} 