@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700;800&display=swap");
:root {
    --yellow:#f6c945;
    --yellow-dark:#dfa818;
    --cream:#fffaf0;
    --white:#fff;
    --brown:#664229;
    --text:#2d2a26;
    --muted:#888178;
    --line:#e5e0d6;
    --danger:#c74633;
    --shadow:0 18px 50px rgba(65,51,35,.16)
}
* {
    box-sizing:border-box
}
body {
    margin:0;
    min-height:100vh;
    font-family:"Noto Sans KR",sans-serif;
    color:var(--text);
    background:linear-gradient(135deg,#fffdf6,#fff3bf)
}
.profile-edit-page {
    min-height:100vh;
    display:grid;
    place-items:center;
    padding:32px 16px
}
.profile-edit-card {
    position:relative;
    width:min(620px,100%);
    padding:34px;
    border:1px solid rgba(223,168,24,.24);
    border-radius:26px;
    background:rgba(255,255,255,.97);
    box-shadow:var(--shadow)
}
.back-button {
    position:absolute;
    top:20px;
    right:20px;
    width:40px;
    height:40px;
    display:grid;
    place-items:center;
    border-radius:12px;
    color:var(--brown);
    background:#f3f0e9;
    text-decoration:none;
    font-size:21px
}
.back-button:hover {
    background:#fff3bf
}
.page-heading {
    display:flex;
    align-items:center;
    gap:16px;
    padding-right:52px;
    margin-bottom:25px
}
.profile-edit-avatar {
    width:64px;
    height:64px;
    display:grid;
    place-items:center;
    flex:none;
    border-radius:50%;
    color:var(--brown);
    background:var(--yellow);
    font-size:29px
}
.page-heading h1 {
    margin:0 0 5px;
    font-size:25px
}
.page-heading p {
    margin:0;
    color:var(--muted);
    font-size:13px
}
form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap:16px
}
label {
    display:grid;
    gap:7px;
    color:#68645c;
    font-size:12px;
    font-weight:800
}
label:nth-of-type(2),label:nth-of-type(3),label:nth-of-type(6),label:nth-of-type(7),label:nth-of-type(8) {
}
input {
    width:100%;
    height:45px;
    padding:0 13px;
    border:1px solid #ead79c;
    border-radius:11px;
    outline:none;
    color:var(--text);
    background:var(--white)
}
input:focus {
    border-color:var(--yellow-dark);
    box-shadow:0 0 0 3px rgba(246,201,69,.2)
}
.form-divider,.form-message,.form-actions {
    grid-column:1/-1
}
.form-divider {
    display:flex;
    align-items:center;
    gap:10px;
    margin-top:6px;
    color:var(--muted);
    font-size:12px;
    font-weight:800
}
.form-divider::before,.form-divider::after {
    content:"";
    height:1px;
    flex:1;
    background:var(--line)
}
.form-message {
    min-height:18px;
    margin:0;
    color:var(--danger);
    font-size:12px
}
.form-message.success {
    color:#32874a
}
.form-actions {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
    margin-top:4px
}
.cancel-button,.save-button {
    height:48px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:12px;
    text-decoration:none;
    font-size:14px;
    font-weight:800
}
.cancel-button {
    border:1px solid var(--line);
    color:#68645c;
    background:#fff
}
.save-button {
    border:1px solid var(--yellow-dark);
    color:#3d2b1f;
    background:var(--yellow);
    cursor:pointer
}
.save-button:hover {
    background:#ffd85f
}
@media(max-width:600px) {
    .profile-edit-card {
        padding:26px 20px
    }
    .page-heading {
        align-items:flex-start
    }
    .profile-edit-avatar {
        width:56px;
        height:56px
    }
    form {
        grid-template-columns: 1fr;
    }
    .form-divider,.form-message,.form-actions {
        grid-column:1
    }
    .form-actions {
        grid-template-columns:1fr
    }
    .page-heading h1 {
        font-size:22px
    }
}


/* 현재 저장된 프로필 사진 / 새 사진 미리보기 */
.profile-edit-avatar {
    overflow: hidden;
}

.profile-edit-avatar.has-photo {
    padding: 0;
    background: #f3f0e9;
}

.profile-edit-avatar-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 50%;
}


/* 소셜 계정 프로필 수정 안내 */
.social-account-badge {
    width: fit-content;
    margin-top: 7px;
    padding: 4px 8px;
    border: 1px solid #e4c451;
    border-radius: 999px;
    color: #76580a;
    background: #fffaf0;
    font-size: 10px;
    font-weight: 800;
}

.social-password-guide {
    margin-top: 18px;
    padding: 14px 15px;
    border: 1px solid #eadba9;
    border-radius: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #554b3d;
    background: #fffdf7;
}

.social-password-guide > i {
    margin-top: 1px;
    color: #c79210;
    font-size: 20px;
}

.social-password-guide div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.social-password-guide strong {
    font-size: 12px;
}

.social-password-guide span {
    color: #8a8175;
    font-size: 11px;
    line-height: 1.5;
}


/* =====================================================
   프로필 수정 최종 보정
   - 이메일 수정 제거
   - 성별 수정 추가
   - KO / JA / EN 언어 버튼
   - 프로필 사진 파일 선택 수직 정렬
===================================================== */

.profile-edit-card {
    position: relative;
}

.profile-edit-toolbar {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 4;
}

