﻿/* ═══════════════════════════════════════════════════════════════
   سیناپس Patient Portal — Onboarding & Profile Wizard
   Register + CompleteProfile shared design system
   ═══════════════════════════════════════════════════════════════ */

:root {
    --po-primary: #0ea5e9;
    --po-primary-dark: #0284c7;
    --po-primary-light: #38bdf8;
    --po-accent: #0c4a6e;
    --po-accent-soft: #e0f2fe;
    --po-success: #10b981;
    --po-surface: #ffffff;
    --po-surface-2: #f8fafc;
    --po-text: #0c4a6e;
    --po-text-muted: #475569;
    --po-border: #bae6fd;
    --po-radius: 20px;
    --po-radius-md: 14px;
    --po-radius-sm: 10px;
    --po-shadow: 0 8px 40px rgba(14, 165, 233, 0.08);
    --po-shadow-lg: 0 20px 60px rgba(14, 165, 233, 0.15);
    --po-gradient: linear-gradient(145deg, #0ea5e9 0%, #0284c7 55%, #0c4a6e 100%);
    --po-gradient-soft: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 50%, #f8fafc 100%);
    --po-font: var(--app-font-family, 'Vazirmatn', Tahoma, sans-serif);
}

/* ── Page shell ── */
.portal-onboard-body {
    min-height: 100dvh;
    margin: 0;
    font-family: var(--po-font);
    background: var(--po-gradient-soft);
    color: var(--po-text);
    position: relative;
    overflow-x: hidden;
}

.portal-onboard-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(13, 148, 136, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 60% 40% at 90% 10%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 50% 30% at 50% 100%, rgba(99, 102, 241, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.portal-onboard-page {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.portal-onboard-page.portal-onboard-page--wide {
    max-width: 720px;
}

/* ── Top brand bar ── */
.po-brand-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 0 1.25rem;
}

.po-brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--po-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.35);
}

.po-brand-name {
    font-size: 1.15rem;
    font-weight: 800;
    background: var(--po-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

/* ── Main card ── */
.po-card {
    background: var(--po-surface);
    border-radius: var(--po-radius);
    box-shadow: var(--po-shadow);
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.po-card-header {
    background: var(--po-gradient);
    color: #fff;
    padding: 1.5rem 1.35rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.po-card-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 80%, rgba(255,255,255,0.12) 0%, transparent 45%),
        radial-gradient(circle at 85% 20%, rgba(255,255,255,0.08) 0%, transparent 40%);
    pointer-events: none;
}

.po-card-header-inner {
    position: relative;
    z-index: 1;
}

.po-card-header .po-header-icon {
    font-size: 2.25rem;
    display: block;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

.po-card-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
    line-height: 1.4;
}

.po-card-header p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.92;
    line-height: 1.55;
}

.po-card-body {
    padding: 1.35rem 1.25rem 1.5rem;
    flex: 1;
}

/* ── Welcome tip ── */
.po-welcome-tip {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    background: linear-gradient(135deg, #ecfdf5, #f0f9ff);
    border: 1px solid #99f6e4;
    border-radius: var(--po-radius-sm);
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    line-height: 1.65;
    color: #0284c7;
}

.po-welcome-tip-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    line-height: 1;
}

/* ── Stepper ── */
.po-stepper {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0;
    margin-bottom: 1.35rem;
    padding: 0 0.25rem;
}

.po-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    position: relative;
    min-width: 0;
}

.po-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 17px;
    left: -50%;
    width: 100%;
    height: 3px;
    background: #e2e8f0;
    z-index: 0;
    border-radius: 2px;
}

.po-step.done:not(:last-child)::after {
    background: linear-gradient(90deg, var(--po-success), #6ee7b7);
}

.po-step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #94a3b8;
    border: 2px solid #e2e8f0;
    position: relative;
    z-index: 1;
    transition: all 0.25s ease;
}

.po-step.active .po-step-circle {
    background: var(--po-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.4);
    transform: scale(1.08);
}

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

.po-step-label {
    font-size: 0.72rem;
    color: var(--po-text-muted);
    text-align: center;
    line-height: 1.3;
    max-width: 72px;
}

.po-step.active .po-step-label {
    color: var(--po-primary-dark);
    font-weight: 700;
}

.po-step.done .po-step-label {
    color: var(--po-success);
}

/* ── Form elements ── */
.po-form-section-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--po-primary-dark);
    margin: 0 0 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ccfbf1;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.po-form-section-title + .po-form-section-title,
