/* ========================================
   Onboarding Wizard v2 — 4-Step Experience
   ======================================== */

/* Overlay */
.cx-onboard-overlay {
    position: fixed;
    inset: 0;
    z-index: 100001;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: cxObFadeIn 0.4s ease forwards;
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
}
@keyframes cxObFadeIn {
    to { opacity: 1; }
}

/* Modal */
.cx-onboard-modal {
    background: rgba(15,23,42,0.98);
    border: 1px solid rgba(99,102,241,0.25);
    border-radius: 24px;
    width: 90%;
    max-width: 540px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    position: relative;
}

/* Header */
.cx-onboard-header {
    text-align: center;
    padding: 32px 24px 16px;
}
.cx-onboard-header .cx-ob-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: inline-block;
    animation: cxObBounce 0.6s ease;
}
@keyframes cxObBounce {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}
.cx-onboard-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 6px;
}
.cx-onboard-header p {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    margin: 0;
    line-height: 1.5;
}

/* Progress bar (new) */
.cx-ob-progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    margin: 0 28px 8px;
    overflow: hidden;
}
.cx-ob-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #06b6d4);
    border-radius: 2px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Steps indicator */
.cx-ob-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 24px 20px;
}
.cx-ob-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    transition: all 0.3s;
    position: relative;
}
.cx-ob-step-dot.active {
    background: #6366f1;
    width: 28px;
    border-radius: 5px;
}
.cx-ob-step-dot.done {
    background: #10b981;
}

/* Step content */
.cx-ob-step-content {
    padding: 0 28px;
}

/* Step counter (new) */
.cx-ob-step-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(99,102,241,0.15);
    color: var(--primary-light, #818cf8);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    margin-left: 10px;
    white-space: nowrap;
}

.cx-ob-question {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.cx-ob-question i {
    color: var(--primary-light, #818cf8);
}

/* Options */
.cx-ob-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cx-ob-option {
    padding: 14px 18px;
    border-radius: 14px;
    border: 2px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: right;
    position: relative;
}
.cx-ob-option:hover {
    border-color: rgba(99,102,241,0.4);
    background: rgba(99,102,241,0.08);
    transform: translateX(-2px);
}
.cx-ob-option.selected {
    border-color: #6366f1;
    background: rgba(99,102,241,0.15);
    color: #fff;
}
.cx-ob-option .cx-ob-opt-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: rgba(255,255,255,0.06);
    flex-shrink: 0;
    transition: all 0.25s;
}
.cx-ob-option.selected .cx-ob-opt-icon {
    background: rgba(99,102,241,0.3);
    transform: scale(1.05);
}
.cx-ob-option .cx-ob-opt-text {
    flex: 1;
}
.cx-ob-option .cx-ob-opt-text strong {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
}
.cx-ob-option .cx-ob-opt-text small {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.45);
}
.cx-ob-option.selected .cx-ob-opt-text small {
    color: rgba(255,255,255,0.6);
}

/* Check mark on selected (new) */
.cx-ob-opt-check {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s;
    color: #10b981;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.cx-ob-option.selected .cx-ob-opt-check {
    opacity: 1;
    transform: scale(1);
}

/* Navigation buttons */
.cx-ob-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 28px;
    gap: 12px;
}
.cx-ob-nav-right {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
}
.cx-ob-btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cx-ob-btn-primary {
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    color: #fff;
}
.cx-ob-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99,102,241,0.4);
}
.cx-ob-btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.cx-ob-btn-secondary {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}
.cx-ob-btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.cx-ob-btn-back {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.6);
    padding: 12px 16px;
}
.cx-ob-btn-back:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.cx-ob-btn-skip {
    background: transparent;
    color: rgba(255,255,255,0.4);
    padding: 12px 16px;
}
.cx-ob-btn-skip:hover {
    color: rgba(255,255,255,0.7);
}

