/* 移动端深度优化样式 */

/* 1. 功能卡片滑动指示器 */
@media (max-width: 767px) {
    .func-cards-wrapper {
        position: relative;
    }

    .func-cards-indicators {
        display: flex;
        justify-content: center;
        gap: 6px;
        margin-top: 12px;
        margin-bottom: 8px;
    }

    .func-indicator {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #ddd;
        transition: all .3s;
    }

    .func-indicator.active {
        width: 20px;
        border-radius: 3px;
        background: var(--primary);
    }

    /* 2. 触摸区域优化 - 最小 44x44px */
    .mobile-menu-btn {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .top-bar .btn-outline-primary,
    .top-bar .btn-login {
        min-height: 36px;
        padding: 6px 12px;
    }

    .top-bar i.bi-bell {
        padding: 8px;
        min-width: 36px;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Pills 按钮触摸区域 */
    .sel-pill,
    .pill {
        min-height: 32px;
        padding: 6px 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* 3. 底部安全区适配（iPhone X+） */
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .main {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .balance-float {
        bottom: calc(12px + env(safe-area-inset-bottom));
    }

    /* 4. 输入框优化 */
    .editor-textarea-wrapper {
        position: relative;
    }

    .char-count {
        position: absolute;
        bottom: 8px;
        right: 8px;
        font-size: 11px;
        color: #999;
        background: rgba(255, 255, 255, 0.9);
        padding: 2px 6px;
        border-radius: 4px;
    }

    .clear-btn {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: #ddd;
        border: none;
        color: #666;
        font-size: 14px;
        display: none;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .editor-textarea:not(:placeholder-shown) ~ .clear-btn {
        display: flex;
    }

    /* 5. 加载骨架屏 */
    .skeleton {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: skeleton-loading 1.5s infinite;
        border-radius: 8px;
    }

    @keyframes skeleton-loading {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }

    .skeleton-card {
        height: 120px;
        margin-bottom: 12px;
    }

    .skeleton-text {
        height: 16px;
        margin-bottom: 8px;
    }

    /* 6. 历史记录底部抽屉 */
    .history-drawer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        transform: translateY(100%);
        transition: transform .3s;
        z-index: 200;
        max-height: 70vh;
        display: flex;
        flex-direction: column;
    }

    .history-drawer.open {
        transform: translateY(0);
    }

    .history-drawer-handle {
        width: 40px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
        margin: 12px auto 8px;
    }

    .history-drawer-header {
        padding: 12px 20px;
        border-bottom: 1px solid #f0f0f0;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .history-drawer-body {
        flex: 1;
        overflow-y: auto;
        padding: 12px;
    }

    /* 7. 长按快捷菜单 */
    .context-menu {
        position: fixed;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
        padding: 8px 0;
        z-index: 300;
        min-width: 140px;
        display: none;
    }

    .context-menu.show {
        display: block;
    }

    .context-menu-item {
        padding: 10px 16px;
        font-size: 14px;
        color: #333;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .context-menu-item:hover {
        background: #f5f5f5;
    }

    .context-menu-item i {
        font-size: 16px;
        width: 20px;
    }

    /* 8. 平滑滚动 */
    html {
        scroll-behavior: smooth;
    }

    /* 9. 防止双击缩放 */
    * {
        touch-action: manipulation;
    }

    /* 10. 优化点击反馈 */
    button, .btn, .pill, .nav-item {
        -webkit-tap-highlight-color: rgba(108, 92, 231, 0.1);
    }
}
