/* Member profile — sticky sidebar + section panels */

.sm-profile {
    --sm-profile-sticky-top: 24px; /* raise to clear a fixed theme header */
}

/* ---------- Layout ---------- */

.sm-profile__layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.sm-profile__sidebar {
    position: sticky;
    top: var(--sm-profile-sticky-top);
    padding: 20px 14px 16px;
    text-align: center;
}

.sm-profile__content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.sm-profile__form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---------- Sidebar: identity ---------- */

.sm-profile__avatar {
    width: 84px;
    height: 84px;
    margin: 0 auto 10px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--sm-line);
    background: linear-gradient(145deg, var(--sm-accent), var(--sm-accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
}

.sm-profile__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sm-profile__avatar-initials {
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 1px;
}

.sm-profile__name {
    font-size: 15px;
    font-weight: 700;
    color: var(--sm-ink);
    word-break: break-word;
}

.sm-profile__number {
    margin-top: 2px;
    font-size: 12px;
    color: var(--sm-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.sm-profile__badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 12px 0 16px;
}

/* ---------- Sidebar: nav ---------- */

.sm-profile__nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--sm-line);
    text-align: left;
}

.sm-profile__nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--sm-radius-sm);
    color: var(--sm-text);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.sm-profile__nav-link .dashicons {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    font-size: 18px;
    opacity: .75;
}

.sm-profile__nav-link:hover,
.sm-profile__nav-link:focus-visible {
    background: var(--sm-soft);
    color: var(--sm-accent);
    text-decoration: none;
}

.sm-profile__nav-link.is-active {
    background: var(--sm-accent-soft);
    color: var(--sm-accent);
    font-weight: 600;
}

.sm-profile__nav-link.is-active .dashicons { opacity: 1; }

/* ---------- Sidebar: compact actions ---------- */

.sm-profile__actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--sm-line);
}

.sm-profile .sm-btn--sm {
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 7px 12px;
    border-radius: var(--sm-radius-sm);
    font-size: 13px;
    line-height: 1.3;
    box-shadow: none;
}

.sm-profile .sm-btn--sm .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.sm-profile .sm-btn--sm:disabled {
    opacity: .6;
    cursor: wait;
}

.sm-profile .sm-btn--warning {
    background: var(--sm-warning);
    color: #fff;
}

.sm-profile .sm-btn--warning:hover { color: #fff; }

.sm-profile__notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: var(--sm-radius-sm);
    background: var(--sm-info-soft);
    color: var(--sm-info);
    font-size: 12px;
    font-weight: 600;
}

.sm-profile__notice .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

/* ---------- Section panels ---------- */

.sm-profile .sm-profile__panel {
    padding: 18px 20px 10px;
    border-radius: var(--sm-radius);
    background: var(--sm-surface);
    box-shadow: var(--sm-shadow);
    scroll-margin-top: calc(var(--sm-profile-sticky-top) + 8px);
}

.sm-profile__panel-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--sm-line);
}

.sm-profile__panel-head .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
    color: var(--sm-accent);
}

.sm-profile__panel-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--sm-ink);
}

.sm-profile__grid { gap: 2px 14px; }

.sm-profile__save {
    display: flex;
    justify-content: flex-end;
}

/* Membership summary */
.sm-profile__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin: 0 0 8px;
}

.sm-profile__meta > div {
    padding: 10px 14px;
    border: 1px solid var(--sm-line);
    border-radius: var(--sm-radius-sm);
    background: var(--sm-soft);
}

.sm-profile__meta dt {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--sm-muted);
}

.sm-profile__meta dd {
    margin: 4px 0 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--sm-ink);
}

/* ---------- Read-only values ---------- */

.sm-field--readonly .sm-field__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--sm-ink);
}

.sm-field--readonly .sm-field__value {
    margin-top: 4px;
    padding: 6px 10px;
    min-height: 36px;
    display: flex;
    align-items: center;
    border: 1px solid var(--sm-line);
    border-radius: var(--sm-input-radius, var(--sm-radius-sm));
    background: var(--sm-soft);
    font-size: 14px;
    color: var(--sm-muted);
}

.sm-profile .sm-field--readonly .sm-attachment {
    margin-top: 4px;
}

.sm-profile .sm-attachment-field .sm-attachment,
.sm-profile .sm-field--readonly .sm-attachment--done {
    background: #fff;
}

.sm-profile .sm-attachment--empty,
.sm-profile .sm-attachment--disabled {
    background: #fff;
    border-color: var(--sm-line-strong);
}

.sm-profile .sm-attachment-field .sm-attachment--empty:hover {
    border-color: var(--sm-accent);
}

/* ---------- Renewal modal (receipt mode) ---------- */

.sm-profile .sm-modal .sm-modal__text {
    margin-bottom: 14px;
}

.sm-profile .sm-modal .sm-field {
    margin-bottom: 14px;
}

.sm-profile .sm-modal .sm-field > label,
.sm-profile .sm-modal .sm-field__label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sm-ink);
}

.sm-profile__method-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sm-profile__method {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid var(--sm-line-strong);
    border-radius: var(--sm-radius-sm);
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.sm-profile__method:hover { border-color: var(--sm-accent); }

.sm-profile__method.is-selected {
    border-color: var(--sm-accent);
    background: var(--sm-accent-soft);
}

.sm-profile__method-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sm-profile__method-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--sm-ink);
}

/* Instructions only for the chosen method */
.sm-profile__method-desc {
    display: none;
    padding-top: 8px;
    border-top: 1px dashed var(--sm-line-strong);
    font-size: 13px;
    color: var(--sm-muted);
}

.sm-profile__method.is-selected .sm-profile__method-desc { display: block; }

.sm-profile__method-desc p:first-child { margin-top: 0; }
.sm-profile__method-desc p:last-child { margin-bottom: 0; }

.sm-profile .sm-modal .sm-field-error {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--sm-danger);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
    .sm-profile__layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .sm-profile__sidebar {
        position: static;
    }

    .sm-profile__nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 6px;
        padding-bottom: 4px;
    }

    .sm-profile__nav-link {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .sm-profile__actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sm-profile .sm-btn--sm {
        width: auto;
        flex: 1 1 140px;
    }

    .sm-profile .sm-profile__panel {
        scroll-margin-top: 12px;
    }
}
