/* ============================================================
   众得园®️ 生态系统 - 安装向导样式表
   Version: 1.0.0
   ============================================================ */

:root {
    --color-green: #10B981;
    --color-green-dark: #059669;
    --color-green-light: #D1FAE5;
    --color-green-bg: #ECFDF5;
    --color-black: #111827;
    --color-gray-dark: #374151;
    --color-gray: #6B7280;
    --color-gray-light: #E5E7EB;
    --color-gray-bg: #F9FAFB;
    --color-white: #FFFFFF;
    --color-red: #EF4444;
    --color-red-light: #FEE2E2;
    --color-red-bg: #FEF2F2;
    --color-yellow: #F59E0B;
    --color-yellow-light: #FEF3C7;
    --color-yellow-bg: #FFFBEB;
    --color-blue: #3B82F6;
    --color-blue-light: #DBEAFE;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius-sm: 6px;
    --radius: 12px;
    --radius-lg: 16px;
    --font-stack: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-stack);
    background: linear-gradient(135deg, #ECFDF5 0%, #F0FDF4 50%, #ECFDF5 100%);
    color: var(--color-black);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

/* Container */
.installer-container {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
}

/* Header */
.installer-header {
    text-align: center;
    padding: 32px 20px 24px;
}

.installer-header .logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--color-green), var(--color-green-dark));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: var(--shadow-lg);
}

.installer-header .logo svg {
    width: 44px;
    height: 44px;
    fill: var(--color-white);
}

.installer-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.installer-header .subtitle {
    font-size: 0.925rem;
    color: var(--color-gray);
    font-weight: 400;
}

/* Progress Indicator */
.progress-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 0 20px;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.progress-step .step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    background: var(--color-gray-light);
    color: var(--color-gray);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.progress-step.active .step-number {
    background: var(--color-green);
    color: var(--color-white);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.progress-step.completed .step-number {
    background: var(--color-green);
    color: var(--color-white);
}

.progress-step .step-label {
    font-size: 0.8125rem;
    color: var(--color-gray);
    font-weight: 500;
    white-space: nowrap;
}

.progress-step.active .step-label {
    color: var(--color-green);
    font-weight: 600;
}

.progress-step.completed .step-label {
    color: var(--color-green-dark);
}

.progress-line {
    width: 40px;
    height: 2px;
    background: var(--color-gray-light);
    border-radius: 1px;
    flex-shrink: 0;
}

.progress-line.completed {
    background: var(--color-green);
}

/* Card */
.card {
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 32px;
    margin-bottom: 20px;
    border: 1px solid var(--color-gray-light);
}

.card-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-gray-light);
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: 4px;
}

.card-header p {
    font-size: 0.875rem;
    color: var(--color-gray);
}

/* Form Controls */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-gray-dark);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--color-red);
    margin-left: 2px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9375rem;
    font-family: var(--font-stack);
    color: var(--color-black);
    background: var(--color-white);
    border: 1.5px solid var(--color-gray-light);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    outline: none;
    line-height: 1.5;
}

.form-input:focus {
    border-color: var(--color-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-input::placeholder {
    color: var(--color-gray);
}

.form-input.error {
    border-color: var(--color-red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--color-gray);
    margin-top: 4px;
}

.form-error {
    font-size: 0.8125rem;
    color: var(--color-red);
    margin-top: 4px;
    display: none;
}

.form-error.visible {
    display: block;
}

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

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--font-stack);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.5;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--color-green-dark);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--color-gray-bg);
    color: var(--color-gray-dark);
    border: 1.5px solid var(--color-gray-light);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-gray-light);
}

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

.btn-danger:hover:not(:disabled) {
    background: #DC2626;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1.0625rem;
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 28px;
}

/* Check List (Environment Check) */
.check-list {
    list-style: none;
    padding: 0;
}

.check-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    transition: background 0.15s ease;
}

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

.check-item:hover {
    background: var(--color-gray-bg);
}

.check-item .item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.check-item .item-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.check-item.pass .item-icon {
    background: var(--color-green-bg);
    color: var(--color-green);
}

