/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --bg-color: #F9FAFB;
    --card-bg: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ==================== 容器布局 ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================== 头部 ==================== */
.header {
    background: var(--card-bg);
    padding: 24px 32px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.version {
    background: var(--primary-color);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

/* ==================== 主内容区 ==================== */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* ==================== 卡片 ==================== */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* ==================== 表单 ==================== */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.step-badge {
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

input[type="text"],
select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    background: white;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

input[type="text"]:disabled,
select:disabled {
    background: var(--bg-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.input-group {
    margin-bottom: 12px;
}

.hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==================== 模板信息 ==================== */
.template-info {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.info-item {
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-item strong {
    color: var(--text-primary);
}

/* ==================== 按钮 ==================== */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    flex: 1;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
}

/* ==================== 状态卡片 ==================== */
.status-card,
.help-card,
.history-card {
    margin-bottom: 20px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.status-item:last-child {
    border-bottom: none;
}

.status-label {
    color: var(--text-secondary);
}

.status-value {
    font-weight: 500;
    color: var(--text-primary);
}

.status-value.success {
    color: var(--success-color);
}

.status-value.error {
    color: var(--danger-color);
}

/* ==================== 加载动画 ==================== */
.loading-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--warning-color);
    border-radius: 50%;
    animation: pulse 1.4s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ==================== 帮助列表 ==================== */
.help-list {
    list-style: none;
    counter-reset: step-counter;
}

.help-list li {
    counter-increment: step-counter;
    padding-left: 32px;
    position: relative;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.help-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: var(--primary-color);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

/* ==================== 历史记录 ==================== */
.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.history-item:last-child {
    border-bottom: none;
}

.history-domain {
    font-weight: 500;
    color: var(--text-primary);
}

.history-time {
    color: var(--text-secondary);
    font-size: 12px;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-size: 13px;
}

/* ==================== 模态框 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    max-height: calc(90vh - 160px);
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ==================== 进度条 ==================== */
.progress-container {
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==================== 日志容器 ==================== */
.log-container {
    background: #1F2937;
    color: #E5E7EB;
    border-radius: 8px;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
}

.log-item {
    margin-bottom: 4px;
    padding-left: 20px;
    position: relative;
}

.log-item::before {
    content: '>';
    position: absolute;
    left: 4px;
    color: var(--success-color);
}

.log-item.error::before {
    color: var(--danger-color);
}

/* ==================== 预览内容 ==================== */
.preview-grid {
    display: grid;
    gap: 16px;
}

.preview-item {
    display: flex;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.preview-label {
    flex: 0 0 120px;
    font-weight: 500;
    color: var(--text-secondary);
}

.preview-value {
    flex: 1;
    color: var(--text-primary);
    word-break: break-all;
}

/* ==================== 结果展示 ==================== */
.result-success {
    text-align: center;
    padding: 20px;
}

.result-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--success-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
}

.result-icon.error {
    background: var(--danger-color);
}

.result-message {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.result-info {
    background: var(--bg-color);
    padding: 16px;
    border-radius: 8px;
    text-align: left;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row-label {
    color: var(--text-secondary);
}

.info-row-value {
    font-weight: 500;
    color: var(--text-primary);
    font-family: monospace;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .logo {
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
    }
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
