/* ==========================================================
   SiteForge Installer Stylesheet
   ========================================================== */

:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #3B82F6;
    --primary-bg: #EFF6FF;
    --success: #059669;
    --success-bg: #ECFDF5;
    --danger: #DC2626;
    --danger-bg: #FEF2F2;
    --warning: #D97706;
    --warning-bg: #FFFBEB;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --shadow-xl: 0 20px 25px rgba(0,0,0,.1), 0 10px 10px rgba(0,0,0,.04);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 50%, #7C3AED 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: var(--gray-800);
    line-height: 1.6;
}

/* ---------- Installer Container ---------- */
.installer {
    width: 100%;
    max-width: 640px;
}

.installer-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.installer-brand h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.02em;
}

.installer-brand h1 span {
    background: linear-gradient(135deg, #93C5FD, #C4B5FD);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.installer-brand p {
    color: rgba(255,255,255,.7);
    font-size: .95rem;
    margin-top: .25rem;
}

/* ---------- Step Indicator ---------- */
.steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.step-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: all .3s ease;
    border: 2px solid rgba(255,255,255,.25);
    color: rgba(255,255,255,.5);
    background: rgba(255,255,255,.08);
}

.step-dot.active {
    background: #fff;
    color: var(--primary);
    border-color: #fff;
    box-shadow: 0 0 0 4px rgba(255,255,255,.25);
    transform: scale(1.1);
}

.step-dot.completed {
    background: rgba(255,255,255,.9);
    color: var(--success);
    border-color: rgba(255,255,255,.9);
}

.step-line {
    flex: 1;
    height: 2px;
    background: rgba(255,255,255,.2);
    max-width: 48px;
}

.step-line.completed {
    background: rgba(255,255,255,.7);
}

/* ---------- Card ---------- */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.card-header {
    padding: 2rem 2rem 0;
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: .25rem;
}

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

.card-body {
    padding: 1.5rem 2rem 2rem;
}

.card-footer {
    padding: 1rem 2rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* ---------- Form Elements ---------- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: .35rem;
}

.form-group label .required {
    color: var(--danger);
}

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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"] {
    width: 100%;
    padding: .65rem .85rem;
    font-size: .925rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    color: var(--gray-800);
    transition: border-color .2s, box-shadow .2s, background .2s;
    outline: none;
    font-family: inherit;
}

input:focus {
    border-color: var(--primary-light);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

input.is-invalid {
    border-color: var(--danger);
    background: var(--danger-bg);
}

.form-hint {
    font-size: .8rem;
    color: var(--gray-400);
    margin-top: .25rem;
}

.form-error {
    font-size: .8rem;
    color: var(--danger);
    margin-top: .25rem;
    display: none;
}

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

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .65rem 1.5rem;
    font-size: .925rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all .2s ease;
    font-family: inherit;
    text-decoration: none;
    line-height: 1.4;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 1px 3px rgba(37,99,235,.35);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

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

.btn-success {
    background: linear-gradient(135deg, var(--success), #047857);
    color: #fff;
    box-shadow: 0 1px 3px rgba(5,150,105,.35);
}

.btn-success:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(5,150,105,.35);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--gray-300);
    color: var(--gray-600);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--primary-light);
    color: var(--primary);
    background: var(--primary-bg);
}

.btn-sm {
    padding: .45rem 1rem;
    font-size: .85rem;
}

.btn-block {
    width: 100%;
}

/* ---------- Alerts ---------- */
.alert {
    padding: .85rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: .6rem;
}

.alert-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1.4;
}

.alert-success {
    background: var(--success-bg);
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.alert-danger {
    background: var(--danger-bg);
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-warning {
    background: var(--warning-bg);
    color: #92400E;
    border: 1px solid #FDE68A;
}

.alert-info {
    background: var(--primary-bg);
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

/* ---------- Requirements List ---------- */
.req-list {
    list-style: none;
    margin: .5rem 0;
}

.req-list li {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .75rem;
    border-radius: var(--radius-sm);
    margin-bottom: .35rem;
    font-size: .9rem;
    transition: background .2s;
}

.req-list li:hover {
    background: var(--gray-50);
}

.req-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    flex-shrink: 0;
    font-weight: 700;
}

.req-pass .req-icon {
    background: var(--success-bg);
    color: var(--success);
}

.req-fail .req-icon {
    background: var(--danger-bg);
    color: var(--danger);
}

.req-label {
    flex: 1;
    color: var(--gray-700);
}

.req-value {
    font-size: .8rem;
    color: var(--gray-400);
    font-family: 'Consolas', 'Courier New', monospace;
}

/* ---------- Progress ---------- */
.progress-list {
    list-style: none;
    margin: 1rem 0;
}

.progress-list li {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: .9rem;
}

.progress-list li:last-child {
    border-bottom: none;
}

.progress-status {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.progress-status .spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.progress-status .check {
    color: var(--success);
    font-size: 1.1rem;
    font-weight: 700;
}

.progress-status .pending-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-300);
}

.progress-status .fail-x {
    color: var(--danger);
    font-size: 1.1rem;
    font-weight: 700;
}

.progress-bar-track {
    width: 100%;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin: 1.25rem 0;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #7C3AED);
    border-radius: 3px;
    transition: width .5s ease;
    width: 0%;
}

/* ---------- Success Screen ---------- */
.success-screen {
    text-align: center;
    padding: 1rem 0;
}

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--success), #047857);
    color: #fff;
    font-size: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 24px rgba(5,150,105,.3);
}

.success-screen h3 {
    font-size: 1.4rem;
    color: var(--gray-900);
    margin-bottom: .5rem;
}

.success-screen p {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.success-links {
    display: flex;
    gap: .75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.security-note {
    background: var(--warning-bg);
    border: 1px solid #FDE68A;
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    font-size: .825rem;
    color: #92400E;
    margin-top: 1.5rem;
    text-align: left;
}

/* ---------- DB Test ---------- */
.db-test-result {
    margin-top: .75rem;
    display: none;
}

.db-test-result.visible {
    display: block;
}

/* ---------- Spinner keyframe ---------- */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeInUp .4s ease;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    body { padding: 1rem .75rem; }
    .card-header, .card-body, .card-footer { padding-left: 1.25rem; padding-right: 1.25rem; }
    .form-row { grid-template-columns: 1fr; }
    .step-dot { width: 30px; height: 30px; font-size: .7rem; }
    .step-line { max-width: 28px; }
    .installer-brand h1 { font-size: 1.6rem; }
}
