/* =============================================
   SGEN Installer — Dark Theme
   ============================================= */

:root {
    --accent: #d51522;
    --accent-strong: rgb(201, 14, 48);
    --bg-deep: #0e0e0e;
    --bg-glow: #0e0e0e;
    --card-bg: rgba(22, 22, 22, 1);
    --card-border: rgba(255, 255, 255, 0.06);
    --text-muted: #8a8a8a;
    --input-bg: rgba(30, 30, 30, 1);
    --input-border: rgba(255, 255, 255, 0.1);
}

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

body {
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    margin: 0;
    background: radial-gradient(circle at 15% 20%, rgba(255, 78, 110, 0.12), transparent 45%),
                radial-gradient(circle at 80% 10%, rgba(75, 75, 75, 0.08), transparent 50%),
                linear-gradient(140deg, var(--bg-deep), var(--bg-glow));
    color: #fff;
    position: relative;
    overflow-x: hidden;
}

body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 999px;
    filter: blur(60px);
    opacity: 0.35;
    z-index: 0;
    pointer-events: none;
}

body::before {
    width: 260px;
    height: 260px;
    top: -60px;
    left: -20px;
    background: rgb(212 20 36 / 50%);
}

body::after {
    width: 420px;
    height: 420px;
    bottom: -120px;
    right: -60px;
    background: rgb(212 20 36 / 50%);
}

/* ---------- TOP NAVBAR ---------- */

.sgen-topbar {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 2rem;
}

.sgen-topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
}

.sgen-topbar-brand img {
    height: 28px;
    width: auto;
    border-radius: 0;
}

.sgen-topbar-version {
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

/* ---------- STEPPER NAV ---------- */

.wizard-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.wizard-stepper li {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.wizard-stepper li .step-label {
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    transition: all 0.2s;
}

.wizard-stepper li.is-active .step-label {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.wizard-stepper li.is-done .step-label {
    color: #fff;
}

/* .wizard-stepper li.is-done .step-label::before {
    content: '\2713';
    margin-right: 0.35rem;
    font-size: 0.72rem;
    opacity: 0.7;
} */

.wizard-stepper li .step-line {
    width: 32px;
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 0.35rem;
}

/* ---------- GLOBAL PROGRESS BAR ---------- */

.sgen-global-progress {
    position: relative;
    z-index: 10;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
}

.sgen-global-progress .bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    border-radius: 0 2px 2px 0;
    transition: width 0.4s ease;
}

/* ---------- LAYOUT ---------- */

.sg-installation-wrapper {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem 2rem;
}

.sg-install-container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

/* ---------- CARD ---------- */

.install-card {
    position: relative;
    background: var(--card-bg);
    border-radius: 24px;
    border: 1px solid var(--card-border);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.55);
    padding: 2.5rem clamp(1.5rem, 6vw, 3rem);
}

/* ---------- WELCOME STEP ---------- */

.welcome-center {
    text-align: center;
}

.welcome-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: var(--accent);
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 30px rgba(213, 21, 34, 0.35);
}

.welcome-icon img {
    width: 38px;
    height: 38px;
    filter: brightness(10);
}

.welcome-icon svg {
    width: 32px;
    height: 32px;
    fill: #fff;
}

.install-card h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 0.5rem;
    text-shadow: 0 6px 40px rgba(225, 25, 55, .15);
}

.install-card .lead {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0 0 1.75rem;
    line-height: 1.55;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    display: grid;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    justify-content: center;
}

.feature-list li .feat-icon {
    width: 18px;
    height: 18px;
    opacity: 0.45;
}

/* ---------- DIVIDER ---------- */

.card-divider {
    border: none;
    border-top: 1px solid var(--card-border);
    margin: 1.5rem 0;
}

/* ---------- FORM CONTROLS ---------- */

.install-card .form-label {
    color: #fff;
    font-weight: 600;
    font-size: 0.88rem;
}

.install-card .form-control,
.install-card .form-select,
.install-card .sg-input-group-text {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: #fff;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    transition: border-color 0.15s;
}
.install-card .sg-input-group-text {
    color: var(--text-muted);
}

.install-card .form-control:focus,
.install-card .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(213, 21, 34, 0.15);
    background: var(--input-bg);
    color: #fff;
}

.install-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.install-card .form-select option {
    background: #1a1a1a;
    color: #fff;
}

.install-card .sg-input-group .btn {
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-muted);
    font-size: 0.82rem;
}

.install-card .sg-input-group .btn:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}

/* ---------- STEP TITLE (non-welcome) ---------- */

.step-header {
    margin-bottom: 1.5rem;
}

.step-header .step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(213, 21, 34, 0.15);
    margin-right: 0.5rem;
    vertical-align: middle;
}

.step-header .step-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.8;
}

.step-header h2 {
    display: inline;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    vertical-align: middle;
}

.step-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0.35rem 0 0;
}

/* ---------- SELECTABLE CARDS (mode) ---------- */

.selectable-card {
    cursor: pointer;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    background: rgba(30, 30, 30, 0.6);
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.selectable-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.selectable-card.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(213, 21, 34, 0.18);
}

.selectable-card .card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    margin-bottom: 0.85rem;
}

.selectable-card .card-icon svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
    stroke-width: 1.5;
    fill: none;
}

.selectable-card h6 {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    margin: 0 0 0.3rem;
}

.selectable-card small {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

/* ---------- TEMPLATE GRID ---------- */

.template-card {
    cursor: pointer;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background: rgba(30, 30, 30, 0.6);
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.template-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.template-card.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(213, 21, 34, 0.18);
}

.template-card h6 {
    color: #fff;
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.template-card small {
    color: var(--text-muted);
}

#template-filter {
    max-width: 220px;
    margin-bottom: 1rem;
}

/* ---------- PREVIEW LIST ---------- */


#install-preview .list-group {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
    border-radius: 0.75rem;
    border: 1px solid var(--card-border);
    overflow: hidden;
}