.language-switcher {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    border: 1px solid #ead79c;
    border-radius: 11px;
    background: #fffdf8;
}

.language-option {
    min-width: 42px;
    height: 30px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    color: #8b8379;
    background: transparent;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.language-option.active {
    color: #62480d;
    background: #fff2bb;
    box-shadow: inset 0 0 0 1px rgba(223, 168, 24, .35);
}

.profile-edit-toolbar .back-button {
    position: static !important;
    top: auto !important;
    right: auto !important;
    width: 40px;
    height: 40px;
    margin: 0;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--brown);
    background: #f3f0e9;
    text-decoration: none;
    font-size: 21px;
}

.profile-edit-toolbar .back-button:hover {
    background: #fff3bf;
}

.page-heading {
    padding-right: 220px;
}

/* 성별 / 프로필 사진
   두 영역의 라벨 높이, 간격, 컨트롤 높이를 완전히 동일하게 맞춤 */
.profile-gender-field,
.profile-photo-field {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    display: grid;
    grid-template-rows: 16px 45px;
    row-gap: 7px;
    align-content: start;
    box-sizing: border-box;
}

.profile-gender-field legend,
.profile-photo-field > span {
    width: 100%;
    height: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    color: #68645c;
    font-size: 12px;
    font-weight: 800;
    line-height: 16px;
    box-sizing: border-box;
}

.profile-gender-field legend b {
    margin-left: 2px;
    color: var(--danger);
}

/* 성별: 두 버튼의 합친 전체 높이가 사진 박스와 동일하게 45px */
.profile-gender-options {
    width: 100%;
    height: 45px;
    min-width: 0;
    margin: 6.5px 0 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
}

.profile-gender-options label {
    min-width: 0;
    height: 45px;
    display: block;
}

.profile-gender-options input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.profile-gender-options label > span {
    width: 100%;
    height: 45px;
    min-height: 45px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid #ead79c;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: #68645c;
    background: #fff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    box-sizing: border-box;
    transition:
        border-color .18s ease,
        background .18s ease,
        box-shadow .18s ease;
}

.profile-gender-options label > span > span {
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    display: inline;
    color: inherit;
    background: transparent;
    font: inherit;
}

.profile-gender-options input:checked + span {
    border-color: var(--yellow-dark);
    color: #58400d;
    background: #fff9e3;
    box-shadow: 0 0 0 2px rgba(246, 201, 69, .12);
}

.profile-gender-options input:focus-visible + span {
    outline: 3px solid rgba(246, 201, 69, .24);
    outline-offset: 2px;
}

/* 프로필 사진: 성별과 동일한 45px 외곽 박스.
   native file input의 고유 최소폭 때문에 오른쪽이 잘리지 않도록 min-width:0 처리 */
.profile-photo-input {
    width: 100%;
    height: 45px;
    min-width: 0;
    margin: 0;
    padding: 4px 5px;
    border: 1px solid #ead79c;
    border-radius: 11px;
    display: flex;
    align-items: center;
    background: #fff;
    overflow: hidden;
    box-sizing: border-box;
}

.profile-photo-input:focus-within {
    border-color: var(--yellow-dark);
    box-shadow: 0 0 0 3px rgba(246, 201, 69, .14);
}

.profile-photo-input input[type="file"] {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 35px;
    min-height: 35px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    outline: 0;
    color: #716b63;
    background: transparent;
    font-size: 11px;
    line-height: 35px;
    box-shadow: none;
    overflow: hidden;
    box-sizing: border-box;
    cursor: pointer;
}

.profile-photo-input input[type="file"]::file-selector-button {
    height: 35px;
    margin: 0 10px 0 0;
    padding: 0 14px;
    border: 1px solid #dfc376;
    border-radius: 9px;
    color: #5d481d;
    background: #fff9e9;
    font-size: 11px;
    font-weight: 800;
    line-height: 33px;
    cursor: pointer;
    box-sizing: border-box;
}

.profile-photo-input input[type="file"]::file-selector-button:hover {
    border-color: var(--yellow-dark);
    background: #fff2c0;
}

/* 비밀번호 */
.local-password-section,
.social-password-guide {
    grid-column: 1 / -1;
}

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

.password-confirm-field {
    grid-column: 1 / -1;
}

.social-password-guide[hidden],
.local-password-section[hidden] {
    display: none !important;
}

.save-button:disabled {
    opacity: .6;
    cursor: wait;
}

/* 소셜 계정 안내 */
.social-account-badge {
    width: fit-content;
    margin-top: 7px;
    padding: 4px 8px;
    border: 1px solid #e4c451;
    border-radius: 999px;
    color: #76580a;
    background: #fffaf0;
    font-size: 10px;
    font-weight: 800;
}

.social-password-guide {
    margin-top: 2px;
    padding: 14px 15px;
    border: 1px solid #eadba9;
    border-radius: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #554b3d;
    background: #fffdf7;
}

.social-password-guide > i {
    margin-top: 1px;
    color: #c79210;
    font-size: 20px;
}

.social-password-guide div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.social-password-guide strong {
    font-size: 12px;
}

.social-password-guide span {
    color: #8a8175;
    font-size: 11px;
    line-height: 1.5;
}

@media (max-width: 700px) {
    .profile-edit-toolbar {
        position: static;
        justify-content: flex-end;
        margin-bottom: 18px;
    }

    .page-heading {
        padding-right: 0;
    }
}

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

    .password-confirm-field {
        grid-column: auto;
    }
}
