/* ===== 全局样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; background: #f5f7fa; color: #333; font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: #4a90d9; text-decoration: none; transition: color 0.2s ease; }
a:hover { color: #357abd; }

/* 性能优化：减少重绘 */
.app-sidebar, .app-header {
    will-change: transform;
    backface-visibility: hidden;
}

/* ===== 布局 ===== */
.app-layout { display: flex; min-height: 100vh; }
.app-sidebar { width: 220px; background: #2c3e50; color: #ecf0f1; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 100; }
.app-main { margin-left: 220px; flex: 1; min-height: 100vh; }
.app-header { background: #fff; padding: 15px 30px; border-bottom: 1px solid #e8e8e8; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 50; }
.app-content { padding: 24px 30px; }

/* 无侧边栏布局 */
.no-sidebar .app-main { margin-left: 0; }
.no-sidebar .app-sidebar { display: none; }

/* ===== 侧边栏 ===== */
.sidebar-logo { padding: 20px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-logo h2 { color: #fff; font-size: 18px; font-weight: 600; }
.sidebar-logo p { color: rgba(255,255,255,0.6); font-size: 12px; margin-top: 4px; }
.sidebar-menu { list-style: none; padding: 10px 0; }
.sidebar-menu li a { display: block; padding: 12px 20px; color: #bdc3c7; transition: all 0.2s; font-size: 14px; }
.sidebar-menu li a:hover, .sidebar-menu li a.active { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-menu li a .icon { margin-right: 10px; width: 20px; display: inline-block; text-align: center; }
.sidebar-divider { padding: 16px 20px 6px; font-size: 12px; color: rgba(255,255,255,0.5); font-weight: 600; margin-top: 4px; border-top: 1px solid rgba(255,255,255,0.08); letter-spacing: 1px; }

/* ===== 顶部导航 ===== */
.header-user { display: flex; align-items: center; gap: 15px; }
.header-user .balance-tag { background: #e8f5e9; color: #2e7d32; padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 500; }
.header-user .vip-tag { background: #fff3e0; color: #e65100; padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 500; }
.header-user .no-vip-tag { background: #fce4ec; color: #c62828; padding: 4px 12px; border-radius: 20px; font-size: 13px; }
.header-user a { color: #666; font-size: 13px; }

/* 合伙人等级徽章 */
.header-user .partner-level-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}
.header-user .partner-level-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: #fff;
}
.header-user .partner-level-badge .pl-name { font-weight: 600; }
.header-user .partner-level-badge .pl-rate {
    background: rgba(255,255,255,0.25);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
}

/* 顶部充值按钮 */
.header-user .recharge-btn-header {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f5af19, #f12711);
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(241, 39, 17, 0.3);
    animation: rechargePulse 2s ease-in-out infinite;
}
.header-user .recharge-btn-header:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(241, 39, 17, 0.4);
    color: #fff;
}
.header-user .recharge-btn-header .rb-icon { font-size: 14px; }
@keyframes rechargePulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(241, 39, 17, 0.3); }
    50% { box-shadow: 0 2px 16px rgba(241, 39, 17, 0.5); }
}

/* 用户名链接 */
.header-user .user-name-link {
    color: #333;
    font-weight: 500;
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s;
}
.header-user .user-name-link:hover {
    color: #667eea;
}

/* 用户下拉菜单 */
.header-user .user-dropdown { position: relative; }
.header-user .user-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    padding: 4px 10px;
    border-radius: 8px;
    transition: background 0.2s;
    user-select: none;
}
.header-user .user-dropdown-trigger:hover {
    background: rgba(0,0,0,0.04);
}
.header-user .user-avatar-small {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
}
.header-user .user-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    min-width: 120px;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid #f0f0f0;
}
.header-user .user-dropdown:hover .user-dropdown-menu {
    display: block;
}
.header-user .user-dropdown-menu a {
    display: block;
    padding: 10px 18px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    transition: background 0.15s;
}
.header-user .user-dropdown-menu a:hover {
    background: #f8f9fa;
    color: #667eea;
}

/* ===== 卡片 ===== */
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 24px; margin-bottom: 20px; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #f0f0f0; }

/* 统计卡片 */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: 8px; padding: 12px 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.stat-card .stat-label { color: #999; font-size: 12px; margin-bottom: 4px; }
.stat-card .stat-value { font-size: 22px; font-weight: 700; color: #333; }
.stat-card .stat-value.primary { color: #4a90d9; }
.stat-card .stat-value.success { color: #27ae60; }
.stat-card .stat-value.warning { color: #f39c12; }
.stat-card .stat-value.danger { color: #e74c3c; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: #555; font-size: 14px; }
.form-control { width: 100%; padding: 10px 12px; border: 1px solid #dcdfe6; border-radius: 6px; font-size: 14px; transition: border-color 0.2s; outline: none; }
.form-control:focus { border-color: #4a90d9; box-shadow: 0 0 0 2px rgba(74,144,217,0.15); }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-help { font-size: 12px; color: #999; margin-top: 4px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ===== 按钮 ===== */
.btn { display: inline-block; padding: 10px 20px; border: none; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; text-align: center; }
.btn-primary { background: #4a90d9; color: #fff; }
.btn-primary:hover { background: #357abd; }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-warning { background: #f39c12; color: #fff; }
.btn-warning:hover { background: #d68910; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-outline { background: #fff; color: #4a90d9; border: 1px solid #4a90d9; }
.btn-outline:hover { background: #4a90d9; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
table th { background: #fafbfc; font-weight: 600; color: #555; white-space: nowrap; }
table tr:hover { background: #f8f9fa; }

/* ===== 状态标签 ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.badge-pending { background: #fff3e0; color: #e65100; }
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-danger { background: #fce4ec; color: #c62828; }
.badge-info { background: #e3f2fd; color: #1565c0; }

/* ===== 分页 ===== */
.pagination { display: flex; gap: 6px; margin-top: 20px; justify-content: center; }
.pagination a, .pagination span { padding: 8px 14px; border: 1px solid #dcdfe6; border-radius: 4px; font-size: 13px; color: #666; }
.pagination a:hover { border-color: #4a90d9; color: #4a90d9; }
.pagination .active { background: #4a90d9; color: #fff; border-color: #4a90d9; }

/* ===== 图片上传区域 ===== */
.upload-area { min-height:180px; box-sizing:border-box; position:relative;  border: 2px dashed #dcdfe6; border-radius: 8px; padding: 30px; text-align: center; cursor: pointer; transition: all 0.2s; background: #fafbfc; }
.upload-area:hover { border-color: #4a90d9; background: #f0f7ff; }
.upload-area .upload-icon { font-size: 36px; color: #bbb; margin-bottom: 10px; }
.upload-area p { color: #999; font-size: 14px; }
/* ===== 视频上传区域 ===== */
.video.upload-area { height:180px; box-sizing:border-box; position:relative;  border: 2px dashed #e67e22; border-radius: 8px; padding: 30px; text-align: center; cursor: pointer; transition: all 0.2s; background: #fff8f0; }
.video-upload-area:hover { border-color: #d35400; background: #fff0e0; }
.video-upload-area .upload-icon { font-size: 36px; color: #e67e22; margin-bottom: 10px; }
.video-upload-area p { color: #999; font-size: 14px; }
.video-preview-item { margin-top: 16px; padding: 12px; background: #f8f9fa; border-radius: 8px; display: flex; align-items: center; justify-content: space-between; }
.video-preview-item .video-name { font-size: 13px; color: #555; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-preview-item .video-remove-btn { background: #e74c3c; color: #fff; border: none; border-radius: 4px; padding: 4px 12px; cursor: pointer; font-size: 12px; }
.image-preview-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.image-preview-item { position: relative; width: 120px; height: 120px; border-radius: 8px; overflow: hidden; border: 1px solid #eee; }
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-item .remove-btn { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.5); color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.upload-progress { margin-top: 8px; }
.upload-progress .progress-bar { height: 4px; background: #e0e0e0; border-radius: 2px; overflow: hidden; }
.upload-progress .progress-fill { height: 100%; background: #4a90d9; transition: width 0.3s; }

/* ===== 剧情选择卡片 ===== */
.plot-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.plot-card { border: 2px solid #eee; border-radius: 10px; padding: 20px; cursor: pointer; transition: all 0.2s; text-align: center; }
.plot-card:hover { border-color: #4a90d9; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.plot-card.selected { border-color: #4a90d9; background: #f0f7ff; }
.plot-card .plot-icon { font-size: 32px; margin-bottom: 10px; }
.plot-card .plot-name { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.plot-card .plot-desc { font-size: 12px; color: #999; }

/* ===== 场景选择 ===== */
.scene-tabs { display: flex; gap: 0; margin-bottom: 24px; }
.scene-tab { flex: 1; padding: 16px; text-align: center; border: 2px solid #eee; cursor: pointer; transition: all 0.2s; font-weight: 500; position: relative; }
.scene-tab:first-child { border-radius: 8px 0 0 8px; }
.scene-tab:last-child { border-radius: 0 8px 8px 0; }
.scene-tab:not(:first-child):not(:last-child) { border-radius: 0; }
.scene-tab.active { border-color: #4a90d9; background: #4a90d9; color: #fff; }
.scene-tab[data-type="replicate"] { background: #fff8f0; }
.scene-tab[data-type="replicate"]:hover:not(.active) { border-color: #e67e22; background: #fff0e0; }
.scene-tab[data-type="replicate"].active { border-color: #e67e22; background: #e67e22; color: #fff; }
.scene-tab .scene-subtitle { display: block; font-size: 11px; font-weight: 400; margin-top: 4px; opacity: 0.8; }

/* ===== 进度条 ===== */
.progress-container { max-width: 600px; margin: 40px auto; }
.progress-steps { display: flex; justify-content: space-between; margin-bottom: 30px; position: relative; }
.progress-steps::before { content: ''; position: absolute; top: 15px; left: 0; right: 0; height: 3px; background: #e0e0e0; }
.progress-step { text-align: center; position: relative; z-index: 1; }
.progress-step .step-dot { width: 32px; height: 32px; border-radius: 50%; background: #e0e0e0; color: #999; display: flex; align-items: center; justify-content: center; margin: 0 auto 8px; font-size: 14px; font-weight: 600; }
.progress-step.active .step-dot { background: #4a90d9; color: #fff; }
.progress-step.done .step-dot { background: #27ae60; color: #fff; }
.progress-step .step-label { font-size: 12px; color: #999; }
.progress-step.active .step-label { color: #4a90d9; font-weight: 500; }
.progress-bar-wrap { height: 8px; background: #e0e0e0; border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #4a90d9, #27ae60); transition: width 0.5s; border-radius: 4px; }
.progress-text { text-align: center; margin-top: 12px; color: #666; font-size: 14px; }

/* ===== 视频结果 ===== */
.video-result { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.video-player { background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 9/16; max-height: 500px; display: flex; align-items: center; justify-content: center; color: #fff; }
.video-info { }
.copy-box { background: #f8f9fa; border-radius: 6px; padding: 14px; margin-bottom: 12px; position: relative; }
.copy-box .copy-btn { position: absolute; top: 8px; right: 8px; }

/* ===== 语速调节 ===== */
.speed-control { display: flex; align-items: center; gap: 12px; }
.speed-control input[type="range"] { flex: 1; }
.speed-value { font-weight: 600; color: #4a90d9; min-width: 40px; text-align: center; }

/* ===== 视频时长选择 ===== */
.duration-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.duration-option {
    position: relative;
    cursor: pointer;
    padding: 16px 12px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s ease;
    background: #fff;
}
.duration-option:hover {
    border-color: #4a90d9;
    background: #f0f7ff;
}
.duration-option.selected {
    border-color: #4a90d9;
    background: #e3f2fd;
}
.duration-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}
.duration-label {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}
.duration-price {
    display: block;
    font-size: 14px;
    color: #e74c3c;
    font-weight: 500;
}

/* ===== 认证页面 ===== */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.auth-box { background: #fff; border-radius: 12px; padding: 40px; max-width: 420px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.auth-box h2 { text-align: center; margin-bottom: 8px; color: #333; }
.auth-box .auth-subtitle { text-align: center; color: #999; margin-bottom: 30px; font-size: 14px; }
.auth-box .auth-link { text-align: center; margin-top: 20px; font-size: 14px; color: #666; }

/* ===== 提示消息 ===== */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-warning { background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; }
.alert-danger { background: #fce4ec; color: #c62828; border: 1px solid #f8bbd0; }

/* ===== Toast提示 ===== */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; }
.toast { background: #333; color: #fff; padding: 12px 20px; border-radius: 6px; margin-bottom: 8px; font-size: 14px; animation: slideIn 0.3s ease; min-width: 200px; }
.toast.success { background: #27ae60; }
.toast.error { background: #e74c3c; }
.toast.warning { background: #f39c12; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== 模态框 ===== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: none; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 10px; padding: 30px; width: 500px; max-width: 90vw; max-height: 80vh; overflow-y: auto; }
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.modal-footer { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 15px; }

/* ===== 响应式(仅PC) ===== */
@media (max-width: 1200px) {
    .plot-cards { grid-template-columns: repeat(2, 1fr); }
    .video-result { grid-template-columns: 1fr; }
}

/* ===== 移动端适配（仅手机生效，PC不受影响）===== */
@media (max-width: 768px) {
    .auth-box { padding: 24px 20px; }
    .auth-box h2 { font-size: 20px; }
    .auth-box .auth-subtitle { font-size: 13px; margin-bottom: 20px; }
    .form-group label { font-size: 13px; }
    .form-control { padding: 10px; font-size: 14px; }
    .btn-lg { padding: 12px 20px; font-size: 15px; }
    .toast-container { top: 10px; right: 10px; left: 10px; }
    .toast { min-width: auto; font-size: 13px; }

    .app-sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .app-header { padding: 12px 16px; }
    .app-content { padding: 16px; }
    .stat-cards { grid-template-columns: 1fr; }
    .plot-cards { grid-template-columns: repeat(2, 1fr); }
    .duration-options { grid-template-columns: repeat(2, 1fr); }
    .video-result { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
    .hamburger-btn { display: block; }
    .header-user { gap: 8px; font-size: 12px; }
    .header-user .balance-tag, .header-user .vip-tag, .header-user .no-vip-tag { padding: 3px 8px; font-size: 11px; }
}

/* 汉堡菜单按钮：PC端默认隐藏 */
.hamburger-btn { display: none; background: none; border: none; font-size: 24px; cursor: pointer; padding: 4px 8px; color: #333; }

/* 侧边栏遮罩层 */
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 99; }
.sidebar-overlay.show { display: block; }

/* ===== AI模特图生图页面 ===== */
.imagetool-tabs { display: flex; gap: 0; margin-bottom: 0; }
.imagetool-tab { flex: 1; padding: 16px; text-align: center; border: 2px solid #eee; cursor: pointer; transition: all 0.2s; font-weight: 500; font-size: 16px; border-radius: 8px; }
.imagetool-tab:first-child { border-radius: 8px 0 0 8px; }
.imagetool-tab:last-child { border-radius: 0 8px 8px 0; }
.imagetool-tab.active { border-color: #4a90d9; background: #4a90d9; color: #fff; }
.imagetool-tab:hover:not(.active) { border-color: #4a90d9; background: #f0f7ff; }

.imagetool-upload-row { display: flex; gap: 24px; }
.imagetool-upload-col { flex: 1; min-width: 0; }

.imagetool-preview { margin-top: 12px; min-height: 20px; }
.imagetool-preview-img { position: relative; display: inline-block; width: 100%; max-width: 300px; border-radius: 8px; overflow: hidden; border: 1px solid #eee; }
.imagetool-preview-img img { width: 100%; height: auto; display: block; }
.imagetool-preview-img .remove-btn { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.5); color: #fff; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; }

.imagetool-result-img { text-align: center; }
.imagetool-result-img img { max-width: 400px; width: 100%; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,0.1); }

.imagetool-loading { text-align: center; padding: 40px 20px; color: #999; }
.spinner-large { width: 48px; height: 48px; border: 4px solid #e0e0e0; border-top-color: #4a90d9; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; margin-right: 6px; }

.garment-type-options { display: flex; gap: 12px; }
.garment-type-options .duration-option { padding: 10px 16px; }

@media (max-width: 768px) {
    .imagetool-upload-row { flex-direction: column; }
    .imagetool-tabs { flex-direction: column; }
    .imagetool-tab:first-child { border-radius: 8px 8px 0 0; }
    .imagetool-tab:last-child { border-radius: 0 0 8px 8px; }
}
