/* ========================================
   PROFILE PAGES - User Profile, Settings
   ======================================== */

:root {
    --profile-ink: #19324a;
    --profile-ink-soft: #4b647b;
    --profile-surface: #ffffff;
    --profile-line: rgba(46, 64, 87, 0.14);
    --profile-accent: #5b79a6;
    --profile-accent-mid: #4d6f98;
    --profile-accent-light: #6f90bc;
    --profile-highlight: #d6e4f3;
    --profile-missing-bg: #fff6df;
    --profile-missing-line: #f0c86f;
    --profile-complete-bg: #edf7f0;
    --profile-complete-line: #87c79a;
}

body {
    background:
        radial-gradient(circle at top left, rgba(214, 228, 243, 0.82), transparent 34%),
        radial-gradient(circle at bottom right, rgba(161, 187, 218, 0.34), transparent 30%),
        linear-gradient(140deg, #edf2f7 0%, #e7eef6 48%, #d8e4f1 100%);
    font-family: 'Segoe UI', sans-serif;
    min-height: 100vh;
    padding: 28px 18px;
    position: relative;
    overflow-x: hidden;
}

.profile-shell {
    align-items: center;
    justify-content: center;
}

.profile-card,
.card {
    background: var(--profile-surface);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 22px 55px rgba(16, 29, 45, 0.12);
}

.profile-card {
    padding: clamp(20px, 3.4vw, 34px);
}

.profile-main-card {
    width: min(100%, 820px);
    max-height: calc(100vh - 100px);
    overflow: hidden;
    position: relative;
}

.profile-main-scroll {
    max-height: calc(100vh - 100px - (2 * clamp(20px, 3.4vw, 34px)));
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    scrollbar-gutter: stable;
}

.profile-main-scroll::-webkit-scrollbar {
    width: 10px;
}

.profile-main-scroll::-webkit-scrollbar-track {
    background: #f5f7fa;
    border-radius: 10px;
}

.profile-main-scroll::-webkit-scrollbar-thumb {
    background: var(--profile-accent);
    border-radius: 10px;
    border: 2px solid #f5f7fa;
}

.profile-main-scroll::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--profile-accent-mid) 0%, var(--profile-accent) 100%);
}

.profile-actions {
    background: #ffffff;
    padding: 16px 0;
    border-top: 1px solid rgba(46, 64, 87, 0.1);
}

.profile-side-card {
    width: min(100%, 370px);
}

.card {
    width: min(100%, 460px);
    padding: 30px;
    margin-inline: auto;
}

.card h2 {
    text-align: center;
    color: var(--profile-accent);
    margin-bottom: 24px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: #2e4057;
    color: white;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 16px;
    text-decoration: none;
    font-size: 12px;
    letter-spacing: 0.04em;
    transition: background 0.2s ease, transform 0.2s ease;
}

.back-btn:hover {
    background: #243447;
    transform: translateY(-1px);
}

.settings-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 16px;
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    background: #2e4057;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    text-decoration: none;
}

.settings-action-btn:hover,
.settings-action-btn:focus-visible {
    background: #243447;
    transform: translateY(-1px);
}

.settings-action-btn:focus-visible {
    outline: 3px solid rgba(91, 121, 166, 0.35);
    outline-offset: 2px;
}

.settings-action-btn--danger {
    background: linear-gradient(135deg, #d23939 0%, #b71f1f 100%);
}

.settings-action-btn--danger:hover,
.settings-action-btn--danger:focus-visible {
    background: linear-gradient(135deg, #b71f1f 0%, #8f1b1b 100%);
}

.completion-panel {
    position: relative;
    overflow: hidden;
}

.completion-panel::after {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 999px;
    right: -65px;
    top: -90px;
    background: rgba(91, 121, 166, 0.14);
    pointer-events: none;
}

.status-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 14px;
    padding: 8px 10px;
    border: 1px solid transparent;
}

.status-chip strong {
    display: block;
    font-size: 11px;
    color: var(--profile-ink);
}

.status-chip small {
    display: block;
    font-size: 10px;
    color: var(--profile-ink-soft);
}

.status-chip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    flex-shrink: 0;
}

