/* video-gen.css - 完整版（含移动端响应式适配） */

/* --- 1. 全局容器 --- */
.draw-container {
    flex: 1;
    padding: 0 !important;
    overflow-y: auto;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

/* 给模型选择大厅补回间距 */
#selection-view {
    padding: 30px;
}

/* 给工作台的内容区补回间距 */
.workspace-content {
    padding: 30px;
}

/* --- 2. 动画 --- */
.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 3. 头部筛选栏 --- */
.model-selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 15px;
}

.category-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cat-btn {
    background: transparent;
    border: 1px solid var(--c-border, #e5e5e5);
    color: var(--c-text-secondary, #666);
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.cat-btn.active,
.cat-btn:hover {
    background: var(--c-text-primary, #333);
    color: var(--c-bg-primary, #fff);
    border-color: transparent;
}

/* 搜索框 */
.search-box {
    position: relative;
    max-width: 250px;
    width: 100%;
}

.search-box input {
    width: 100%;
    padding: 8px 16px 8px 36px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid transparent;
    color: var(--c-text-primary, #333);
    outline: none;
    font-size: 14px;
    transition: background 0.2s;
}

.search-box input:focus {
    background: var(--c-bg-secondary, #fff);
    border-color: #19c37d;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--c-text-secondary, #999);
    pointer-events: none;
    font-size: 14px;
}

/* --- 4. 模型卡片网格 --- */
.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.model-card {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.model-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-color: #19c37d;
}

/* 卡片文字 */
.card-content {
    flex: 1;
    padding-right: 15px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    height: 42px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card-tags .tag {
    display: inline-block;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: #666;
}

.card-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.badge-hot {
    background: #fff0ec;
    color: #ff5722;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 87, 34, 0.2);
}

/* --- 5. 底部提示条 --- */
.info-bar {
    background: rgba(25, 195, 125, 0.08);
    border: 1px solid rgba(25, 195, 125, 0.2);
    border-radius: 12px;
    padding: 20px;
    font-size: 13px;
    color: var(--c-text-secondary);
    line-height: 1.8;
}

/* --- 6. 工作区样式 --- */
#workspace-view {
    display: none;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-back:hover {
    background: rgba(0, 0, 0, 0.05);
}

.form-section {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--c-text-primary);
}

.draw-input,
.draw-select {
    width: 100%;
    background-color: var(--c-input-bg, #f5f5f5);
    border: 1px solid var(--c-border, #ddd);
    color: var(--c-text-primary, #333);
    padding: 14px;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
}

.draw-input:focus,
.draw-select:focus {
    border-color: #19c37d;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.btn-generate {
    background: #19c37d;
    color: white;
    border: none;
    padding: 16px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-generate:hover {
    background: #15a268;
}

.result-area {
    margin-top: 30px;
    border: 2px dashed var(--c-border);
    border-radius: 12px;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.02);
    color: var(--c-text-secondary);
}

/* =================================================================
   🔥 暗色模式 (Dark Mode) 强制覆盖
   ================================================================= */

html[data-theme="dark"] .model-card {
    background-color: #2b2d31;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

html[data-theme="dark"] .model-card:hover {
    background-color: #34363c;
    border-color: #19c37d;
}

html[data-theme="dark"] .card-title {
    color: #efefef;
}

html[data-theme="dark"] .card-desc {
    color: #a0a0a0;
}

html[data-theme="dark"] .card-tags .tag {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.05);
    color: #ccc;
}

html[data-theme="dark"] .badge-hot {
    background: rgba(255, 87, 34, 0.2);
    border-color: rgba(255, 87, 34, 0.3);
    color: #ff8a65;
}

html[data-theme="dark"] .cat-btn.active {
    background-color: #ffffff;
    color: #000000;
}

html[data-theme="dark"] .cat-btn:not(.active) {
    border-color: rgba(255, 255, 255, 0.2);
    color: #ccc;
}

html[data-theme="dark"] .cat-btn:not(.active):hover {
    background-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .search-box input {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: transparent;
}

html[data-theme="dark"] .search-box input:focus {
    background-color: rgba(0, 0, 0, 0.3);
    border-color: #19c37d;
}

html[data-theme="dark"] .draw-input,
html[data-theme="dark"] .draw-select {
    background-color: #2b2d31;
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

html[data-theme="dark"] .result-area {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .btn-back:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* =================================================================
   🏆 工作台吸顶导航栏
   ================================================================= */

.workspace-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;

    display: flex;
    justify-content: space-between;
    align-items: center;

    width: 100%;
    padding: 15px 30px;

    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;

    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);

    margin-bottom: 0;
}

html[data-theme="dark"] .workspace-header {
    background: rgba(30, 32, 35, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.4);
}

/* 右侧胶囊样式 */
.ws-model-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.04);
    padding: 5px 16px 5px 5px;
    border-radius: 50px;
}

#ws-icon-bg {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#ws-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-primary);
}

#ws-desc {
    font-size: 12px;
    opacity: 0.6;
    padding-left: 8px;
    border-left: 1px solid rgba(128, 128, 128, 0.3);
}

.ws-separator {
    display: none;
}

html[data-theme="dark"] .ws-model-badge {
    background: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] #ws-desc {
    border-color: rgba(255, 255, 255, 0.2);
}

/* =================================================================
   📱 移动端响应式适配 (Mobile Responsive)
   ================================================================= */

/* ———————————————————————————————————
   断点 1: 平板及以下 (≤ 768px)
   ——————————————————————————————————— */
@media screen and (max-width: 768px) {

    /* --- 侧边栏：固定定位，通过 class 控制显隐 --- */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 240px;
        z-index: 2000;
        transition: transform 0.3s ease;
        transform: translateX(0);
    }

    /* 有 sidebar-hidden 时滑出屏幕 */
    .sidebar-hidden .sidebar {
        transform: translateX(-100%);
    }

    /* 主内容区：始终占满 */
    .main-chat {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* 遮罩层：侧边栏展开时显示 */
    body:not(.sidebar-hidden)::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 1999;
        animation: fadeIn 0.3s ease;
    }

    /* --- 顶部 Header --- */
    #chat-header {
        padding: 10px 12px;
    }

    #header-title {
        font-size: 15px;
    }

    /* --- 选择大厅 --- */
    #selection-view {
        padding: 16px;
    }

    /* 筛选栏：纵向排列 */
    .model-selection-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }

    /* 分类标签：可横向滚动 */
    .category-tags {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        padding-bottom: 4px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .category-tags::-webkit-scrollbar {
        display: none;
    }

    .cat-btn {
        flex-shrink: 0;
        padding: 6px 14px;
        font-size: 13px;
    }

    /* 搜索框撑满 */
    .search-box {
        max-width: 100%;
    }

    /* --- 模型卡片网格：单列 --- */
    .model-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-bottom: 20px;
    }

    .model-card {
        padding: 18px;
        border-radius: 14px;
    }

    .card-title {
        font-size: 16px;
    }

    .card-desc {
        font-size: 12px;
        margin-bottom: 12px;
        height: auto;
        -webkit-line-clamp: 3;
    }

    .card-icon-wrapper {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        font-size: 20px;
    }

    /* --- 底部提示条 --- */
    .info-bar {
        padding: 14px;
        font-size: 12px;
        line-height: 1.7;
        border-radius: 10px;
    }

    /* --- 工作台 Header --- */
    .workspace-header {
        padding: 12px 16px;
        border-bottom-left-radius: 14px;
        border-bottom-right-radius: 14px;
        gap: 10px;
    }

    .btn-back {
        padding: 6px 10px;
        font-size: 13px;
    }

    .btn-back svg {
        width: 16px;
        height: 16px;
    }

    .ws-model-badge {
        padding: 4px 12px 4px 4px;
        gap: 8px;
    }

    #ws-name {
        font-size: 12px;
    }

    #ws-desc {
        display: none;
    }

    /* --- 工作台内容区 --- */
    .workspace-content {
        padding: 20px 16px;
    }

    /* 设置网格：单列 */
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    /* 表单输入框 */
    .draw-input,
    .draw-select {
        padding: 12px;
        font-size: 14px;
        border-radius: 8px;
    }

    /* 生成按钮 */
    .btn-generate {
        padding: 14px;
        font-size: 15px;
        border-radius: 10px;
    }

    /* 结果展示区 */
    .result-area {
        min-height: 250px;
        margin-top: 20px;
        border-radius: 10px;
    }
}