.check-item.fail .item-icon {
    background: var(--color-red-bg);
    color: var(--color-red);
}

.check-item.warn .item-icon {
    background: var(--color-yellow-bg);
    color: var(--color-yellow);
}

.check-item .item-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-gray-dark);
}

.check-item .item-value {
    font-size: 0.8125rem;
    color: var(--color-gray);
    text-align: right;
    flex-shrink: 0;
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.check-item .item-value.pass {
    color: var(--color-green);
    font-weight: 600;
}

.check-item .item-value.fail {
    color: var(--color-red);
    font-weight: 600;
}

.check-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-top: 20px;
    font-size: 0.9375rem;
    font-weight: 600;
}

.check-summary.all-pass {
    background: var(--color-green-bg);
    color: var(--color-green-dark);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.check-summary.has-fail {
    background: var(--color-red-bg);
    color: var(--color-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Install Progress */
.install-progress {
    margin: 16px 0;
}

.install-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--color-gray-light);
}

.install-step:last-child {
    border-bottom: none;
}

.install-step .step-status {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    margin-top: 1px;
}

.install-step.pending .step-status {
    background: var(--color-gray-light);
    color: var(--color-gray);
}

.install-step.running .step-status {
    background: var(--color-blue-light);
    color: var(--color-blue);
    animation: pulse 1.5s infinite;
}

.install-step.success .step-status {
    background: var(--color-green-bg);
    color: var(--color-green);
}

.install-step.error .step-status {
    background: var(--color-red-bg);
    color: var(--color-red);
}

.install-step .step-content {
    flex: 1;
    min-width: 0;
}

.install-step .step-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-gray-dark);
    margin-bottom: 2px;
}

.install-step .step-message {
    font-size: 0.8125rem;
    color: var(--color-gray);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-gray-light);
    border-top-color: var(--color-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

/* Already Installed */
.already-installed {
    text-align: center;
    padding: 40px 20px;
}

.already-installed .icon {
    width: 72px;
    height: 72px;
    background: var(--color-green-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: var(--color-green);
}

.already-installed h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: 8px;
}

.already-installed p {
    font-size: 0.9375rem;
    color: var(--color-gray);
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Alert / Notification */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success {
    background: var(--color-green-bg);
    color: var(--color-green-dark);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: var(--color-red-bg);
    color: var(--color-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: var(--color-yellow-bg);
    color: #92400E;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.alert-info {
    background: var(--color-blue-light);
    color: #1E40AF;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Footer */
.installer-footer {
    text-align: center;
    padding: 16px 20px 32px;
    color: var(--color-gray);
    font-size: 0.8125rem;
}

.installer-footer a {
    color: var(--color-green);
    text-decoration: none;
}

.installer-footer a:hover {
    text-decoration: underline;
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 32px; }
.mt-6 { margin-top: 24px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }

/* DB test result inline */
.db-test-result {
    font-size: 0.8125rem;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-top: 8px;
    display: none;
}

.db-test-result.success {
    display: block;
    background: var(--color-green-bg);
    color: var(--color-green-dark);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.db-test-result.error {
    display: block;
    background: var(--color-red-bg);
    color: var(--color-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Password strength */
.password-strength {
    height: 4px;
    border-radius: 2px;
    margin-top: 6px;
    transition: all 0.3s ease;
    background: var(--color-gray-light);
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    border-radius: 2px;
    transition: all 0.3s ease;
    width: 0;
}

.password-strength-bar.weak {
    width: 25%;
    background: var(--color-red);
}

.password-strength-bar.fair {
    width: 50%;
    background: var(--color-yellow);
}

.password-strength-bar.good {
    width: 75%;
    background: var(--color-blue);
}

.password-strength-bar.strong {
    width: 100%;
    background: var(--color-green);
}

/* Toggle password visibility */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-gray);
    font-size: 1rem;
    padding: 4px;
    line-height: 1;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-dialog {
    background: var(--color-white);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.loading-dialog .spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.loading-dialog p {
    margin-top: 16px;
    font-weight: 600;
    color: var(--color-gray-dark);
}

/* Print */
@media print {
    body { background: white; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    .btn { display: none; }
}
