/* assets/setup.css —— 系统初始化安装向导专属样式 */

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", sans-serif;
    background: var(--bg-page);
    background-attachment: fixed;
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; margin: 0; padding: 20px;
    color: var(--text-primary);
    transition: background 0.3s, color 0.3s;
}
.setup-card {
    background: var(--bg-modal);
    padding: 40px; border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    width: 100%; max-width: 580px;
    position: relative; transition: background 0.3s, box-shadow 0.3s;
}
.setup-card-wide { max-width: 1080px !important; padding: 28px 32px !important; }
body:has(.setup-card-wide) { align-items: flex-start !important; padding-top: 30px !important; }
html.dark-mode .setup-card { border: 1px solid var(--border-light); }

.header-title { text-align: center; margin-bottom: 30px; }
.header-title h2 { margin: 0 0 8px 0; font-size: 24px; font-weight: 700; }
.header-title p { margin: 0; font-size: 14px; }
.setup-card-wide .header-title { margin-bottom: 18px !important; }
.setup-card-wide .header-title h2 { font-size: 22px !important; margin-bottom: 4px !important; }
.setup-card-wide .header-title p  { font-size: 13px !important; }

.form-group { margin-bottom: 22px; }
label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }
.btn-gen {
    background: #475569; color: white; border: none;
    padding: 0 14px; border-radius: var(--radius-md);
    font-size: 13px; font-weight: 600; cursor: pointer;
    white-space: nowrap; transition: background 0.2s;
}
.btn-gen:hover { background: #334155; }
html.dark-mode .btn-gen { background: #374151 !important; color: #e5e7eb !important; }
html.dark-mode .btn-gen:hover { background: #4b5563 !important; }

input[type="text"], input[type="password"], textarea, select {
    width: 100%; padding: 12px 16px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    font-size: 14px;
    outline: none; transition: all 0.2s;
    font-family: inherit;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
textarea { resize: vertical; min-height: 90px; font-size: 13px; }

.btn-primary {
    width: 100%; padding: 14px; background: var(--accent-blue);
    border: none; color: white;
    border-radius: var(--radius-md); font-size: 16px; font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
    transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-blue-hover); }

.error {
    color: var(--accent-red); font-size: 13px;
    margin-bottom: 20px; background: var(--bg-alert-error);
    padding: 12px 16px; border-radius: var(--radius-md);
    border: 1px solid #fecaca;
}
.success-box {
    background: var(--bg-alert-success); color: #166534;
    padding: 20px; border-radius: var(--radius-md);
    margin-bottom: 20px; border: 1px solid #dcfce7;
    text-align: left;
}
html.dark-mode .success-box { color: #34d399 !important; border-color: #065f46 !important; }

.btn-login {
    display: block; width: 100%; padding: 12px;
    background: var(--accent-green); color: white;
    text-decoration: none; border-radius: var(--radius-md);
    font-size: 16px; font-weight: 600;
    text-align: center; margin-top: 15px; transition: background 0.2s;
}
.btn-login:hover { background: var(--accent-green-hover); }

.warning-text {
    font-size: 13px; color: #b45309;
    margin-top: 12px; background: var(--bg-alert-warning);
    padding: 12px; border-radius: var(--radius-sm);
    border: 1px solid #fef3c7; line-height: 1.5;
}
html.dark-mode .warning-text { color: #fde68a !important; border-color: #78350f !important; }

/* ===== 新增：已存在数据库提示 ===== */
.existing-db-warning {
    background: #fef3c7; border: 1px solid #fcd34d;
    padding: 10px 14px; border-radius: var(--radius-md);
    margin-bottom: 10px; font-size: 13px; color: #92400e;
}
html.dark-mode .existing-db-warning { background: #451a03 !important; border-color: #78350f !important; color: #fde68a !important; }
.existing-db-checkbox {
    display: flex; align-items: flex-start; gap: 8px;
    cursor: pointer; user-select: none; font-weight: 600;
}
.existing-db-checkbox input { margin-top: 3px; flex-shrink: 0; }

/* ===== 结果框标题 ===== */
.box-title {
    font-weight: bold; margin-bottom: 4px; font-size: 13px;
}
.blue-title { color: #0369a1; }
.red-title { color: #991b1b; }
.amber-title { color: #92400e; }
html.dark-mode .blue-title  { color: #38bdf8 !important; }
html.dark-mode .red-title   { color: #f87171 !important; }
html.dark-mode .amber-title { color: #fbbf24 !important; }

.secret-note {
    font-size: 12px; color: #92400e; margin-top: 6px; line-height: 1.5;
}
html.dark-mode .secret-note { color: #fbbf24 !important; }

/* ===== 两栏紧凑布局 ===== */
.setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    align-items: start;
}
.setup-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.col-title {
    font-size: 14px; font-weight: 700; color: var(--text-heading);
    padding-bottom: 8px; border-bottom: 2px solid var(--accent-blue);
    margin-bottom: 4px; display: flex; align-items: center; gap: 6px;
}

.info-box {
    padding: 12px 14px !important;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: var(--bg-modal-card);
    box-sizing: border-box;
}
.info-box.secret-box { background: #fef3c7; border-color: #fcd34d; }
html.dark-mode .info-box { background: #1f2937 !important; border-color: #374151 !important; }
html.dark-mode .info-box.secret-box { background: #451a03 !important; border-color: #78350f !important; }

.info-label {
    font-size: 12px !important;
    font-weight: 700; color: var(--text-secondary);
    margin-bottom: 6px !important; display: block; letter-spacing: 0.2px;
}
.info-box.secret-box .info-label { color: #92400e; }
html.dark-mode .info-label { color: #cbd5e1 !important; }
html.dark-mode .info-box.secret-box .info-label { color: #fde68a !important; }

.info-value {
    padding: 8px 10px !important;
    border-radius: var(--radius-sm);
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 12px !important; font-weight: 600;
    letter-spacing: 0.3px; word-break: break-all;
    user-select: all; box-sizing: border-box; line-height: 1.5;
}
.info-value.uuid { color: #2563eb; background: #eff6ff; border: 1px dashed #bfdbfe; }
.info-value.secret { color: #b45309; background: #fffbeb; border: 1px dashed #fcd34d; }
html.dark-mode .info-value.uuid { background: #182232 !important; border-color: #374151 !important; color: #60a5fa !important; }
html.dark-mode .info-value.secret { background: #1f1408 !important; border-color: #78350f !important; color: #fbbf24 !important; }

.copy-btn {
    width: 100%; margin-top: 8px; padding: 7px 12px;
    border: none; border-radius: var(--radius-sm);
    color: #fff; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: background 0.2s;
    font-family: inherit;
}
.copy-btn.uuid { background: var(--accent-blue); }
.copy-btn.uuid:hover { background: var(--accent-blue-hover); }
.copy-btn.secret { background: var(--accent-amber); }
.copy-btn.secret:hover { background: var(--accent-amber-hover); }

.copy-btn-secret {
    flex: 1; padding: 8px;
    background: var(--accent-amber); color: white;
    border: none; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 13px; font-weight: 600;
    font-family: inherit;
}
.copy-btn-secret:hover { background: var(--accent-amber-hover); }

.info-note { font-size: 11px !important; margin-top: 6px !important; line-height: 1.5 !important; color: var(--text-muted); }
.info-box.secret-box .info-note { color: #92400e; }
html.dark-mode .info-note { color: #9ca3af !important; }
html.dark-mode .info-box.secret-box .info-note { color: #fbbf24 !important; }

/* ===== 成功页面的框 ===== */
.uuid-code, .token-code-display, .credential-code, .secret-code-display {
    font-family: inherit !important; letter-spacing: 0.5px; user-select: all;
    font-weight: 600; font-size: 13px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    display: block; word-break: break-all;
}
.uuid-code { color: #2563eb; background: #eff6ff; border: 1px dashed #bfdbfe; }
html.dark-mode .uuid-code { background: #182232 !important; border-color: #374151 !important; color: #60a5fa !important; }

.token-box, .credential-box { margin-top: 12px; padding: 12px; border-radius: var(--radius-md); }
.token-box { background: #fee2e2; border: 1px solid #fca5a5; }
.token-code-display { color: #dc2626; background: #fef2f2; border: 1px dashed #fca5a5; font-size: 15px !important; }
html.dark-mode .token-box { background: #450a0a !important; border-color: #7f1d1d !important; }
html.dark-mode .token-code-display { background: #111827 !important; border-color: #7f1d1d !important; color: #f87171 !important; }

.credential-box { background: #e0f2fe; border: 1px solid #bae6fd; }
.credential-code { color: #0369a1; background: #f0f9ff; border: 1px dashed #7dd3fc; }
html.dark-mode .credential-box { background: #082f49 !important; border-color: #0369a1 !important; }
html.dark-mode .credential-code { background: #0b132b !important; border-color: #0369a1 !important; color: #38bdf8 !important; }

.secret-box-setup {
    margin-top: 12px; padding: 12px;
    border-radius: var(--radius-md);
    background: #fef3c7; border: 1px solid #fcd34d;
}
html.dark-mode .secret-box-setup { background: #451a03 !important; border-color: #78350f !important; }
.secret-box-setup .secret-code-display {
    color: #b45309; background: #fffbeb; border: 1px dashed #fcd34d;
}
html.dark-mode .secret-box-setup .secret-code-display {
    background: #1f1408 !important; border-color: #78350f !important; color: #fbbf24 !important;
}

/* ===== 驱动/数据库区域 ===== */
.driver-section {
    background: var(--bg-modal-card); padding: 16px;
    border-radius: 10px; border: 1px dashed var(--border-input);
    margin-bottom: 22px;
}
.driver-section-title { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; font-weight: 600; }
html.dark-mode .driver-section { background: #1f2937 !important; border-color: #374151 !important; }
html.dark-mode .driver-section-title { color: #9ca3af !important; }

.form-row-2col { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }

/* ===== setup-card-wide 紧凑覆盖 ===== */
.setup-col form, .setup-col .form-stack { display: flex; flex-direction: column; gap: 10px; }
.setup-card-wide .form-group { margin-bottom: 0 !important; }
.setup-card-wide .form-group label {
    font-size: 12px !important; margin-bottom: 5px !important;
    font-weight: 600 !important; color: var(--text-secondary) !important;
}
.setup-card-wide .form-group input[type="text"],
.setup-card-wide .form-group input[type="password"],
.setup-card-wide .form-group textarea,
.setup-card-wide .form-group select {
    padding: 9px 12px !important; font-size: 13px !important;
    border-radius: 7px !important;
}
.setup-card-wide .form-group textarea { min-height: 62px !important; font-size: 12px !important; }
.setup-card-wide .driver-section { padding: 12px 14px !important; margin-bottom: 0 !important; border-radius: 9px !important; }
.setup-card-wide .driver-section-title { font-size: 11px !important; margin-bottom: 8px !important; }
.setup-card-wide .driver-section .form-group { margin-bottom: 8px !important; }
.setup-card-wide .driver-section .form-group:last-child { margin-bottom: 0 !important; }
.setup-card-wide .btn-primary { padding: 12px !important; font-size: 15px !important; margin-top: 4px; }
.setup-card-wide .error {
    padding: 10px 14px !important; font-size: 12.5px !important; margin-bottom: 12px !important;
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
    .setup-grid { grid-template-columns: 1fr !important; gap: 16px; }
    .setup-card-wide { max-width: 600px !important; padding: 22px 18px !important; }
}