/* ———————————————————————————————————
   断点 2: 极小屏手机 (≤ 400px)
   ——————————————————————————————————— */
@media screen and (max-width: 400px) {

    #selection-view {
        padding: 12px;
    }

    .model-grid {
        gap: 10px;
    }

    .model-card {
        padding: 14px;
        border-radius: 12px;
    }

    .card-title {
        font-size: 15px;
        gap: 6px;
    }

    .card-desc {
        font-size: 11px;
    }

    .card-tags .tag {
        font-size: 10px;
        padding: 3px 8px;
    }

    .card-icon-wrapper {
        width: 36px;
        height: 36px;
        font-size: 18px;
        border-radius: 10px;
    }

    .workspace-header {
        padding: 10px 12px;
        border-bottom-left-radius: 12px;
        border-bottom-right-radius: 12px;
    }

    .workspace-content {
        padding: 16px 12px;
    }

    .btn-back {
        padding: 5px 8px;
        font-size: 12px;
    }

    #ws-name {
        font-size: 11px;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ———————————————————————————————————
   断点 3: 中等平板 (769px ~ 1024px)
   ——————————————————————————————————— */
@media screen and (min-width: 769px) and (max-width: 1024px) {

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 2000;
        transition: transform 0.3s ease;
        transform: translateX(0);
    }

    .sidebar-hidden .sidebar {
        transform: translateX(-100%);
    }

    body:not(.sidebar-hidden)::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 1999;
    }

    .main-chat {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* 卡片网格：双列 */
    .model-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #selection-view {
        padding: 24px;
    }
}

/* ———————————————————————————————————
   安全区适配 (iPhone 刘海 / 底部横条)
   ——————————————————————————————————— */
@supports (padding-bottom: env(safe-area-inset-bottom)) {

    .draw-container {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .btn-generate {
        margin-bottom: env(safe-area-inset-bottom);
    }
}

/* ———————————————————————————————————
   触摸优化：取消 hover 抬升效果
   ——————————————————————————————————— */
@media (hover: none) and (pointer: coarse) {

    .model-card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }

    .model-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    html[data-theme="dark"] .model-card:hover {
        background-color: #2b2d31;
    }

    html[data-theme="dark"] .model-card:active {
        background-color: #34363c;
    }
}
