/* ═══════════════════════════════════════════
   Profile Settings — Modern Redesign
   Uses site vars: --primary-color, Almarai
   ═══════════════════════════════════════════ */

/* ── Modal z-index fix (navbar is z-index:99999) ── */
.modal {
    z-index: 200000 !important;
}

.modal-backdrop {
    z-index: 199999 !important;
}

/* ── Global mobile overflow fix ── */
.content-section {
    overflow-x: hidden;
}

.content-section .container-xl {
    overflow-x: hidden;
}

/* ── Desktop Sidebar Nav (in-page) ── */
.pnav {
    display: none;
}

/* Layout wrapper: sidebar + content side by side */
.profile-layout {
    display: flex;
    flex-direction: row-reverse;
    gap: 20px;
    align-items: flex-start;
}

.profile-layout__content {
    flex: 1;
    min-width: 0;
}

.profile-layout__sidebar {
    width: 210px;
    flex-shrink: 0;
    position: sticky;
    top: 120px;
    align-self: flex-start;
}

.pnav--inline {
    background: #fff;
    border: 1px solid #eff0f2;
    border-radius: 14px;
    padding: 14px 10px;
}

.pnav__group {
    margin-bottom: 12px;
}

.pnav__group:last-child {
    margin-bottom: 0;
}

.pnav__group-title {
    font-size: 10px;
    font-weight: 800;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: .6px;
    padding: 0 10px;
    margin-bottom: 4px;
}

.pnav__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-decoration: none;
    transition: all .12s;
    white-space: nowrap;
}