#install-preview .list-group-item {
    position: relative;
    display: block;
    background: rgba(30, 30, 30, 0.6);
    color: #fff;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--card-border);
}
#install-preview .list-group-item:last-child {
    border-bottom: none;
}

#install-preview .list-group-item b {
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 0.35rem;
}

#install-preview .preview-password-row .preview-password-mask {
    user-select: none;
}

#install-preview .preview-password-row .preview-password-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.5rem;
    vertical-align: middle;
}

#install-preview .btn-preview-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

#install-preview .btn-preview-icon:hover {
    color: var(--accent);
    background: rgba(213, 21, 34, 0.12);
}

#install-preview .btn-preview-icon svg {
    width: 16px;
    height: 16px;
}

#install-preview .btn-preview-icon.preview-copy-done {
    color: var(--accent);
}

/* ---------- BUTTONS ---------- */

.btn-action {
    background: linear-gradient(120deg, var(--accent), var(--accent-strong));
    border: none;
    border-radius: 10px;
    padding: 0.7rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
    letter-spacing: 0.03em;
    box-shadow: 0 8px 24px rgba(213, 21, 34, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: filter 0.15s;
    cursor: pointer;
}

.btn-action:hover {
    filter: brightness(1.08);
    color: #fff;
}

.btn-action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
    filter: none;
}

.btn-action.is-danger {
    box-shadow: 0 10px 28px rgba(213, 21, 34, 0.42);
}

.btn-back-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    padding: 0.7rem 0.25rem;
    transition: color 0.15s;
}

.btn-back-link:hover {
    color: #fff;
}

/* .btn-install {
    background: linear-gradient(120deg, #22c55e, #16a34a);
    border: none;
    border-radius: 10px;
    padding: 0.7rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: filter 0.15s;
}

.btn-install:hover {
    filter: brightness(1.08);
    color: #fff;
} */

.step-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
}

/* ---------- RESET WIZARD ---------- */

.sg-reset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.sg-reset-card {
    display: flex;
    flex-direction: column;
}

.sg-reset-card.is-danger {
    border-color: rgba(213, 21, 34, 0.28);
    box-shadow: 0 0 0 3px rgba(213, 21, 34, 0.12);
}

.sg-reset-card-head {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 0.75rem;
}

.sg-reset-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
}

.sg-reset-card-icon svg {
    width: 18px;
    height: 18px;
    stroke: #fff;
    stroke-width: 1.5;
    fill: none;
}

.sg-reset-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 1.1rem;
    display: grid;
    gap: 0.45rem;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.sg-reset-list li {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.sg-reset-list li svg {
    width: 16px;
    height: 16px;
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 1.7;
    fill: none;
    opacity: 0.55;
    flex: 0 0 auto;
}

.sg-reset-card .btn-action {
    margin-top: auto;
    width: 100%;
    justify-content: center;
}

@media (max-width: 768px) {
    .sg-reset-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- MODAL (RESET WIZARD) ---------- */

.sg-modal {
    display: none;
    position: fixed;
    inset: 0;
    padding: 1rem;
    z-index: 1055;
    align-items: center;
    justify-content: center;
    background: rgba(14, 14, 14, 0.88);
    backdrop-filter: blur(6px);
}

.sg-modal.show {
    display: flex;
}

.sg-modal-card {
    width: 100%;
    max-width: 560px;
}

.sg-modal-loading {
    display: none;
    text-align: center;
}

.sg-modal .spinner-border {
    color: var(--accent);
}

.sg-reset-result {
    text-align: center;
}

.sg-reset-result-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(213, 21, 34, 0.15);
    border: 1px solid rgba(213, 21, 34, 0.25);
    margin-bottom: 1rem;
}

.sg-reset-result-icon svg {
    width: 34px;
    height: 34px;
    stroke: #fff;
    stroke-width: 1.5;
    fill: none;
}

/* ---------- ALERTS ---------- */

.wizard-error,
.alert-danger {
    border-radius: 10px;
    border: 1px solid rgba(248, 113, 113, 0.3);
    background: rgba(36, 9, 15, 0.65);
    color: #f87171;
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    margin-bottom: 1rem;
}

.invalid-feedback {
    color: #f87171;
    font-size: 0.82rem;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #f87171;
}

/* ---------- INSTALLING OVERLAY & DB CHECK OVERLAY ---------- */

#installing-overlay,
#db-check-overlay {
    position: fixed;
    inset: 0;
    background: rgba(14, 14, 14, 0.92);
    backdrop-filter: blur(6px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
}

#installing-overlay .installing-box,
#db-check-overlay .installing-box {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--card-border);
    padding: 2.5rem 3rem;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.55);
    text-align: center;
}

#installing-overlay .installing-box h5,
#db-check-overlay .installing-box h5 {
    color: #fff;
    margin-bottom: 0.5rem;
}

#installing-overlay .installing-box p,
#db-check-overlay .installing-box p {
    color: var(--text-muted);
    margin: 0;
}

#installing-overlay .spinner-border,
#db-check-overlay .spinner-border {
    color: var(--accent) !important;
    width: 2.5rem;
    height: 2.5rem;
}

/* ---------- FOOTER ---------- */

.install-footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.install-footer a {
    color: #fff;
    text-decoration: none;
}

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

/* ---------- RESPONSIVE ---------- */

@media (max-width: 767.98px) {
    .sgen-topbar {
        padding: 0.75rem 1rem;
    }

    .wizard-stepper {
        display: none;
    }

    .install-card {
        padding: 2rem 1.25rem;
    }

    .selectable-card {
        padding: 1.25rem;
    }
}