.status-chip-icon svg {
    width: 12px;
    height: 12px;
}

.status-chip.is-complete {
    background: var(--profile-complete-bg);
    border-color: rgba(135, 199, 154, 0.45);
}

.status-chip.is-complete .status-chip-icon {
    color: #2e7a45;
    background: rgba(135, 199, 154, 0.3);
}

.status-chip.is-missing {
    background: var(--profile-missing-bg);
    border-color: rgba(240, 200, 111, 0.54);
}

.status-chip.is-missing .status-chip-icon {
    color: #aa6a00;
    background: rgba(240, 200, 111, 0.34);
}

.profile-section {
    border: 1px solid var(--profile-line);
    border-radius: 18px;
    padding: 14px;
    background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%);
}

.profile-section-head {
    margin-bottom: 12px;
}

.profile-section-head h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--profile-ink);
    margin: 0;
}

.profile-section-head p {
    font-size: 11px;
    color: var(--profile-ink-soft);
    margin: 4px 0 0;
}

.profile-field {
    border: 1px solid var(--profile-line);
    border-radius: 14px;
    padding: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.profile-field.is-complete {
    border-color: var(--profile-complete-line);
    background: linear-gradient(180deg, #ffffff 0%, #f6fbf8 100%);
}

.profile-field.is-missing {
    border-color: var(--profile-missing-line);
    background: linear-gradient(180deg, #fffdf5 0%, #fff8e6 100%);
}

.profile-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--profile-ink);
    font-weight: 600;
}

.field-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    font-size: 10px;
    padding: 3px 8px;
    background: #f4f6f8;
    color: #4f667d;
}

.profile-field.is-complete .field-state {
    background: rgba(135, 199, 154, 0.28);
    color: #1f6f3a;
}

.profile-field.is-missing .field-state {
    background: rgba(240, 200, 111, 0.3);
    color: #855000;
}

.state-icon {
    display: inline-flex;
    width: 14px;
    height: 14px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-weight: 700;
}

.profile-input {
    width: 100%;
    border: 1px solid #d4dde8;
    border-radius: 12px;
    background: #ffffff;
    font-size: 14px;
    color: #223a53;
    padding: 10px 11px;
    outline: none;
}

.profile-input:focus {
    border-color: #5b79a6;
    box-shadow: 0 0 0 3px rgba(91, 121, 166, 0.16);
}

.profile-select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #647b92 50%), linear-gradient(135deg, #647b92 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

.field-note {
    margin: 7px 0 0;
    font-size: 10px;
    color: #687d92;
    line-height: 1.45;
}

.card input,
.card select {
    width: 100%;
    padding: 11px;
    margin-bottom: 12px;
    border-radius: 12px;
    border: 1px solid #ccd5e0;
}

.card button {
    width: 100%;
    padding: 11px;
    border-radius: 12px;
    border: none;
    background: #5576a8;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.card button:hover {
    background: #445f8a;
}

.preference-item {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 12px;
}

.preference-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    cursor: pointer;
}

.preference-item input[type="checkbox"],
.preference-item input[type="radio"] {
    width: auto;
    margin: 0;
}

@media (max-width: 900px) {
    body {
        padding: 18px 12px;
    }

    .profile-main-card,
    .profile-side-card {
        width: 100%;
    }

    .profile-main-card {
        max-height: none;
    }

    .profile-main-scroll {
        max-height: none;
        padding-right: 0;
    }
}

@media (max-width: 640px) {
    body {
        padding: 12px 10px;
    }

    .profile-card,
    .card {
        border-radius: 20px;
        padding: clamp(16px, 4vw, 24px);
    }

    .card h2 {
        font-size: 1.2rem;
    }

    .profile-section {
        padding: 12px;
    }

    .settings-card {
        padding: 20px 14px !important;
        border-radius: 18px !important;
    }

    .onboard-shell {
        padding: 16px !important;
    }

    .onboard-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Progress bar fill — width driven by CSS custom property set from PHP/JS */
.profile-progress-fill {
    width: var(--progress, 0%);
}
