/* ==================== 移动端共享样式 ==================== */

/* 汉堡菜单按钮 */
.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary, #F1F5F9);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
}

/* 移动端导航遮罩 */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.mobile-nav-overlay.active {
    display: block;
}

/* 通用移动端导航抽屉 */
.mobile-nav-drawer {
    display: none;
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--bg-surface, #141820);
    border-bottom: 1px solid var(--border, #1E293B);
    padding: 8px;
    z-index: 999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-height: calc(100vh - 52px);
    overflow-y: auto;
}

.mobile-nav-drawer.active {
    display: block;
}

.mobile-nav-drawer a {
    display: block;
    padding: 12px 16px;
    color: var(--text-secondary, #94A3B8);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.15s;
}

.mobile-nav-drawer a:hover,
.mobile-nav-drawer a.active {
    background: var(--accent-glow, rgba(167, 139, 250, 0.15));
    color: var(--accent, #A78BFA);
}

/* ==================== 断点：768px ==================== */
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    /* 隐藏桌面导航 */
    .navbar-nav {
        display: none !important;
    }

    /* 两列布局改为单列 */
    .two-col-grid {
        grid-template-columns: 1fr !important;
    }

    /* 欢迎区域 */
    .welcome-content {
        flex-direction: column !important;
        text-align: center;
    }

    .welcome-content h1 {
        font-size: 1.4rem !important;
    }

    /* 统计卡片 */
    .dashboard {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* 功能入口 */
    .feature-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 通用面板布局（左右分栏改为上下） */
    .app-layout {
        flex-direction: column !important;
    }

    /* 音色页面：引擎面板 */
    .engine-panel {
        width: 100% !important;
        max-height: 200px;
        border-right: none !important;
        border-bottom: 1px solid var(--border, #1E293B);
    }

    /* 广播剧：解除视口锁定，允许滚动 */
    body {
        height: auto !important;
        overflow: auto !important;
    }

    .container {
        height: auto !important;
        overflow: visible !important;
        padding: 12px !important;
    }

    .studio-layout {
        grid-template-columns: 1fr !important;
        overflow-y: visible !important;
        height: auto !important;
    }

    .panel-left,
    .panel-right {
        overflow-y: visible !important;
        max-height: none !important;
    }

    /* 时间轴列表不限高度 */
    .timeline-list,
    .json-viewer {
        max-height: 300px !important;
    }
}

/* ==================== 断点：480px ==================== */
@media (max-width: 480px) {
    .dashboard {
        grid-template-columns: 1fr !important;
    }

    .stat-icon {
        font-size: 2rem !important;
    }

    .stat-value {
        font-size: 1.5rem !important;
    }

    .feature-grid {
        grid-template-columns: 1fr !important;
    }

    /* 过滤栏 */
    .filter-bar {
        flex-direction: column;
        gap: 8px;
    }

    .filter-input,
    .filter-select {
        width: 100% !important;
        min-width: 100% !important;
    }
}

/* ==================== 音色页面移动端优化 ==================== */
@media (max-width: 768px) {
    /* 引擎面板改为可折叠抽屉 */
    .engine-panel {
        max-height: none !important;
        border-bottom: 1px solid var(--border, #1E293B) !important;
        position: relative;
    }

    .engine-panel-header {
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px !important;
    }

    .engine-panel-header::after {
        content: '▼';
        font-size: 0.7rem;
        transition: transform 0.2s;
    }

    .engine-panel.collapsed .engine-list {
        display: none;
    }

    .engine-panel.collapsed .engine-panel-header::after {
        transform: rotate(-90deg);
    }

    /* 音色行改为卡片式 */
    .voice-row {
        flex-wrap: wrap !important;
        padding: 12px !important;
        gap: 8px !important;
        border-radius: 8px;
        margin: 0 8px 8px 8px;
        border: 1px solid var(--border, #1E293B);
        background: var(--bg-surface, #141820);
    }

    .voice-row:hover {
        background: var(--bg-hover, #1C2130) !important;
    }

    /* 隐藏拖拽手柄 */
    .drag-handle {
        display: none !important;
    }

    /* 复选框移到右上角 */
    .voice-row > .cb {
        position: absolute;
        top: 12px;
        right: 12px;
        order: 10;
    }

    .voice-row {
        position: relative;
    }

    /* 头像和名称区域 */
    .voice-avatar {
        width: 36px !important;
        height: 36px !important;
        font-size: 1rem !important;
    }

    .voice-info {
        flex: 1;
        min-width: calc(100% - 60px) !important;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 4px !important;
    }

    .voice-name-col {
        width: 100%;
    }

    .voice-name {
        font-size: 0.95rem !important;
    }

    .voice-engine-tag {
        font-size: 0.75rem !important;
    }

    .voice-alias {
        display: none !important;
    }

    /* 标签改为紧凑排列 */
    .voice-meta {
        gap: 4px !important;
    }

    .meta-tag {
        font-size: 0.7rem !important;
        padding: 2px 6px !important;
    }

    /* 操作按钮改为底部横排 */
    .voice-actions {
        width: 100% !important;
        justify-content: space-between !important;
        gap: 8px !important;
        padding-top: 8px;
        border-top: 1px solid var(--border, #1E293B);
        margin-top: 4px;
    }

    .voice-actions .btn-row {
        flex: 1;
        justify-content: center;
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }

    /* 底部栏优化 */
    .bottom-bar {
        padding: 8px 12px !important;
        gap: 8px !important;
    }

    /* 候选池改为横向滚动 */
    .candidate-pool {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .candidate-pool::-webkit-scrollbar {
        height: 3px;
    }

    .candidate-chip {
        flex-shrink: 0;
    }

    /* 预览控制栏 */
    .preview-row {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .preview-row input[type="text"] {
        width: 100% !important;
        min-width: 100% !important;
        order: -1;
    }

    /* 音量控制组 */
    .preview-row > span:not(.range-value) {
        font-size: 0.7rem !important;
    }

    .preview-row input[type="range"] {
        width: 60px !important;
    }

    /* 过滤栏优化 */
    .filter-bar {
        flex-direction: column !important;
        gap: 8px !important;
        padding: 12px !important;
    }

    .filter-input {
        width: 100% !important;
    }

    .filter-select {
        width: 100% !important;
        min-width: 100% !important;
    }

    /* 仅已选复选框 */
    .filter-bar label {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ==================== 音色页面小屏优化 ==================== */
@media (max-width: 480px) {
    /* 进一步简化标签 */
    .voice-meta {
        max-height: 24px;
        overflow: hidden;
    }

    .meta-tag:nth-child(n+4) {
        display: none;
    }

    /* 操作按钮只显示图标 */
    .voice-actions .btn-row {
        font-size: 0.8rem !important;
        padding: 8px !important;
    }

    /* 预览控制栏精简 */
    .preview-row input[type="range"] {
        width: 50px !important;
    }

    .range-value {
        display: none;
    }
}

/* ==================== 触摸优化 ==================== */
@media (hover: none) and (pointer: coarse) {
    /* 增大触摸目标 */
    .btn-row,
    .btn-ghost-sm,
    .nav-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* 禁用 hover 效果 */
    .voice-row:hover,
    .engine-toggle:hover,
    .gender-toggle:hover {
        background: transparent;
    }

    /* 增大滑块 */
    input[type="range"] {
        height: 8px;
    }

    input[type="range"]::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }
}
