/* ============================================================
   stockshow-mobile.css — استایل‌های اختصاصی موبایل
   این فایل روی viewport ≤ 768px اعمال می‌شود.
   ============================================================ */

/* ---------- Mobile FAB ---------- */
.mobile-fab-container {
    display: none;
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 20px;
    z-index: 1500;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.mobile-fab-main {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(36,89,169,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s var(--transition);
    margin-right: auto;
}
.mobile-fab-main:active { transform: scale(0.92); }
.mobile-fab-main.rotated { transform: rotate(45deg); }

.mobile-fab-items {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}
.mobile-fab-items.open { display: flex; animation: fadeInUp 0.25s var(--transition); }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* FAB item با label — رفع مشکل «فقط آیکن» */
.mobile-fab-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 10px 12px;
    border-radius: 999px;
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary-light);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.2s var(--transition);
    min-height: 44px;
}
.mobile-fab-item .fab-icon {
    font-size: 20px;
    line-height: 1;
    display: inline-block;
}
.mobile-fab-item .fab-label {
    display: inline-block;
    font-size: 13px;
    color: var(--primary-dark);
}
.mobile-fab-item:hover { background: var(--primary-light); border-color: var(--primary); }
.mobile-fab-item:active { transform: scale(0.95); }

/* ---------- Bottom Sheet ---------- */
.bottom-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1800;
    opacity: 0;
    transition: opacity 0.3s var(--transition);
}
.bottom-sheet-overlay.visible { display: block; opacity: 1; }

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
    z-index: 1900;
    max-height: 85vh;
    display: none;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s var(--transition);
    will-change: transform;
}
.bottom-sheet.open {
    display: flex;
    transform: translateY(0);
}
.bottom-sheet.dragging { transition: none; }

.bs-drag-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 6px;
    cursor: grab;
    touch-action: none;
}
.bs-drag-handle::before {
    content: '';
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 999px;
}
.bs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px 16px;
    border-bottom: 1px solid var(--border);
}
.bs-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}
.bs-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: var(--text);
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.bs-close:hover { background: #e5e7eb; }
.bs-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 20px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.bs-actions {
    display: flex;
    gap: 10px;
    padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: #fafbfc;
    position: sticky;
    bottom: 0;
}
.bs-actions button {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.bs-btn-primary { background: var(--primary); color: white; }
.bs-btn-primary:active { background: var(--primary-dark); }
.bs-btn-secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border) !important;
}

/* ---------- Chips (in bottom sheet) ---------- */
.bs-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.bs-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s var(--transition);
    user-select: none;
    min-height: 38px;
}
.bs-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(36,89,169,0.3);
}
.bs-chip input { display: none; }

/* ---------- Industry list (in bottom sheet) ---------- */
.bs-industry-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.bs-industry-item {
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
}
.bs-industry-item:hover { background: var(--primary-light); }
.bs-industry-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.bs-industry-item .indus-count {
    font-size: 11px;
    background: rgba(0,0,0,0.08);
    padding: 2px 8px;
    border-radius: 999px;
}
.bs-industry-item.active .indus-count {
    background: rgba(255,255,255,0.25);
}

/* ---------- Queue sheet special: two sections ---------- */
.bs-queue-section {
    margin-bottom: 16px;
}
.bs-queue-section:last-child {
    margin-bottom: 0;
}
.bs-queue-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    margin: 0 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}
.bs-queue-section-title .section-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
}
.bs-queue-section-title .section-badge.primary-badge {
    background: #eaf2ff;
    color: var(--primary);
}
.bs-queue-section-title .section-badge.secondary-badge {
    background: #fff4e0;
    color: #c77700;
}

/* ============================================================
   MOBILE BREAKPOINT
   ============================================================ */
@media (max-width: 768px) {

    /* Header compact */
    .header-container {
        display: flex !important;
        flex-wrap: wrap;
        padding: 8px 12px !important;
        gap: 8px;
        grid-template-columns: none !important;
    }
    .header-container h2 { font-size: 14px; }
    #update-time { font-size: 10px; }
    .header-actions { gap: 6px; margin-right: auto; }
    .home-btn { padding: 6px 10px; font-size: 11px; min-height: 36px; }
    .export-btn { padding: 6px 10px; font-size: 11px; min-height: 36px; }

    /* Hide desktop-only elements */
    .filter-labels-row { display: none !important; }
    #industry-filter-panel { display: none !important; }

    /* Main layout padding */
    .main-layout {
        padding: 8px 8px calc(100px + env(safe-area-inset-bottom, 0px)) !important;
        gap: 8px;
    }
    .content-area { flex-direction: column; }

    .table-wrapper {
        border-radius: var(--radius-sm);
        max-height: calc(100vh - 100px);
    }

    /* Show FAB */
    .mobile-fab-container { display: flex; }

    /* Table more compact */
    table.dataTable thead th { font-size: 10px; padding: 6px 2px; }
    table.dataTable tbody td { font-size: 11px !important; padding: 4px !important; }

    /* Hide queue filter row on mobile (moved to bottom sheet) */
    #queue-filter-container,
    #queue-filter-secondary-container {
        display: none !important;
    }

    /* Hide column search row on mobile */
    #market-table thead tr.filters { display: none !important; }

    /* DataTables controls compact */
    .dataTables_wrapper { font-size: 12px; }
    .dataTables_filter { float: none; text-align: center; margin-bottom: 8px; }
    .dataTables_filter input { width: 60%; max-width: 240px; margin: 0; }
    .dataTables_length { float: none; text-align: center; margin-bottom: 8px; }
    .dataTables_info { float: none; text-align: center; }
    .dataTables_paginate { float: none; text-align: center; white-space: normal; }
    .dataTables_paginate .paginate_button { padding: 6px 10px !important; }

    /* Scroll body touch */
    div.dataTables_scrollBody { -webkit-overflow-scrolling: touch; }

    /* Landscape adjustment */
    @media (orientation: landscape) and (max-height: 500px) {
        .table-wrapper { max-height: calc(100vh - 80px); }
    }
}

/* ============================================================
   SMALL PHONES — up to 480px
   ============================================================ */
@media (max-width: 480px) {
    .header-container h2 { font-size: 13px; }
    #update-time { display: none; }

    .mobile-fab-item {
        padding: 8px 12px 8px 10px;
        font-size: 12px;
        min-height: 40px;
    }
    .mobile-fab-item .fab-icon { font-size: 18px; }
    .mobile-fab-item .fab-label { font-size: 12px; }

    .bs-actions button { padding: 10px 12px; font-size: 13px; }
}

/* ============================================================
   RTL adjustments
   ============================================================ */
@media (max-width: 768px) {
    .mobile-fab-container {
        left: 16px;
        right: auto;
    }
    .bs-body { direction: rtl; }
}

/* ============================================================
   Queue filters visible on mobile — اگر خواستید چیپ‌ها در هدر بمانند
   (به‌طور پیش‌فرض مخفی هستند و در Bottom Sheet نمایش داده می‌شوند)
   ============================================================ */