/* ============================================================
   drawer.css  —  移动端底部工具栏 + 侧栏抽屉 + 遮罩
   ============================================================ */

/* ============================================================
   1. 底部工具栏
   ============================================================ */
.mobile-toolbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--c-border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    z-index: 8000;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: content-box;
}

html.layout-mobile .mobile-toolbar {
    display: flex;
}

.mobile-tool-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--c-text-muted);
    cursor: pointer;
    transition: all var(--t-base);
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    min-width: 0;
    font-family: inherit;
}

.mobile-tool-btn span {
    font-size: 0.7rem;
    font-weight: 600;
}

.mobile-tool-btn.active {
    color: var(--c-primary);
    background-color: var(--c-primary-bg-light);
}

.mobile-tool-btn:active {
    transform: scale(0.95);
}

/* ============================================================
   2. 抽屉遮罩（点击侧栏外部关闭）
   ============================================================ */
#drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    /* 必须低于侧栏(9000)高于内容，且不受 layout-* 类名影响 */
    z-index: 8999;
    opacity: 0;
    transition: opacity var(--t-base);
    /* 关键：遮罩自己吃掉点击，绝不让它变成"点不动的灰层" */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#drawer-overlay.open {
    display: block;
    opacity: 1;
}

/* 侧栏打开时，遮罩一定在最上层可点击区域 */
#drawer-overlay.open:active {
    background-color: rgba(0, 0, 0, 0.55);
}

/* ============================================================
   3. 抽屉内的关闭按钮
   ============================================================ */
.drawer-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--c-border);
    border: none;
    font-size: 1.2rem;
    color: var(--c-text);
    cursor: pointer;
    z-index: 10;
    align-items: center;
    justify-content: center;
}

html.layout-mobile .drawer-close {
    display: flex;
}

.drawer-close:hover {
    background-color: #bdbdbd;
}

/* ============================================================
   4. 移动端侧栏内的卡片间距收紧
   ============================================================ */
html.layout-mobile .side-panel > * {
    margin-bottom: 12px;
}

html.layout-mobile .side-panel > *:last-child {
    margin-bottom: 0;
}

/* ============================================================
   5. 事件日志在移动端从底部弹出
   ============================================================ */
html.layout-mobile #log-section {
    position: fixed;
    bottom: 64px;
    left: 0;
    right: 0;
    height: 60vh;
    background-color: var(--c-panel-solid);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 8500;
}

html.layout-mobile #log-section.open {
    transform: translateY(0);
}

html.layout-mobile .log-content {
    height: calc(60vh - 120px);
}