.pnav__link:hover {
    background: #f5f5f5;
    color: var(--primary-color, #002937);
}

.pnav__link.is-active {
    background: rgba(0, 41, 55, .06);
    color: var(--primary-color, #002937);
    font-weight: 700;
}

.pnav__icon {
    width: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: .45;
}

.pnav__link.is-active .pnav__icon,
.pnav__link:hover .pnav__icon {
    opacity: 1;
}

.pnav__footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

/* ── Sub Tabs ── */
.ptabs-sub {
    margin-bottom: 20px;
    padding-top: 4px;
}

.ptabs-sub__nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 8px 0;
}

.ptabs-sub__link {
    display: inline-flex;
    align-items: center;
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 700;
    color: #666;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 100px;
    background: #f0f0f0;
    transition: all .15s;
}

.ptabs-sub__link:hover {
    background: #e4e4e4;
    color: #333;
}

.ptabs-sub__link.is-active {
    background: var(--primary-color, #002937);
    color: #fff;
}

/* ── Mobile sidebar toggle ── */
.psb-toggle-bar {
    display: none;
}

.psb-overlay {
    display: none;
}

.psb-drawer {
    display: none;
}

.psb-toggle {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #eff0f2;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    color: var(--primary-color, #002937);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
    transition: border-color .15s;
}

.psb-toggle:hover {
    border-color: var(--primary-color);
}

.psb-toggle__arrow {
    margin-right: auto;
    color: #aaa;
}

@media (min-width: 992px) {
    .profile-layout__sidebar {
        display: block;
    }
}

@media (max-width: 991px) {
    .profile-layout {
        display: block;
    }

    .profile-layout__sidebar {
        display: none;
    }

    .psb-toggle-bar {
        display: block;
    }

    .psb-drawer {
        display: block;
    }

    .ptabs-sub__nav {
        gap: 4px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .ptabs-sub__nav::-webkit-scrollbar {
        display: none;
    }

    .ptabs-sub__link {
        font-size: 12px;
        padding: 6px 14px;
        flex-shrink: 0;
    }
}

/* Overlay */
.psb-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 200001;
    opacity: 0;
    transition: opacity .25s;
    pointer-events: none;
}

.psb-overlay.is-open {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Drawer */
.psb-drawer {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background: #fff;
    z-index: 200002;
    transition: right .3s ease;
    overflow-y: auto;
    box-shadow: -4px 0 24px rgba(0, 0, 0, .08);
    display: flex;
    flex-direction: column;
}

.psb-drawer.is-open {
    right: 0;
}

.psb-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.psb-drawer__title {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary-color, #002937);
}

.psb-drawer__close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #eff0f2;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #888;
    transition: all .12s;
}

.psb-drawer__close:hover {
    background: #f5f5f5;
    color: var(--primary-color);
}

.psb-drawer__nav {
    flex: 1;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.psb-drawer__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    text-decoration: none;
    transition: all .12s;
}

.psb-drawer__link:hover {
    background: #f5f5f5;
    color: var(--primary-color, #002937);
}

.psb-drawer__link.is-active {
    background: rgba(0, 41, 55, .06);
    color: var(--primary-color, #002937);
    font-weight: 700;
}

.psb-drawer__icon {
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: .5;
}

.psb-drawer__link.is-active .psb-drawer__icon,
.psb-drawer__link:hover .psb-drawer__icon {
    opacity: 1;
}

.psb-drawer__group-title {
    font-size: 11px;
    font-weight: 800;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: .6px;
    padding: 12px 14px 4px;
}

.psb-drawer__group-title:first-child {
    padding-top: 0;
}

.psb-drawer__link--danger {
    color: #dc2626;
}

.psb-drawer__link--danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

.psb-drawer__link--danger .psb-drawer__icon {
    opacity: .7;
}

.psb-drawer__footer {
    border-top: 1px solid #f0f0f0;
    padding: 10px 12px;
    flex-shrink: 0;
}

/* ── Profile header ── */
.st-profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #eff0f2;
    margin-bottom: 24px;
}

.st-profile-header__avatar {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: var(--primary-color, #002937);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    flex-shrink: 0;
    overflow: hidden;
}

.st-profile-header__avatar img {
    width: 100%;
    height: 100%;
    object-fit: fill;
}

.st-profile-header__name {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-color, #002937);
    margin: 0 0 2px;
    line-height: 0;
}

.st-profile-header__username {
    font-size: 14px;
    color: #999;
    font-weight: 500;
}

/* ── Sections ── */
.st-section {
    background: #fff;
    border: 1px solid #eff0f2;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 16px;
}

.st-section__head {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f5f5f5;
}

.st-section__title {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary-color, #002937);
    margin: 0 0 4px;
    line-height: 1;
}

.st-section__desc {
    font-size: 14px;
    color: #999;
    margin: 0;
}

/* ── Grid ── */
.st-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 576px) {
    .st-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Fields ── */
.st-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.st-label {
    font-size: 14px;
    font-weight: 700;
    color: #444;
}

.st-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e4e4e4;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: #222;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    -webkit-appearance: none;
}

.st-input:focus {
    border-color: var(--primary-color, #002937);
    box-shadow: 0 0 0 3px rgba(0, 41, 55, .08);
}

.st-input.is-invalid {
    border-color: #dc2626;
}

.st-input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .1);
}

.st-input--muted {
    background: #f9f9f9;
    color: #999;
    cursor: default;
}

select.st-input {
    cursor: pointer;
}

.st-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.st-input-row .st-input {
    flex: 1;
}

.st-hint {
    font-size: 13px;
    color: #aaa;
    margin-top: 2px;
}

.st-hint a {
    color: var(--primary-color, #002937);
    font-weight: 600;
}

/* ── Badges ── */
.st-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 100px;
    white-space: nowrap;
    flex-shrink: 0;
}

.st-badge--green {
    background: #dcfce7;
    color: #166534;
}

.st-badge--amber {
    background: #fef3c7;
    color: #92400e;
}

/* ── Upload ── */
.st-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px 20px;
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    color: #999;
    font-size: 14px;
    font-weight: 500;
}

.st-upload:hover {
    border-color: var(--primary-color, #002937);
    background: #fafafa;
}

.st-upload b {
    color: var(--primary-color, #002937);
}

/* ── Radio ── */
.st-radio-row {
    display: flex;
    gap: 16px;
}

.st-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #444;
}

.st-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color, #002937);
    cursor: pointer;
}

/* ── Buttons ── */
.st-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    border: none;
    border-radius: 10px;
    background: var(--primary-color, #002937);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: opacity .15s;
}

.st-btn-primary:hover {
    opacity: .85;
}

.st-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    background: #fff;
    color: #555;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all .12s;
}

