/* ═══════════════════════════════════════════════════════════════
   W2A Installer — Self-contained premium design system
   ═══════════════════════════════════════════════════════════════ */

:root {
    --primary: #6366F1;
    --primary-light: #818CF8;
    --primary-dark: #4F46E5;
    --accent: #8B5CF6;
    --bg-base: #0F172A;
    --bg-surface: #1E293B;
    --bg-elevated: #334155;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border: #334155;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    --gradient-primary: linear-gradient(135deg, #6366F1, #8B5CF6);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

a { color: var(--primary-light); text-decoration: none; }

/* ─── Background ──────────────────────────────────────────── */
.install-bg {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
}
.install-gradient {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(99,102,241,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139,92,246,0.08) 0%, transparent 50%),
        radial-gradient(ellipse 40% 30% at 10% 60%, rgba(6,182,212,0.06) 0%, transparent 50%);
}

/* ─── Container ───────────────────────────────────────────── */
.install-container {
    position: relative; z-index: 1;
    max-width: 720px; margin: 0 auto;
    padding: 40px 24px 60px;
}

/* ─── Header ──────────────────────────────────────────────── */
.install-header { text-align: center; margin-bottom: 32px; }
.install-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.install-logo-icon {
    width: 52px; height: 52px; border-radius: var(--radius-md);
    background: var(--gradient-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
}
.install-logo-text {
    font-size: 2rem; font-weight: 900; letter-spacing: -0.03em;
    background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.install-header-subtitle { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; }

/* ─── Progress Steps ──────────────────────────────────────── */
.install-steps {
    display: flex; align-items: center; justify-content: center;
    gap: 0; margin-bottom: 32px; flex-wrap: wrap;
}
.step-item { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.step-circle {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700;
    background: var(--bg-elevated); color: var(--text-muted);
    border: 2px solid var(--border);
    transition: var(--transition);
    flex-shrink: 0;
}
.step-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); display: none; }

.step-active .step-circle { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 12px rgba(99,102,241,0.4); }
.step-active .step-label { color: var(--primary-light); display: inline; }

.step-done .step-circle { background: var(--success); border-color: var(--success); color: #fff; }

.step-line { width: 24px; height: 2px; background: var(--border); flex-shrink: 0; margin: 0 4px; }
.step-line-done { background: var(--success); }

@media (min-width: 640px) {
    .step-label { display: inline; }
    .step-line { width: 32px; }
}

/* ─── Card ────────────────────────────────────────────────── */
.install-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 36px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

/* ─── Flash ───────────────────────────────────────────────── */
.install-flash {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius-md);
    margin-bottom: 16px; font-size: 0.85rem; font-weight: 500;
}
.install-flash-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #F87171; }
.install-flash-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #34D399; }

/* ─── Step Content ────────────────────────────────────────── */
.install-step-content {}

.step-header { text-align: center; margin-bottom: 32px; }
.step-header-icon {
    width: 64px; height: 64px; border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px; color: #fff;
}
.step-icon-violet { background: linear-gradient(135deg, #6366F1, #8B5CF6); }
.step-icon-cyan { background: linear-gradient(135deg, #06B6D4, #0EA5E9); }
.step-icon-emerald { background: linear-gradient(135deg, #10B981, #059669); }
.step-icon-amber { background: linear-gradient(135deg, #F59E0B, #D97706); }
.step-icon-rose { background: linear-gradient(135deg, #F43F5E, #E11D48); }
.step-icon-indigo { background: linear-gradient(135deg, #6366F1, #4F46E5); }

.step-header h2 { font-size: 1.5rem; margin-bottom: 8px; }
.step-header p { color: var(--text-secondary); font-size: 0.9rem; max-width: 500px; margin: 0 auto; }

/* ─── Requirements Check ──────────────────────────────────── */
.check-section { margin-bottom: 24px; }
.check-section h3 { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; margin-bottom: 12px; color: var(--text-primary); }
.check-grid { display: flex; flex-direction: column; gap: 6px; }
.check-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.15); border: 1px solid transparent;
}
.check-pass { border-color: rgba(16,185,129,0.15); }
.check-pass .check-status { color: var(--success); }
.check-fail { border-color: rgba(239,68,68,0.2); background: rgba(239,68,68,0.05); }
.check-fail .check-status { color: var(--danger); }
.check-info { flex: 1; }
.check-label { font-size: 0.85rem; font-weight: 600; }
.check-value { display: block; font-size: 0.75rem; color: var(--text-muted); }
.check-value small { opacity: 0.7; }

/* ─── Forms ───────────────────────────────────────────────── */
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input, .form-select, textarea.form-input {
    width: 100%; padding: 12px 16px; border-radius: var(--radius-sm);
    background: var(--bg-base); border: 1.5px solid var(--border);
    color: var(--text-primary); font-size: 0.9rem; font-family: inherit;
    transition: var(--transition);
}
.form-input:focus, .form-select:focus, textarea.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-input::placeholder { color: var(--text-muted); }
.form-input-lg { padding: 16px 20px; font-size: 1rem; }
.form-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; display: block; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; display: block; }
.form-group { margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-section-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--text-muted);
    margin: 28px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

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

/* ─── DB Test Result ──────────────────────────────────────── */
.db-test-result {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    margin-bottom: 20px; font-size: 0.85rem; font-weight: 500;
}
.db-test-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #34D399; }
.db-test-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #F87171; }

/* ─── Branding ────────────────────────────────────────────── */
.branding-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.branding-upload-card {
    padding: 20px; border-radius: var(--radius-lg);
    background: rgba(0,0,0,0.15); border: 1px solid var(--border);
    text-align: center;
}
.branding-upload-card h3 { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.9rem; margin-bottom: 16px; }
.branding-preview {
    width: 120px; height: 60px; margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md); overflow: hidden;
    background: rgba(0,0,0,0.2); border: 1px solid var(--border);
}
.branding-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.branding-preview-small { width: 64px; height: 64px; }

.file-upload { position: relative; }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2; }
.file-upload-area {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 16px 12px; border-radius: var(--radius-sm);
    border: 2px dashed var(--border); color: var(--text-muted);
    font-size: 0.82rem; transition: var(--transition);
}
.file-upload:hover .file-upload-area { border-color: var(--primary); color: var(--primary-light); }
.file-upload-area small { font-size: 0.68rem; }

@media (max-width: 640px) { .branding-grid { grid-template-columns: 1fr; } }

/* ─── Summary ─────────────────────────────────────────────── */
.summary-grid { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.summary-card {
    padding: 16px 20px; border-radius: var(--radius-md);
    background: rgba(0,0,0,0.15); border: 1px solid var(--border);
}
.summary-card h4 { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; margin-bottom: 10px; color: var(--primary-light); }
.summary-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; font-size: 0.82rem; border-bottom: 1px solid rgba(51,65,85,0.3);
}
.summary-row:last-child { border-bottom: none; }
.summary-row span:first-child { color: var(--text-muted); }
.summary-row code { background: rgba(99,102,241,0.1); color: var(--primary-light); padding: 2px 8px; border-radius: 4px; font-size: 0.78rem; }

/* ─── Progress ────────────────────────────────────────────── */
.install-progress { text-align: center; padding: 20px 0; }
.install-progress h3 { margin-bottom: 20px; font-size: 1.1rem; }
.progress-bar-wrap {
    width: 100%; height: 8px; border-radius: var(--radius-full);
    background: var(--bg-elevated); overflow: hidden; margin-bottom: 24px;
}
.progress-bar {
    width: 0; height: 100%; border-radius: var(--radius-full);
    background: var(--gradient-primary);
    transition: width 0.5s ease;
}
.progress-steps { text-align: left; }
.progress-step-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; font-size: 0.82rem; color: var(--text-secondary);
}
.step-spinner {
    width: 16px; height: 16px; border: 2px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.6s linear infinite; flex-shrink: 0;
}
.step-done-icon { border-color: var(--success) !important; border-top-color: var(--success) !important; animation: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Success ─────────────────────────────────────────────── */
.install-success { text-align: center; padding: 32px 0; }
.success-icon { color: var(--success); margin-bottom: 20px; }
.install-success h2 { margin-bottom: 12px; font-size: 1.5rem; }
.install-success p { color: var(--text-secondary); margin-bottom: 24px; }

/* ─── Error ───────────────────────────────────────────────── */
.install-error { text-align: center; padding: 24px 0; }
.error-icon { color: var(--danger); margin-bottom: 16px; }
.install-error h3 { margin-bottom: 8px; }
.install-error p { color: var(--text-secondary); margin-bottom: 20px; }

/* ─── Notes & Warnings ────────────────────────────────────── */
.install-note {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    background: rgba(59,130,246,0.06); border: 1px solid rgba(59,130,246,0.15);
    font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 20px;
}
.install-note i { color: var(--info); flex-shrink: 0; margin-top: 2px; }
.install-warning {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.15);
    color: #F87171; font-size: 0.85rem; font-weight: 500; margin-bottom: 16px;
}

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 0.9rem; border: none; cursor: pointer;
    transition: var(--transition); text-decoration: none; line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--gradient-primary); color: #fff; box-shadow: 0 4px 15px rgba(99,102,241,0.4); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(99,102,241,0.5); color: #fff; }

.btn-outline { background: transparent; color: var(--text-primary); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary-light); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-md); }

.btn-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff; border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

/* ─── Actions ─────────────────────────────────────────────── */
.step-actions {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border);
    gap: 12px; flex-wrap: wrap;
}

/* ─── Footer ──────────────────────────────────────────────── */
.install-footer {
    text-align: center; margin-top: 24px;
    font-size: 0.72rem; color: var(--text-muted);
}

/* ─── Utilities ───────────────────────────────────────────── */
.w-4 { width: 16px; height: 16px; }
.w-5 { width: 20px; height: 20px; }
.w-8 { width: 32px; height: 32px; }
.w-12 { width: 48px; height: 48px; }
.w-16 { width: 64px; height: 64px; }
.h-4 { height: 16px; } .h-5 { height: 20px; } .h-8 { height: 32px; } .h-12 { height: 48px; } .h-16 { height: 64px; }
