/* ============================================================
   GSM One — Installation Wizard Stylesheet
   Sidebar stepper + main content (inspired by FleetCart/GSMOnePay)
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
    --color-primary: #4f46e5;
    --color-primary-light: #6366f1;
    --color-primary-dark: #4338ca;
    --color-success: #10b981;
    --color-success-bg: #ecfdf5;
    --color-danger: #ef4444;
    --color-danger-bg: #fef2f2;
    --color-warning: #f59e0b;
    --color-warning-bg: #fffbeb;
    --color-info: #3b82f6;
    --color-info-bg: #eff6ff;
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #ffffff;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
    --transition: 150ms cubic-bezier(.4,0,.2,1);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.install-body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: var(--color-gray-800);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Wrapper ---------- */
.install-wrapper {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

/* ---------- Main Box ---------- */
.installer-box {
    display: flex;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,.05);
    overflow: hidden;
    min-height: 580px;
}

/* ============================================================
   LEFT SIDEBAR
   ============================================================ */
.installer-sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1.75rem 1.25rem;
}

/* Logo */
.installer-sidebar .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--color-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-icon svg {
    width: 22px;
    height: 22px;
}

.logo-text {
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    line-height: 1.2;
}

.logo-text small {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--sidebar-text);
    margin-top: 2px;
}

/* Step List */
.step-list {
    list-style: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.5rem;
    border-radius: var(--radius);
    transition: background var(--transition);
    position: relative;
}

/* Connector line between steps */
.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: calc(0.5rem + 14px);
    top: calc(0.75rem + 28px + 4px);
    width: 2px;
    height: calc(100% - 28px - 0.75rem);
    background: rgba(255,255,255,.1);
}

.step-item.complete:not(:last-child)::after {
    background: var(--color-success);
}

.step-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sidebar-text);
    transition: all var(--transition);
    position: relative;
    z-index: 1;
    background: var(--sidebar-bg);
}

.step-icon svg {
    width: 14px;
    height: 14px;
    display: none;
}

/* Active step */
.step-item.active .step-icon {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .3);
}

.step-item.active .step-title {
    color: #fff;
    font-weight: 600;
}

/* Complete step */
.step-item.complete .step-icon {
    border-color: var(--color-success);
    background: var(--color-success);
}

.step-item.complete .step-icon svg {
    display: block;
}

.step-item.complete .step-title {
    color: rgba(255,255,255,.7);
}

/* Step number for non-complete steps */
.step-item:not(.complete) .step-icon::before {
    content: attr(data-step);
}

.step-list li:nth-child(1) .step-icon::before { content: '1'; }
.step-list li:nth-child(2) .step-icon::before { content: '2'; }
.step-list li:nth-child(3) .step-icon::before { content: '3'; }
.step-list li:nth-child(4) .step-icon::before { content: '4'; }
.step-list li:nth-child(5) .step-icon::before { content: '5'; }

.step-item.complete .step-icon::before { content: '' !important; }

.step-info {
    min-width: 0;
}

.step-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--sidebar-text);
    transition: color var(--transition);
}

.step-desc {
    font-size: 0.7rem;
    color: rgba(255,255,255,.35);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Version */
.app-version {
    font-size: 0.7rem;
    color: rgba(255,255,255,.25);
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,.06);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.installer-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 680px;
}

/* Header */
.content-header {
    padding: 1.5rem 2rem 0;
}

.content-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-gray-900);
    margin-bottom: 0.25rem;
}

.content-header .excerpt {
    font-size: 0.85rem;
    color: var(--color-gray-500);
    margin: 0;
}

/* Body */
.content-body {
    flex: 1;
    padding: 1.25rem 2rem;
    overflow-y: auto;
}

/* Footer */
.content-footer {
    padding: 1rem 2rem;
    border-top: 1px solid var(--color-gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-gray-50);
}

/* ============================================================
   SECTION BOXES (Requirements page)
   ============================================================ */
.section-box {
    margin-bottom: 1.25rem;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.section-title {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-gray-700);
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-gray-200);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title .badge {
    font-size: 0.65rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--color-info-bg);
    color: var(--color-info);
}

/* Check Table */
.check-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.check-table thead {
    display: none;
}

.check-table tr:not(:last-child) td {
    border-bottom: 1px solid var(--color-gray-100);
}

.check-table td {
    padding: 0.5rem 1rem;
}

.check-table td:last-child {
    width: 40px;
    text-align: center;
}

.check-table code {
    font-size: 0.78rem;
    background: var(--color-gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Status Icons */
.status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
}

.status-icon svg {
    width: 20px;
    height: 20px;
}

.status-ok svg { fill: var(--color-success); }
.status-fail svg { fill: var(--color-danger); }
.status-warn svg { fill: var(--color-warning); }

.status-unknown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-gray-400);
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.82rem;
    line-height: 1.5;
}

.alert-icon {
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1;
}

.alert-success {
    background: var(--color-success-bg);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: var(--color-danger-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: var(--color-warning-bg);
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: var(--color-info-bg);
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.alert-action {
    justify-content: space-between;
    align-items: center;
}

.alert-text {
    flex: 1;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.25rem;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    line-height: 1.4;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
    box-shadow: 0 2px 4px rgba(79,70,229,.3);
}

.btn-success {
    background: var(--color-success);
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
}

.btn-light {
    background: var(--color-gray-100);
    color: var(--color-gray-700);
    border: 1px solid var(--color-gray-200);
}

.btn-light:hover:not(:disabled) {
    background: var(--color-gray-200);
}

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.78rem;
}

.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-gray-700);
    margin-bottom: 0.35rem;
}