.st-btn-ghost:hover {
    border-color: var(--primary-color, #002937);
    color: var(--primary-color, #002937);
}

/* ── Footer ── */
.st-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 8px;
}

/* ── Sidebar ── */
.st-sidebar {
    position: sticky;
    top: 130px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.st-sidebar__card {
    background: #fff;
    border: 1px solid #eff0f2;
    border-radius: 16px;
    padding: 20px;
}

.st-sidebar__title {
    font-size: 14px;
    font-weight: 800;
    color: var(--primary-color, #002937);
    margin-bottom: 14px;
    letter-spacing: -.2px;
}

.st-sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    text-decoration: none;
    transition: all .12s;
    margin-bottom: 2px;
}

.st-sidebar__link:hover {
    background: #f7f8fa;
    color: var(--primary-color, #002937);
}

.st-sidebar__link.active {
    background: rgba(0, 41, 55, .06);
    color: var(--primary-color, #002937);
}

.st-sidebar__link svg {
    opacity: .5;
    flex-shrink: 0;
}

.st-sidebar__link.active svg {
    opacity: 1;
}

/* ── Stats ── */
.st-stats-row {
    display: flex;
    gap: 12px;
}

.st-stat {
    flex: 1;
    text-align: center;
    padding: 14px 8px;
    background: #f8fafc;
    border-radius: 12px;
}

.st-stat__num {
    display: block;
    font-size: 22px;
    font-weight: 900;
    color: var(--primary-color, #002937);
    line-height: 1;
    margin-bottom: 4px;
}

.st-stat__label {
    font-size: 13px;
    font-weight: 600;
    color: #999;
}

/* ── Email Preference Cards ── */
.ep-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border: 1px solid #eff0f2;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.ep-card:last-of-type {
    margin-bottom: 0;
}

.ep-card:hover {
    border-color: #d1d5db;
    background: #fafbfc;
}

.ep-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ep-card__text {
    flex: 1;
    min-width: 0;
}

.ep-card__title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.ep-card__desc {
    font-size: 13px;
    color: #888;
    line-height: 1.4;
}

.ep-card__toggle {
    position: relative;
    flex-shrink: 0;
}

.ep-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ep-toggle-track {
    display: block;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: #ddd;
    position: relative;
    transition: background .2s;
    cursor: pointer;
}

.ep-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
    transition: transform .2s;
}

.ep-toggle-input:checked + .ep-toggle-track {
    background: var(--primary-color, #002937);
}

.ep-toggle-input:checked + .ep-toggle-track::after {
    transform: translateX(20px);
}

/* ── Close Account: Reason Cards ── */
.close-reasons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.close-reason {
    cursor: pointer;
    display: block;
}

.close-reason__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.close-reason__box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid #e7e9ec;
    border-radius: 12px;
    transition: all .15s;
}

.close-reason:hover .close-reason__box {
    border-color: #d1d5db;
    background: #fafbfc;
}

.close-reason__input:checked ~ .close-reason__box {
    border-color: var(--primary-color, #002937);
    background: rgba(0, 41, 55, .03);
}

.close-reason__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #f3f4f6;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .15s;
}

.close-reason__input:checked ~ .close-reason__box .close-reason__icon {
    background: var(--primary-color, #002937);
    color: #fff;
}

.close-reason__label {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.close-reason__check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: transparent;
    transition: all .15s;
}

.close-reason__input:checked ~ .close-reason__box .close-reason__check {
    border-color: var(--primary-color, #002937);
    background: var(--primary-color, #002937);
    color: #fff;
}

/* ── Danger Button ── */
.st-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    border: none;
    border-radius: 10px;
    background: #dc2626;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s;
}

.st-btn-danger:hover {
    background: #b91c1c;
}

/* ── Responsive ── */
@media (max-width: 576px) {
    .st-section {
        padding: 20px 16px;
    }

    .st-profile-header {
        padding: 16px;
    }

    .st-sidebar {
        position: static;
    }

    .ep-card {
        padding: 14px;
        gap: 10px;
    }

    .ep-card__icon {
        width: 38px;
        height: 38px;
    }

    .ep-card__title {
        font-size: 14px;
    }

    .ep-card__desc {
        font-size: 12px;
    }

    .close-reason__box {
        padding: 12px 14px;
    }

    .close-reason__icon {
        width: 32px;
        height: 32px;
    }

    .close-reason__label {
        font-size: 14px;
    }
}

.profile-dropdown .rounded-circle {
    width: 45px;
    height: 45px;
    object-fit: fill;
}

.pw-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.pw-wrap .st-input {
    flex: 1;
    padding-inline-end: 44px;
}
.pw-toggle {
    position: absolute;
    inset-inline-end: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-muted, #5d6b7a);
    line-height: 0;
    transition: color .2s;
}
.pw-toggle:hover { color: #374151; }
.pw-toggle svg   { display: block; width: 20px; height: 20px; }

.change-password-success-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #e0f3ff;
    border: 1px solid #90cdf4;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 20px;
    color: #1a5f8a;
    font-size: 14px;
    font-weight: 500;
}