﻿/* --- Tablet & Medium Screen (769px - 1199px) --- */
@media (min-width: 769px) and (max-width: 1199px) {
    body .side-drawer {
        width: 90% !important;
        right: -100%;
        transition: right 0.3s ease !important;
    }

    .mobile-menu-btn {
        background: none;
        border: none;
        font-size: 24px;
        color: #334155;
        cursor: pointer;
        padding: 5px;
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        height: 100%;
        z-index: 1001;
    }

        .sidebar.mobile-open {
            left: 0;
        }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }



}
/* --- Mobile & Small Screen Integrated (width <= 798px) --- */
@media (width <= 798px) {
    /* [1. 網格與清單模式優化] */
    .dashboard-custom-grid.is-list {
        grid-template-columns: 1fr !important;
        padding: 10px !important;
    }

    .tag-container {
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box;
    }

    .path-name {
        width: auto !important;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .tag-icon {
        flex-shrink: 0;
    }

    .content-scroll-area {
        padding: 20px;
        padding-bottom: 100px !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* [2. Modal 彈窗修正 - 解決 image_3a8e9f 溢出問題] */
    .modal-container {
        width: 95% !important;
        padding: 15px !important;
        height: 90% !important;
    }

    .modal-alert {
        width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        font-size: 12px;
    }

    .modal-selection-grid {
        grid-template-columns: 1fr !important;
        padding-bottom: 110px !important;
    }
    /* 縮小數據字體防止撐開 */
    /*.detail-lab, .detail-val {
        font-size: 1.5rem !important;
    }*/

    .card-main-val {
        font-size: 1.25rem !important;
    }

    .modal-hint {
        display: none;
    }

    /* [3. 側邊欄與導航按鈕] */
    .mobile-menu-btn {
        background: none;
        border: none;
        font-size: 24px;
        color: #334155;
        cursor: pointer;
        padding: 5px;
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        height: 100%;
        z-index: 1001;
    }

        .sidebar.mobile-open {
            left: 0;
        }

    .side-drawer {
        width: 90% !important;
        right: -100%;
        height: 110vh !important;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* [4. 使用者資訊與元件縮放] */
    .user-name, .tasks-text, .desktop-only, .logout-btn {
        display: none;
    }

    .user-info {
        font-size: 13px;
    }

    .user-role {
        font-size: 12px;
    }

    .tasks-badge {
        font-size: 11px;
        padding: 3px 8px;
        position: relative;
        display: flex;
        align-items: center;
    }

    .tasks-count {
        font-size: 11px;
        padding: 1px 6px;
        position: absolute;
        top: 0;
        right: -5px;
        border: 2px solid white;
        background: #ef4444;
        color: white;
        border-radius: 20px;
    }

    .menu-level-1, .menu-level-2 {
        padding: 14px 15px;
        min-height: 44px;
    }

    .draggable-source {
        padding: 10px 12px;
        min-height: 44px;
        position: relative;
    }

        .draggable-source::after {
            content: "長按拖曳";
            position: absolute;
            right: 8px;
            font-size: 10px;
            color: #64748b;
            opacity: 0.6;
        }

    .card {
        min-height: 140px;
    }

    .delete-btn {
        width: 32px;
        height: 32px;
        line-height: 32px;
        font-size: 20px;
    }

    .section-title {
        display: flex;
        justify-content: space-between;
        flex-direction: column;
    }
    .setting-item {
        flex-direction: column;
    }
    .time-detail {
        flex-direction: column;
    }
    body {
        -webkit-text-size-adjust: 100%;
    }
}

/* --- Metrics Grid Waterfall --- */
@media (max-width: 1100px) {
    .metrics-grid {
        column-count: 2;
    }
}

@media (max-width: 700px) {
    .metrics-grid {
        column-count: 1;
    }
}
