@import url('/screens/user/account/child.css');
@import url('/screens/user/account/avatar.css');

.profile-edit-container { width: min(1120px, 100%); }
.profile-edit-page .child-header { flex-wrap: wrap; }
.profile-edit-page .child-header a { color: var(--site-link); }
.profile-edit-card { padding: clamp(18px, 3vw, 40px); }

.profile-edit-layout {
    display: grid;
    grid-template-columns: minmax(240px, .95fr) minmax(0, 1.65fr);
    gap: clamp(24px, 4vw, 60px);
    align-items: center;
}

.profile-avatar-editor {
    --avatar-arrow: clamp(34px, 3vw, 44px);
    min-width: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
}

.profile-avatar-stage {
    position: relative;
    width: min(100%, 370px);
    margin-inline: auto;
    padding-inline: calc(var(--avatar-arrow) + 10px);
    direction: ltr;
}

.profile-avatar-stage [data-avatar-preview] {
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid var(--via-border);
    border-radius: 22px;
    background: var(--via-panel-2);
}

.profile-avatar-stage .via-character {
    border-radius: 0;
    background: radial-gradient(circle at 50% 32%, var(--site-tint), var(--via-panel-2) 80%);
}

.profile-avatar-stage [data-avatar-controls] > div {
    position: absolute;
    inset-inline: 0;
    top: var(--avatar-row);
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    pointer-events: none;
}

.profile-avatar-stage [data-avatar-part="hair"] { --avatar-row: 20%; }
.profile-avatar-stage [data-avatar-part="face"] { --avatar-row: 48%; }
.profile-avatar-stage [data-avatar-part="clothes"] { --avatar-row: 80%; }

.profile-avatar-editor button {
    display: grid;
    place-items: center;
    width: var(--avatar-arrow);
    height: var(--avatar-arrow);
    padding: 0 0 3px;
    border: 1px solid var(--via-border);
    border-radius: 50%;
    background: var(--via-panel-2);
    color: var(--via-text);
    font: inherit;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
}

.profile-avatar-editor button:hover { border-color: var(--via-accent); background: var(--site-tint); }
.profile-avatar-editor button:focus-visible { outline: 2px solid var(--via-accent); outline-offset: 3px; }

.profile-edit-details {
    display: grid;
    gap: 25px;
    min-width: 0;
}

.profile-edit-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 16px;
}

.profile-edit-fields .account-field {
    min-width: 0;
    gap: 6px;
    color: var(--via-muted);
    font-size: 14px;
    font-weight: 650;
}

.profile-edit-fields .account-field :is(input, .profile-sex-trigger) {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 15px;
}

.profile-sex-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid var(--via-border);
    background: var(--via-panel-2);
    color: var(--via-text);
    font: inherit;
    font-weight: 650;
    text-align: start;
    cursor: pointer;
}
.profile-sex-chevron {
    flex: none;
    width: 7px;
    height: 7px;
    margin: -4px 2px 0;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
}
.profile-sex-dialog {
    width: min(390px, calc(100% - 32px));
    box-sizing: border-box;
    padding: 22px;
    border: 1px solid var(--via-border);
    border-radius: 16px;
    background: var(--via-panel);
    color: var(--via-text);
    box-shadow: 0 20px 70px rgba(0, 0, 0, .35);
}
.profile-sex-dialog::backdrop { background: rgba(0, 0, 0, .64); }
.profile-sex-dialog form { display: grid; gap: 10px; }
.profile-sex-dialog h2 { margin: 0 0 8px; text-align: center; font-size: 19px; }
.profile-sex-option {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--via-border);
    border-radius: 10px;
    background: var(--via-panel-2);
    color: var(--via-text);
    font-weight: 650;
    cursor: pointer;
}
.profile-sex-option:has(input:checked) { border-color: var(--via-accent); background: var(--site-tint); }
.profile-sex-option:focus-within { outline: 2px solid var(--via-accent); outline-offset: 2px; }
.profile-sex-option img { width: 24px; height: 24px; object-fit: contain; }
html[data-theme="light"] .profile-sex-option img { filter: brightness(0); }
.profile-sex-option input { margin: 0; width: 18px; height: 18px; accent-color: var(--via-accent); }
.profile-sex-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.profile-sex-actions button { min-height: 42px; }
.profile-sex-actions button:disabled { opacity: .55; cursor: default; }
.profile-edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.profile-edit-actions .account-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding-inline: 20px;
    font-size: 13px;
}
.profile-edit-actions .form-message:empty { display: none; }

@media (max-width: 700px) {
    .profile-edit-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .profile-avatar-stage { max-width: 320px; }
    .profile-edit-fields { column-gap: 10px; }
}

@media (max-width: 370px) {
    .profile-edit-fields .account-field :is(input, .profile-sex-trigger) { padding-inline: 7px; }
}