.po-form-section-title:not(:first-child) {
    margin-top: 1.25rem;
}

.po-field {
    margin-bottom: 1rem;
}

.po-field-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--po-text-muted);
    margin-bottom: 0.35rem;
}

.portal-onboard-body .form-control,
.portal-onboard-body .form-select {
    border: 1.5px solid var(--po-border);
    border-radius: var(--po-radius-sm);
    padding: 0.72rem 0.9rem;
    font-size: 0.95rem;
    color: var(--po-text);
    background: var(--po-surface);
    min-height: 48px;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.portal-onboard-body .form-control:focus,
.portal-onboard-body .form-select:focus {
    border-color: var(--po-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
    outline: none;
}

.portal-onboard-body .form-control::placeholder {
    color: #94a3b8;
}

.portal-onboard-body .form-select {
    cursor: pointer;
    padding-left: 2rem;
}

.portal-onboard-body .text-danger.small {
    font-size: 0.78rem;
    margin-top: 0.3rem;
    display: block;
}

/* Register — highlight key fields */
.po-field--key .form-control {
    background: linear-gradient(135deg, #f0fdfa, #fff);
    border-color: #99f6e4;
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* Vitals row */
.po-vitals-box {
    background: linear-gradient(135deg, #f0fdfa, #f0f9ff);
    border: 1px solid #99f6e4;
    border-radius: var(--po-radius-md);
    padding: 1rem 0.85rem 0.25rem;
    margin-bottom: 1rem;
}

.po-vitals-box #bmiDisplay {
    background: #fff;
    border-color: #5eead4;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--po-primary-dark);
    text-align: center;
}

/* Checkbox chips */
.po-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
}

.po-checkbox-grid .form-check {
    background: var(--po-surface-2);
    border: 1.5px solid var(--po-border);
    border-radius: var(--po-radius-sm);
    padding: 0.65rem 0.75rem;
    margin: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.po-checkbox-grid .form-check:active {
    transform: scale(0.98);
}

.po-checkbox-grid .form-check:hover {
    border-color: #99f6e4;
    background: #f0fdfa;
}

.po-checkbox-grid .form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0 !important;
    float: none !important;
    flex-shrink: 0;
    position: static !important;
    border: 2px solid #cbd5e1;
    cursor: pointer;
}

.po-checkbox-grid .form-check-input:checked {
    background-color: var(--po-primary);
    border-color: var(--po-primary);
}

.po-checkbox-grid .form-check:has(.form-check-input:checked) {
    background: linear-gradient(135deg, #ecfdf5, #f0fdfa);
    border-color: var(--po-primary-light);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.12);
}

.po-checkbox-grid .form-check-label {
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    line-height: 1.35;
    flex: 1;
    min-width: 0;
    padding: 0;
}

/* Radio group */
.po-radio-row {
    display: flex;
    gap: 0.65rem;
}

.po-radio-row .form-check {
    flex: 1;
    background: var(--po-surface-2);
    border: 1.5px solid var(--po-border);
    border-radius: var(--po-radius-sm);
    padding: 0.7rem 0.85rem;
    margin: 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.po-radio-row .form-check-input {
    float: none !important;
    margin: 0 !important;
    flex-shrink: 0;
    position: static !important;
}

.po-radio-row .form-check-label {
    flex: 1;
    min-width: 0;
    padding: 0;
}

.po-radio-row .form-check:has(.form-check-input:checked) {
    background: #ecfdf5;
    border-color: var(--po-primary-light);
}

.portal-onboard-body .form-check-input {
    border: 2px solid #cbd5e1;
    cursor: pointer;
    width: 1.15rem;
    height: 1.15rem;
}

.portal-onboard-body .form-check-input:checked {
    background-color: var(--po-primary);
    border-color: var(--po-primary);
}

.portal-onboard-body .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

/* Consent cards */
.po-consent-card {
    background: var(--po-surface-2);
    border: 1.5px solid var(--po-border);
    border-radius: var(--po-radius-sm);
    padding: 0.9rem 1rem 0.9rem 2.6rem;
    margin-bottom: 0.65rem;
    transition: border-color 0.2s;
}

.po-consent-card:has(.form-check-input:checked) {
    border-color: #99f6e4;
    background: #f0fdfa;
}

.po-consent-card .form-check-label {
    font-size: 0.85rem;
    line-height: 1.6;
    cursor: pointer;
}

/* Alerts */
.portal-onboard-body .alert {
    border: none;
    border-radius: var(--po-radius-sm);
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.portal-onboard-body .alert-danger {
    background: #fef2f2;
    color: #b91c1c;
}

/* ── Buttons ── */
.po-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem 1.25rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: var(--po-gradient);
    border: none;
    border-radius: var(--po-radius-sm);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.35);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    min-height: 52px;
    text-decoration: none;
}

.po-btn-primary:hover,
.po-btn-primary:focus {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(13, 148, 136, 0.45);
}

.po-btn-primary:active {
    transform: translateY(0);
}

.po-btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1.15rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--po-text-muted);
    background: var(--po-surface);
    border: 1.5px solid var(--po-border);
    border-radius: var(--po-radius-sm);
    min-height: 52px;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.po-btn-secondary:hover {
    background: var(--po-surface-2);
    color: var(--po-text);
    border-color: #cbd5e1;
}

.po-skip-later {
    margin-top: 0.85rem;
    text-align: center;
}

.po-btn-later {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--po-text-muted);
    background: transparent;
    border: none;
    border-radius: var(--po-radius-sm);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s;
}

.po-btn-later:hover {
    color: var(--po-primary, #0284c7);
}

.po-actions {
    display: flex;
    gap: 0.65rem;
    margin-top: 1.25rem;
}

.po-actions .po-btn-primary {
    flex: 1;
}

/* Sticky footer on mobile */
.po-actions--sticky {
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, transparent, #fff 20%);
    padding: 1rem 0 0.25rem;
    margin-top: 1.5rem;
    z-index: 10;
}

/* Footer link */
.po-footer-link {
    text-align: center;
    padding: 1.25rem 0 0.5rem;
}

.po-footer-link a {
    color: var(--po-primary-dark);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    transition: background 0.15s;
}

.po-footer-link a:hover {
    background: rgba(13, 148, 136, 0.1);
    color: var(--po-primary-dark);
}

/* ── Success screen ── */
.po-success {
    text-align: center;
    padding: 1.5rem 0.5rem 1rem;
}

.po-success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
    animation: poSuccessPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes poSuccessPop {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.po-success h2 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--po-success);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.po-success p {
    font-size: 0.88rem;
    line-height: 1.85;
    color: var(--po-text-muted);
    margin-bottom: 0.85rem;
    text-align: justify;
}

.po-success-footer {
    font-weight: 700;
    color: var(--po-primary-dark);
    margin-top: 1.25rem !important;
}

.po-success .po-btn-primary {
    max-width: 280px;
    margin: 1.5rem auto 0;
}

/* ── Progress pill (register page) ── */
.po-progress-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.65rem;
}

/* ── Tablet+ ── */
@media (min-width: 576px) {
    .portal-onboard-page {
        padding: 2rem 1.5rem;
    }

    .po-card-header {
        padding: 1.75rem 1.5rem;
    }

    .po-card-header h1 {
        font-size: 1.4rem;
    }

    .po-card-body {
        padding: 1.5rem 1.75rem 1.75rem;
    }

    .po-checkbox-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .po-step-label {
        font-size: 0.78rem;
        max-width: 90px;
    }

    .po-step-circle {
        width: 40px;
        height: 40px;
    }

    .po-step:not(:last-child)::after {
        top: 19px;
    }
}

@media (min-width: 768px) {
    .po-checkbox-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .portal-onboard-body .row.g-3 > [class*="col-md"] {
        margin-bottom: 0;
    }
}

/* ── Mobile optimizations ── */
@media (max-width: 575px) {
    .portal-onboard-page {
        padding: 0.75rem 0.85rem 1.5rem;
    }

    .po-card {
        border-radius: var(--po-radius-md);
    }

    .po-card-header {
        padding: 1.25rem 1rem;
    }

    .po-card-body {
        padding: 1.15rem 1rem 1.25rem;
    }

    .po-step-label {
        font-size: 0.65rem;
    }

    .po-actions {
        flex-direction: column-reverse;
    }

    .po-actions .po-btn-secondary {
        width: 100%;
    }

    .po-success p {
        text-align: right;
    }
}

@media (prefers-reduced-motion: reduce) {
    .po-success-icon,
    .po-step-circle,
    .po-btn-primary,
    .po-checkbox-grid .form-check {
        animation: none;
        transition: none;
    }
}
