/* ════════════════════════════════════════════════════════════
   EDITOR-MOBILE.CSS — Responsive (< 768px)
   Sidebar trái → Bottom Sheet / Tab Navigation
   Canvas chiếm tối đa phần trên màn hình
   ════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

    /* Shell chuyển sang xếp dọc */
    .editor-shell {
        flex-direction: column;
    }

    /* ── WORKSPACE chiếm phần trên ── */
    .editor-workspace {
        flex: 1;
        height: auto;
        min-height: 0;          /* cho phép co lại */
        width: 100%;
        order: 1;               /* lên trên */
        padding-bottom: 0;
    }

    .canvas-stage {
        padding: 70px 16px 16px;
    }

    .mockup-wrapper {
        max-width: 78vw;
    }

    /* View toggle nhỏ gọn hơn trên mobile */
    .view-toggle { top: 14px; }
    .view-toggle-btn {
        font-size: 13px;
        padding: 7px 18px;
    }

    /* DPI badge gọn lại, nằm góc trên phải */
    .dpi-badge {
        top: 12px;
        right: 12px;
        max-width: 64vw;
        padding: 7px 11px;
        font-size: 12px;
    }

    /* ════════════════════════════════════════════════════════
       SIDEBAR → BOTTOM SHEET
       ════════════════════════════════════════════════════════ */
    .editor-sidebar {
        order: 2;               /* xuống dưới */
        width: 100%;
        min-width: 100%;
        height: auto;
        max-height: 45vh;       /* không che hết canvas */
        border-right: none;
        border-top: 1px solid var(--c-border);
        border-radius: var(--r-lg, 16px) var(--r-lg, 16px) 0 0;
        box-shadow: 0 -6px 24px rgba(0,0,0,0.10);
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
    }

    /* "Tay nắm" kéo của bottom sheet */
    .editor-sidebar::before {
        content: "";
        display: block;
        width: 40px;
        height: 4px;
        background: #d1d5db;
        border-radius: var(--r-pill, 999px);
        margin: 8px auto 2px;
    }

    /* Brand thu gọn */
    .sidebar-brand {
        padding: 6px 20px 10px;
        font-size: 14px;
        justify-content: center;
        border-bottom: 1px solid var(--c-border);
    }

    .sidebar-scroll {
        padding: 14px 16px;
        gap: 16px;
    }

    /* Tool buttons xếp ngang trên mobile (tab-style) */
    .tool-group {
        flex-direction: row;
        gap: 10px;
    }
    .tool-btn {
        flex: 1;
        flex-direction: column;
        gap: 6px;
        padding: 12px 8px;
        font-size: 12px;
        text-align: center;
    }
    .tool-btn i { font-size: 18px; }

    /* Layers panel thấp hơn */
    .layers-panel { min-height: 90px; }
    .layers-empty { padding: 16px 12px; }
    .layers-empty i { font-size: 22px; }

    /* Footer dính trong sheet */
    .sidebar-footer {
        padding: 12px 16px;
        position: sticky;
        bottom: 0;
    }
    .btn-order { padding: 12px; font-size: 14px; }
}

/* ── Màn hình rất nhỏ (< 380px) ── */
@media (max-width: 380px) {
    .mockup-wrapper { max-width: 86vw; }
    .view-toggle-btn { padding: 6px 14px; font-size: 12px; }
    .sidebar-brand span { display: none; }   /* chỉ giữ icon */
}

/* ── Tablet (768px – 1024px): sidebar hẹp hơn chút ── */
@media (min-width: 769px) and (max-width: 1024px) {
    :root { --sidebar-w: 260px; }
    .mockup-wrapper { max-width: 440px; }
}
