﻿/* 
   pe- (profile-edit)
*/

/* The form sits on the surface right under the page bar: white outlined fields, plain labels
   and the two account actions as full-width buttons at the bottom. */
.pe-root {
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    gap: 16px;
}

    /* The form reads as one centred column under the full-width page bar. */
    .pe-root > * {
        width: 100%;
        max-width: 520px;
    }

/* ---------- Form: one column, as in the app ---------- */

.pe-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 520px;
    box-sizing: border-box;
}

.pe-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px 0 4px;
}

.pe-avatar__image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.pe-avatar__change {
    border: none;
    background: none;
    padding: 0;
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: underline;
    cursor: pointer;
}

.pe-avatar__change:hover {
    color: var(--text-primary);
}

.pe-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.pe-field__label {
    margin: 0;
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);
}

.pe-field__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 4px;
}

.pe-small-btn {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border: none;
    border-radius: 8px;
    background: var(--accent-action);
    color: #fff;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.pe-input {
    box-sizing: border-box;
    border: none;
    outline: 1px solid var(--accent-line);
    border-radius: 10px;
    width: 100%;
    height: 48px;
    background: var(--surface-raised);
    padding: 0 12px;
    font-family: var(--font-family);
    font-weight: 500;
    font-size: 16px;
    line-height: 150%;
    color: var(--text-primary);
}

.pe-input:focus {
    outline: 2px solid var(--accent-action);
}

.pe-input--muted,
.pe-input:disabled {
    background: var(--surface-sunken);
    color: var(--text-secondary);
}

.pe-apply-btn {
    cursor: pointer;
    border-radius: 8px;
    margin: 4px 0 0;
    padding: 0 20px;
    height: 48px;
    width: 100%;
    border: 0;
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 16px;
    color: #fff;
    background-color: var(--accent-action);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pe-apply-btn:disabled {
    background-color: var(--ink-200);
    cursor: not-allowed;
}

/* Applying result */
.pe-result {
    box-sizing: border-box;
    border-radius: 10px;
    padding: 10px 12px;
    width: 100%;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    background: var(--surface-sunken);
}

    .pe-result > p {
        font-family: var(--font-family);
        font-weight: 500;
        font-size: 14px;
        color: var(--text-secondary);
        margin: 0;
    }

.pe-result--ok > p {
    color: var(--green-color);
}

.pe-result--fail > p {
    color: var(--red-color);
}

/* ---------- Avatar picker ---------- */

.pe-avatar-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: var(--surface-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.pe-avatar-dialog {
    width: 100%;
    max-width: 360px;
    background: var(--surface-raised);
    border-radius: var(--r-lg);
    padding: 16px;
    box-shadow: var(--elev-3);
}

.pe-avatar-dialog__head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.pe-avatar-dialog__title {
    margin: 0;
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.pe-avatar-dialog__close {
    margin-left: auto;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
}

.pe-avatar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.pe-avatar-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: 2px solid transparent;
    border-radius: 50%;
    background: var(--surface-sunken);
    cursor: pointer;
}

.pe-avatar-option img {
    width: 100%;
    height: auto;
    border-radius: 50%;
}

.pe-avatar-option--selected {
    border-color: var(--accent-action);
}

/* ---------- Account actions, pinned to the foot of the page ---------- */

.pe-bottom {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
    align-items: stretch;
    margin-top: auto;
    padding-top: 28px;
}

.pe-logout,
.pe-delete {
    cursor: pointer;
    box-sizing: border-box;
    height: 48px;
    padding: 0 16px;
    border-radius: 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pe-logout {
    border: none;
    background: var(--text-tertiary);
    color: #fff;
}

.pe-delete {
    background: var(--surface-raised);
    border: 1.25px solid var(--red-color);
    color: var(--red-color);
}

.pe-logout svg,
.pe-delete svg {
    stroke: currentColor;
}

.pe-logout-text,
.pe-delete-text {
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 16px;
    line-height: 143%;
    margin: 0;
}

.pe-logout-text {
    color: #fff;
}

.pe-delete-text {
    color: var(--red-color);
}

@media (min-width: 768px) {
    /* The sheet spans the whole content column (like the test-info plate);
       only the form itself stays a narrow column. */
    .pe-root {
        gap: 20px;
    }

    .pe-form,
    .pe-bottom {
        max-width: 560px;
    }

    .pe-apply-btn {
        width: auto;
        min-width: 220px;
        padding: 0 28px;
    }

    .pe-result {
        width: auto;
        justify-content: flex-start;
    }

    .pe-logout,
    .pe-delete {
        width: 100%;
    }
}
