/* استایل‌های responsive برای موبایل و تبلت (استایل iPad در ipad.css) */

/* استایل‌های responsive برای موبایل */
@media screen and (max-width: 768px) {
    .floating-toolbar {
        right: 10px;
        padding: 8px 4px;
        border-radius: 12px;
    }
    
    .toolbar-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
        border-radius: 10px;
    }
    
    .toolbar-group {
        gap: 4px;
    }
    
    .toolbar-btn::after {
        display: none; /* مخفی کردن tooltip در موبایل */
    }
    
    .toolbar-btn::before {
        display: none;
    }
}

/* بهبود touch targets برای دستگاه‌های لمسی */
@media (hover: none) and (pointer: coarse) {
    /* برای دستگاه‌های touch-only */
    .toc-item-content,
    .list li,
    .table-btn,
    .global-search-snippet,
    .global-search-book-header {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .toc-toggle {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* حذف hover effects در touch devices */
    .toc-item:hover .toc-item-content,
    .list li:hover {
        transform: none;
    }
    
    /* بهبود کلیک‌پذیری */
    .global-search-snippet:active,
    .toc-item-content:active {
        background: #e0e0e0;
    }
    
    /* اسکرول‌بار بزرگ برای دستگاه‌های touch */
    .content::-webkit-scrollbar {
        width: 24px;
    }
    
    .content::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 12px;
        border: 4px solid #f0f0f0;
        min-height: 60px;
    }
    
    .content::-webkit-scrollbar-track {
        background: #f0f0f0;
        border-radius: 12px;
    }
    
    .content {
        scrollbar-width: auto;
        scrollbar-color: #888 #f0f0f0;
    }
}

/* بهبود scrollbar برای iPad */
.global-search-results::-webkit-scrollbar,
.toc-content::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.content::-webkit-scrollbar {
    width: 20px;
}

.global-search-results::-webkit-scrollbar-thumb,
.toc-content::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
    border: 3px solid #f0f0f0;
    min-height: 50px;
}

.global-search-results::-webkit-scrollbar-track,
.toc-content::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.global-search-results::-webkit-scrollbar-thumb:hover,
.toc-content::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* بهبود نمایش پاپ‌آپ در تبلت و موبایل */
@media screen and (max-width: 1024px) {
    .global-search-popup-header {
        padding: 15px 20px;
    }
    
    .global-search-popup-header h3 {
        font-size: 16px;
    }
    
    .global-search-popup-body {
        padding: 15px;
    }
    
    .global-search-library-selector {
        padding: 12px;
    }
    
    .global-search-input-wrapper {
        flex-direction: column;
        gap: 10px;
    }
    
    .global-search-input {
        width: 100%;
    }
    
    .global-search-btn {
        width: 100%;
    }
    
    .global-search-results {
        max-height: 50vh;
    }
}

/* استایل‌های responsive برای تبلت‌های کوچک‌تر */
@media screen and (max-width: 768px) {
    .layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    
    .sidebar {
        width: 100%;
        order: 1;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    
    .content {
        order: 2;
        padding: 15px;
    }
    
    .content-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    
    .toc-sidebar {
        width: 100%;
        min-width: auto;
        height: auto;
        max-height: 400px;
        position: relative;
        top: 0;
        order: 1;
        border-radius: 8px;
        margin-bottom: 15px;
    }
    
    .toc-sidebar.collapsed {
        width: 0;
        min-width: 0;
        height: 0;
        max-height: 0;
        margin: 0;
        padding: 0;
    }
    
    .book-text-wrapper {
        order: 2;
        width: 100%;
        /* در موبایل و تبلت کوچک، حاشیه اضافه برای Floating Toolbar را حذف می‌کنیم تا عرض متن خیلی کم نشود */
        padding-right: 20px;
    }
    
    .toc-reopen-btn {
        left: 10px; /* برای RTL در سمت چپ */
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .global-search-popup-content {
        width: 95%;
        max-width: 95%;
        max-height: 90vh;
    }
}

