/* ══════════════════════════════════════════════════════════
   可拖动弹窗（通用）
   - 桌面：浮动窗口，标题栏可拖动
   - 移动端(<768px)：退化为底部抽屉
══════════════════════════════════════════════════════════ */

.dm-modal {
    position: fixed;
    z-index: 9999;
    display: none;
    flex-direction: column;
    width: 480px;
    height: 480px;
    min-width: 320px;
    min-height: 240px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    font-size: 14px;
    color: #1f2937;
    resize: both;
}

/* 自定义 resize 角标（视觉提示） */
.dm-modal::after {
    content: "";
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 14px;
    height: 14px;
    pointer-events: none;
    background-image:
        linear-gradient(135deg, transparent 0 6px, rgba(99, 102, 241, 0.55) 6px 8px, transparent 8px 10px, rgba(99, 102, 241, 0.55) 10px 12px, transparent 12px);
    opacity: 0.9;
}

.dm-modal.dm-visible {
    display: flex;
    animation: dm-fade-in 0.18s ease-out;
}

@keyframes dm-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dm-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(135deg, var(--hero-indigo-from, #818cf8), var(--hero-indigo-to, #6366f1));
    color: #ffffff;
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
}

.dm-header-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dm-header-title i {
    font-size: 16px;
}

.dm-header-hint {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 10px 0 auto;
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.92);
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
}

.dm-header-hint i {
    font-size: 13px;
}

.dm-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dm-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.dm-header-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.dm-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px;
    background: #f9fafb;
    cursor: default;
}

.dm-body::-webkit-scrollbar {
    width: 6px;
}

.dm-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* 拖动中（禁用过渡，防止卡顿） */
.dm-dragging {
    transition: none !important;
    user-select: none;
}

/* ════════════ 移动端：底部抽屉 ════════════ */
@media (max-width: 768px) {
    .dm-modal {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 70vh;
        height: 70vh;
        min-height: 0;
        border-radius: 16px 16px 0 0;
        resize: none;
    }

    .dm-modal::after {
        display: none;
    }

    .dm-modal.dm-visible {
        animation: dm-slide-up 0.22s ease-out;
    }

    @keyframes dm-slide-up {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    .dm-header {
        cursor: default;
        position: relative;
        padding-top: 16px;
    }

    /* 移动端为抽屉形态，无需拖动提示 */
    .dm-header-hint {
        display: none;
    }

    /* 顶部抽屉把手 */
    .dm-header::before {
        content: "";
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: rgba(255, 255, 255, 0.5);
    }
}