.form-label .required {
    color: var(--color-danger);
}

.form-control {
    width: 100%;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
    font-family: inherit;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius);
    background: #fff;
    color: var(--color-gray-900);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.form-control::placeholder {
    color: var(--color-gray-400);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z' fill='%236b7280'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* ============================================================
   SUMMARY ITEMS (Finalize page)
   ============================================================ */
.summary-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--color-gray-100);
}

.summary-item:last-of-type {
    border-bottom: none;
}

.summary-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.summary-icon svg {
    width: 16px;
    height: 16px;
}

.summary-icon.success {
    background: var(--color-success-bg);
}

.summary-icon.success svg {
    fill: var(--color-success);
}

.summary-icon.info {
    background: var(--color-info-bg);
}

.summary-icon.info svg {
    fill: var(--color-info);
}

.summary-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-gray-800);
}

.summary-desc {
    font-size: 0.75rem;
    color: var(--color-gray-500);
    margin-top: 1px;
}

/* ============================================================
   CODE BLOCK
   ============================================================ */
.code-block {
    background: var(--color-gray-900);
    color: #a5f3fc;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    line-height: 1.7;
    overflow-x: auto;
}

/* ============================================================
   COMPLETE VIEW (success animation)
   ============================================================ */
.complete-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.check-icon-wrapper {
    width: 80px;
    height: 80px;
    position: relative;
    margin: 0 auto 1.5rem;
}

.icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--color-success);
    position: absolute;
    top: 0; left: 0;
    animation: circleGrow 0.4s ease-out;
}

.icon-line {
    position: absolute;
    background: #fff;
    border-radius: 2px;
    z-index: 2;
}

.line-tip {
    width: 18px;
    height: 4px;
    top: 46px;
    left: 16px;
    transform: rotate(45deg);
    animation: tipDraw 0.2s ease-out 0.3s both;
}

.line-long {
    width: 34px;
    height: 4px;
    top: 40px;
    left: 26px;
    transform: rotate(-45deg);
    animation: longDraw 0.3s ease-out 0.45s both;
}

.icon-fix {
    display: none;
}

@keyframes circleGrow {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

@keyframes tipDraw {
    0% { width: 0; }
    100% { width: 18px; }
}

@keyframes longDraw {
    0% { width: 0; }
    100% { width: 34px; }
}

.complete-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-gray-900);
    margin-bottom: 0.35rem;
}

.complete-subtitle {
    font-size: 0.88rem;
    color: var(--color-gray-500);
    margin-bottom: 1.5rem;
}

.complete-links {
    list-style: none;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.complete-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    background: var(--color-gray-100);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius);
    color: var(--color-gray-700);
    text-decoration: none;
    font-size: 0.82rem;
    transition: all var(--transition);
}

.complete-link:hover {
    background: var(--color-gray-200);
    border-color: var(--color-gray-300);
}

.complete-link svg {
    width: 18px;
    height: 18px;
}

/* ============================================================
   MIGRATE PAGE — Progress Bar & Console
   ============================================================ */
.progress-wrapper {
    margin-bottom: 1rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-gray-600);
    margin-bottom: 0.4rem;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: var(--color-gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
    border-radius: 4px;
    transition: width 0.4s ease;
}

.console-log {
    background: var(--color-gray-900);
    color: #d1d5db;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.72rem;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.8;
    display: none;
}

.log-line {
    color: #a5f3fc;
}

.log-line.error {
    color: #fca5a5;
}

.migrate-output {
    background: var(--color-gray-900);
    color: #d1d5db;
    padding: 1rem;
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    max-height: 240px;
    overflow-y: auto;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ============================================================
   FORM HINTS
   ============================================================ */
.form-hint {
    font-size: 0.72rem;
    color: var(--color-gray-500);
    margin-top: 0.3rem;
}

/* ============================================================
   HELPERS
   ============================================================ */
.hidden { display: none !important; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }

hr {
    border: none;
    border-top: 1px solid var(--color-gray-200);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .installer-box {
        flex-direction: column;
    }

    .installer-sidebar {
        width: 100%;
        min-width: auto;
        padding: 1.25rem;
    }

    .step-list {
        flex-direction: row;
        gap: 0;
        justify-content: space-between;
    }

    .step-item {
        flex-direction: column;
        text-align: center;
        padding: 0.5rem 0.25rem;
        flex: 1;
    }

    .step-item:not(:last-child)::after {
        display: none;
    }

    .step-desc {
        display: none;
    }

    .step-title {
        font-size: 0.7rem;
    }

    .installer-content {
        max-height: none;
    }

    .content-body {
        padding: 1rem 1.25rem;
    }

    .content-footer {
        padding: 0.75rem 1.25rem;
    }
}

@media (max-width: 480px) {
    .installer-sidebar .logo {
        justify-content: center;
    }

    .step-info {
        display: none;
    }

    .step-item {
        justify-content: center;
    }

    .app-version {
        display: none;
    }
}
