/* ========== APP 版本更新管理后台 - 样式 ========== */

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "Microsoft YaHei", sans-serif; background: #f0f2f5; color: #333; }
:root {
    --primary: #667eea; --primary-dark: #764ba2; --danger: #e74c3c;
    --success: #27ae60; --warning: #f39c12; --text: #333; --text-light: #666;
    --border: #e0e0e0; --bg: #f0f2f5; --white: #fff;
}

/* ========== 登录页 ========== */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: #0a0e27; position: relative; overflow: hidden;
}
#starCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; }
.login-box {
    position: relative; z-index: 1;
    background: rgba(255,255,255,0.08); backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.15); border-radius: 12px; padding: 40px; width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-box h1 { text-align: center; font-size: 22px; margin-bottom: 30px; color: #fff; letter-spacing: 2px; }
.login-box input {
    width: 100%; padding: 12px 16px; border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px; font-size: 14px; margin-bottom: 16px; transition: border-color 0.3s;
    background: rgba(255,255,255,0.06); color: #fff;
}
.login-box input::placeholder { color: rgba(255,255,255,0.4); }
.login-box input:focus { outline: none; border-color: rgba(102,126,234,0.8); background: rgba(255,255,255,0.1); }
.login-box button {
    width: 100%; padding: 12px; border: none; border-radius: 6px;
    background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
    font-size: 16px; cursor: pointer; transition: opacity 0.3s; letter-spacing: 4px;
}
.login-box button:hover { opacity: 0.9; }
.login-box button:disabled { opacity: 0.5; cursor: not-allowed; }
.login-error { color: #ff6b6b; font-size: 13px; text-align: center; margin-bottom: 12px; display: none; }

/* ========== 主布局 ========== */
.app-layout { display: none; min-height: 100vh; }
.sidebar {
    width: 200px; background: #2d3a4b; color: #fff; padding: 0;
    position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto;
}
.sidebar .logo { padding: 20px; font-size: 15px; font-weight: bold; border-bottom: 1px solid #3d4a5c; text-align: center; }
.sidebar .menu { list-style: none; }
.sidebar .menu li {
    padding: 14px 24px; cursor: pointer; transition: all 0.3s;
    border-left: 3px solid transparent; font-size: 14px;
}
.sidebar .menu li:hover { background: #3d4a5c; }
.sidebar .menu li.active { background: #3d4a5c; border-left-color: var(--primary); }
.sidebar .menu li .icon { margin-right: 8px; }
.main-content { margin-left: 200px; padding: 20px; }
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 0 20px 0; border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
.topbar .breadcrumb { font-size: 16px; font-weight: 500; }
.topbar .user-info { font-size: 14px; color: var(--text-light); display: flex; align-items: center; gap: 12px; }
.topbar .user-info .logout-btn { color: var(--danger); cursor: pointer; }
.topbar .user-info .change-pwd-btn { color: var(--primary); cursor: pointer; }

/* ========== 表格 ========== */
.table-wrap { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; font-size: 13px; }
th { background: #fafafa; font-weight: 600; color: var(--text-light); white-space: nowrap; }
tr:hover { background: #f5f7fa; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag-forced { background: #fde2e2; color: var(--danger); }
.tag-normal { background: #e2f0fd; color: var(--primary); }

/* ========== 按钮 ========== */
.btn { padding: 6px 14px; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; transition: opacity 0.3s; }
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-default { background: #fff; color: var(--text-light); border: 1px solid #ddd; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 4px 8px; font-size: 14px; }

/* ========== 分页 ========== */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.pagination button { padding: 4px 12px; border: 1px solid #ddd; background: #fff; border-radius: 4px; cursor: pointer; font-size: 13px; }
.pagination button:disabled { color: #ccc; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: var(--text-light); }

/* ========== 弹窗 ========== */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff; border-radius: 8px; padding: 24px; width: 500px;
    max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal h2 { font-size: 18px; margin-bottom: 20px; }
.modal .form-group { margin-bottom: 16px; }
.modal .form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--text-light); }
.modal .form-group input, .modal .form-group textarea, .modal .form-group select {
    width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px;
}
.modal .form-group input:focus, .modal .form-group textarea:focus { outline: none; border-color: var(--primary); }
.modal .form-group textarea { resize: vertical; min-height: 80px; }
.modal .form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }
.modal .switch-wrap { display: flex; align-items: center; gap: 8px; }
.modal .switch-wrap input[type="checkbox"] { width: 18px; height: 18px; }

/* ========== 上传 ========== */
.upload-area {
    border: 2px dashed #ddd; border-radius: 6px; padding: 20px; text-align: center;
    cursor: pointer; transition: border-color 0.3s; margin-bottom: 8px;
}
.upload-area:hover { border-color: var(--primary); }
.upload-area.has-file { border-color: var(--success); border-style: solid; }
.upload-area .upload-text { font-size: 14px; color: var(--text-light); }
.upload-area .file-name { font-size: 13px; color: var(--success); margin-top: 4px; }

/* ========== 空状态 ========== */
.empty-state { text-align: center; padding: 40px; color: var(--text-light); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ========== Toast 提示 ========== */
.toast {
    position: fixed; top: 20px; right: 20px; padding: 12px 24px; border-radius: 6px;
    color: #fff; font-size: 14px; z-index: 2000; opacity: 0; display: none;
    transition: opacity 0.3s; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.toast.show { display: block; opacity: 1; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

/* ========== Dashboard ========== */
.dashboard-hero {
    background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
    border-radius: 12px; padding: 40px; text-align: center; margin-bottom: 20px;
}
.dashboard-hero h2 { font-size: 28px; margin-bottom: 8px; }
.dashboard-hero p { font-size: 14px; opacity: 0.8; }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 8px; padding: 20px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.stat-card .stat-num { font-size: 32px; font-weight: bold; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* ========== 添加版本页 ========== */
#page-addVersion .page-content {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
}

/* 步骤指引 */
.add-steps {
    display: flex;
    align-items: center;
    gap: 0;
    background: #fff;
    border-radius: 8px;
    padding: 16px 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.add-step {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    font-size: 13px;
    color: #aaa;
    position: relative;
}
.add-step:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 1px;
    background: #ddd;
}
.add-step.active { color: var(--primary); }
.add-step.done { color: var(--success); }
.add-step-num {
    width: 24px; height: 24px; border-radius: 50%;
    background: #eee; color: #999;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: bold; flex-shrink: 0;
    transition: all 0.3s;
}
.add-step.active .add-step-num { background: var(--primary); color: #fff; }
.add-step.done .add-step-num { background: var(--success); color: #fff; }

/* 左侧表单卡片 */
.add-form-card {
    background: #fff; border-radius: 10px; padding: 28px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.add-form-card h3 {
    font-size: 16px; margin-bottom: 20px; padding-bottom: 14px;
    border-bottom: 1px solid #f0f0f0;
}
.form-section {
    margin-bottom: 24px;
}
.form-section-title {
    font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
    color: #aaa; margin-bottom: 12px; font-weight: 600;
}
.form-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.form-group label {
    display: block; font-size: 13px; color: #555; margin-bottom: 6px; font-weight: 500;
}
.form-group label .required { color: var(--danger); margin-left: 2px; }
.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%; padding: 10px 14px; border: 1.5px solid #e8e8e8;
    border-radius: 6px; font-size: 14px; font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
}
.combo-wrap { position: relative; }
.combo-wrap input[list] { width: 100%; padding: 10px 14px; border: 1.5px solid #e8e8e8; border-radius: 6px; font-size: 14px; font-family: inherit; transition: border-color 0.2s, box-shadow 0.2s; background: #fafafa; }
.combo-wrap input[list]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(102,126,234,0.12); background: #fff; }
.form-select {
    width: 100%; padding: 10px 14px; border: 1.5px solid #e8e8e8;
    border-radius: 6px; font-size: 14px; font-family: inherit;
    background: #fafafa; cursor: pointer; color: #333;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(102,126,234,0.12); background: #fff; }

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
    background: #fff;
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-group .hint {
    font-size: 11px; color: #aaa; margin-top: 4px;
}

/* 开关 */
.switch-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: #f9f9f9; border-radius: 6px;
    border: 1.5px solid #e8e8e8;
}
.switch-row label { margin: 0; font-size: 14px; color: #333; }
.switch-label-text { display: flex; flex-direction: column; }
.switch-label-text small { font-size: 11px; color: #aaa; font-weight: normal; }
.toggle-switch {
    position: relative; width: 44px; height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #ccc; border-radius: 24px;
    transition: 0.3s;
}
.toggle-slider::before {
    content: ''; position: absolute;
    width: 18px; height: 18px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%;
    transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* 右侧上传卡片 */
.add-upload-card {
    background: #fff; border-radius: 10px; padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); position: sticky; top: 20px;
}
.upload-card-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 20px;
}
.upload-card-header h3 { font-size: 15px; margin: 0; }
.upload-icon-badge {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, #667eea22, #764ba222);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}

/* ========== 版本列表页下拉筛选 ========== */
.filter-bar {
    display: flex; gap: 12px; align-items: center;
    margin-bottom: 16px; flex-wrap: wrap;
}
.filter-bar .filter-label { font-size: 13px; color: var(--text-light); white-space: nowrap; }
.filter-bar select {
    padding: 7px 12px; border: 1.5px solid #e8e8e8; border-radius: 6px;
    font-size: 13px; background: #fff; color: #333; cursor: pointer;
}
.filter-bar select:focus { outline: none; border-color: var(--primary); }
.filter-bar input[type="text"] {
    padding: 7px 12px; border: 1.5px solid #e8e8e8; border-radius: 6px; font-size: 13px;
}
.filter-bar input[type="text"]:focus { outline: none; border-color: var(--primary); }

/* 拖拽上传区 */
.drop-zone {
    border: 2px dashed #ddd; border-radius: 10px;
    padding: 32px 20px; text-align: center;
    cursor: pointer; transition: all 0.3s;
    background: #fafafa;
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(102,126,234,0.05);
}
.drop-zone.has-file {
    border-color: var(--success); border-style: solid;
    background: rgba(39,174,96,0.04);
}
.drop-zone-icon { font-size: 40px; margin-bottom: 12px; }
.drop-zone-text { font-size: 14px; color: #555; margin-bottom: 6px; }
.drop-zone-hint { font-size: 12px; color: #aaa; }
.drop-zone input[type="file"] { display: none; }

/* APK 预览卡 */
.apk-preview {
    margin-top: 16px; display: none;
    background: #f9f9f9; border-radius: 8px; padding: 14px;
    border: 1px solid #e8e8e8;
}
.apk-preview.show { display: block; }
.apk-preview-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.apk-icon { font-size: 32px; }
.apk-info { flex: 1; min-width: 0; }
.apk-info-name { font-size: 13px; font-weight: 600; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apk-info-size { font-size: 12px; color: #aaa; }
.apk-md5 { font-size: 11px; color: #aaa; word-break: break-all; margin-top: 4px; }
.apk-remove {
    padding: 4px 10px; border: 1px solid #e0e0e0; border-radius: 4px;
    background: #fff; color: var(--danger); font-size: 12px; cursor: pointer;
}
.apk-remove:hover { background: #fde8e8; }

/* 底部提交 */
.add-actions {
    display: flex; gap: 12px; justify-content: flex-end;
    margin-top: 24px; padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}
.btn-add-submit {
    padding: 10px 32px; background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; border: none; border-radius: 6px;
    font-size: 15px; cursor: pointer; transition: opacity 0.3s; letter-spacing: 2px;
}
.btn-add-submit:hover { opacity: 0.88; }
.btn-add-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-add-reset {
    padding: 10px 20px; background: #fff; color: var(--text-light);
    border: 1.5px solid #ddd; border-radius: 6px;
    font-size: 14px; cursor: pointer;
}
.btn-add-reset:hover { background: #f5f5f5; }

/* 进度动画 */
.upload-progress {
    display: none; margin-top: 12px;
}
.upload-progress.show { display: block; }
.progress-bar-wrap {
    height: 6px; background: #eee; border-radius: 3px; overflow: hidden;
}
.progress-bar-fill {
    height: 100%; background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px; width: 0%; transition: width 0.3s;
}
.progress-text { font-size: 12px; color: #aaa; margin-top: 4px; text-align: right; }

/* 成功状态 */
.upload-success {
    display: none; margin-top: 12px; text-align: center;
    padding: 16px; background: #f0faf4; border-radius: 8px;
    border: 1px solid #c8e6c9;
}
.upload-success.show { display: block; }
.upload-success-icon { font-size: 36px; margin-bottom: 6px; }
.upload-success-text { font-size: 13px; color: var(--success); font-weight: 600; }