/* Result screen */
.cx-ob-result {
    padding: 28px;
    text-align: center;
}
.cx-ob-result-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    display: inline-block;
    animation: cxObBounce 0.6s ease;
}
.cx-ob-result h3 {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 8px;
}
.cx-ob-result p {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.6);
    line-height: 1.5;
    margin: 0 0 20px;
}
.cx-ob-result-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}
.cx-ob-result-card {
    background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(6,182,212,0.08));
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 14px;
    padding: 14px;
    text-align: right;
}
.cx-ob-result-card .label {
    font-size: 0.72rem;
    color: var(--primary-light, #818cf8);
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.cx-ob-result-card .label i { font-size: 0.7rem; }
.cx-ob-result-card .value {
    font-size: 0.88rem;
    color: #fff;
    font-weight: 700;
    line-height: 1.4;
}

/* Summary note (new) */
.cx-ob-result-summary {
    background: rgba(99,102,241,0.08);
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: right;
}
.cx-ob-result-summary i {
    color: var(--primary-light, #818cf8);
    flex-shrink: 0;
}
.cx-ob-result-summary strong {
    color: var(--primary-light, #818cf8);
}

/* Result nav */
.cx-ob-nav-result {
    flex-direction: column;
    gap: 10px;
    padding: 0 28px 28px;
}
.cx-ob-nav-result .cx-ob-btn {
    width: 100%;
    justify-content: center;
    text-decoration: none;
}
.cx-ob-btn-start {
    padding: 14px 24px;
    font-size: 1rem;
}

/* --- Light Theme --- */
body.light-theme .cx-onboard-modal {
    background: rgba(248,250,252,0.98);
    border-color: rgba(99,102,241,0.15);
}
body.light-theme .cx-onboard-header h2 { color: #1e293b; }
body.light-theme .cx-onboard-header p { color: #64748b; }
body.light-theme .cx-ob-progress-bar { background: rgba(0,0,0,0.06); }
body.light-theme .cx-ob-question { color: #1e293b; }
body.light-theme .cx-ob-step-counter { background: rgba(99,102,241,0.08); }
body.light-theme .cx-ob-option {
    border-color: rgba(0,0,0,0.08);
    background: rgba(0,0,0,0.02);
    color: #334155;
}
body.light-theme .cx-ob-option:hover {
    border-color: rgba(99,102,241,0.3);
    background: rgba(99,102,241,0.05);
}
body.light-theme .cx-ob-option.selected {
    border-color: #6366f1;
    background: rgba(99,102,241,0.08);
    color: #1e293b;
}
body.light-theme .cx-ob-option .cx-ob-opt-text small { color: #94a3b8; }
body.light-theme .cx-ob-btn-skip { color: #94a3b8; }
body.light-theme .cx-ob-btn-back { background: rgba(0,0,0,0.04); color: #64748b; }
body.light-theme .cx-ob-btn-secondary { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); color: #475569; }
body.light-theme .cx-ob-result h3 { color: #1e293b; }
body.light-theme .cx-ob-result p { color: #64748b; }
body.light-theme .cx-ob-result-card { background: rgba(99,102,241,0.05); border-color: rgba(99,102,241,0.12); }
body.light-theme .cx-ob-result-card .value { color: #1e293b; }
body.light-theme .cx-ob-result-summary { background: rgba(99,102,241,0.04); border-color: rgba(99,102,241,0.1); color: #64748b; }

/* --- Responsive --- */
@media (max-width: 600px) {
    .cx-onboard-modal {
        width: 95%;
        border-radius: 18px;
    }
    .cx-onboard-header { padding: 24px 18px 12px; }
    .cx-onboard-header h2 { font-size: 1.2rem; }
    .cx-ob-step-content { padding: 0 18px; }
    .cx-ob-option { padding: 12px 14px; }
    .cx-ob-nav { padding: 20px 18px 24px; }
    .cx-ob-result { padding: 20px 18px; }
    .cx-ob-result-cards { grid-template-columns: 1fr; }
    .cx-ob-nav-result { padding: 0 18px 24px; }
    .cx-ob-progress-bar { margin: 0 18px 8px; }
}

/* --- Print: hide --- */
@media print {
    .cx-onboard-overlay { display: none !important; }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .cx-onboard-overlay { animation-duration: 0.01ms !important; }
    .cx-ob-icon, .cx-ob-result-icon { animation: none !important; }
}
