/* 공통 레이아웃 */
body {
    font-family: "Noto Sans KR", Arial, sans-serif;
    background-color: #f5f7fa;
    margin: 0;
    padding: 0;
    color: #333;
}

h1 {
    text-align: center;
    margin: 30px 0;
    font-size: 28px;
    color: #2c3e50;
}

a {
    color: #3498db;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* 중앙 정렬된 카드 레이아웃 */
form, .card {
    max-width: 400px;
    margin: 0 auto;
    padding: 25px 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* 폼 입력 필드 */
form div {
    margin-bottom: 15px;
}

label {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
    color: #555;
}

input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

input:focus {
    border-color: #3498db;
    outline: none;
}

/* 버튼 */
button {
    width: 100%;
    padding: 12px;
    background: #3498db;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s ease;
}

button:hover {
    background: #2980b9;
}

.btn-outline:hover {
    background: #c5c5c7;
}
.btn-secondary:hover {
    background: #c5c5c7;
}

/* 에러 메시지 */
div .error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
}

/* 알림 메시지 */
.message {
    max-width: 400px;
    margin: 15px auto;
    padding: 10px 15px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
}

.message.success {
    background: #eafaf1;
    color: #27ae60;
}

.message.error {
    background: #fdecea;
    color: #e74c3c;
}

.message.info {
    background: #ebf5fb;
    color: #2980b9;
}

/* 마이페이지 카드 */
.mypage-card {
    max-width: 500px;
    margin: 0 auto;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.mypage-card ul {
    list-style: none;
    padding: 0;
}

.mypage-card li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-size: 15px;
}

.mypage-card li:last-child {
    border-bottom: none;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #eee;
    background: #fafafa
}

.topbar h1 {
    margin: 0;
    font-size: 1.5rem
}

.btn {
    cursor: pointer;
    border-radius: 10px;
    padding: 10px 14px;
    border: 1px solid transparent;
    font-weight: 600;
    min-width: 105px;
}

.btn-primary {
    background: #2563eb;
    color: #fff
}

.btn-secondary {
    background: #f3f4f6;
    color: #111827;
    border-color: #e5e7eb
}

.btn-outline {
    background: transparent;
    border-color: #d1d5db;
    color: #111827
}

.container {
    max-width: 760px;
    margin: 32px auto;
    padding: 0 16px
}

.card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .06);
    padding: 24px
}

.section-title {
    font-size: 1.125rem;
    margin: 0 0 16px 0
}

.row {
    display: flex;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #f3f3f3
}

.row:last-child {
    border-bottom: none
}

.label {
    width: 120px;
    color: #6b7280;
    font-weight: 700;
    line-height: 36px
}

.value {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap
}

.value span {
    min-height: 36px;
    display: inline-flex;
    align-items: center
}

.input {
    display: none;
    width: 100%;
    max-width: 340px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px
}

.actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: flex-end;
    flex-wrap: wrap
}

.pw-actions {
    display: none;
    gap: 12px
}

/* 편집(프로필) 모드 */
body.editing #btn-edit,
body.editing #btn-password {
    display: none
}

body:not(.editing) #btn-save,
body:not(.editing) #btn-cancel,
body:not(.editing) .input {
    display: none
}

body.editing .editable .input {
    display: inline-block
}

body.editing .editable .value span {
    display: none
}

/* 비밀번호 변경 모드 */
#pw-section {
    display: none;
    margin-top: 8px
}

#pw-section .input {
    display: inline-block
}

/* 비번 입력은 항상 노출 */
body.pw-editing #pw-section {
    display: block
}

body.pw-editing #btn-edit,
body.pw-editing #btn-password,
body.pw-editing #btn-save,
body.pw-editing #btn-cancel {
    display: none
}

body.pw-editing .pw-actions {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}

/* 요청 사항: 비번 변경 모드일 때 위 수정 영역 숨김 */
.profile-view {
}

/* 래퍼 */
body.pw-editing .profile-view {
    display: none
}

/* 섹션 헤더: 제목 + 아바타 정렬 */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

/* 상단 동그라미 아바타 */
.btn-plain {
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .04);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 아바타 변경 전용 섹션 */
#avatar-section {
    display: none;
    margin-top: 12px;
}

body.avatar-editing #avatar-section {
    display: block;
}

/* 큰 정사각형 프리뷰 박스 */
.avatar-stage {
    display: flex;
    justify-content: center;
    margin: 12px 0 8px 0;
}

.avatar-square {
    width: 100%;
    height: 400px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .06);
    background-size: cover;
    background-position: center;
}

.avatar-square:hover {
    cursor: pointer;
    border: 1px solid #2563eb;
}

/* 아바타 액션 버튼 영역 */
.avatar-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* 모드 전환: 아바타 편집 모드에서는 나머지 UI 숨김 */
body.avatar-editing .profile-view,
body.avatar-editing #pw-section,
body.avatar-editing #btn-edit,
body.avatar-editing #btn-password,
body.avatar-editing #btn-save,
body.avatar-editing #btn-cancel,
body.avatar-editing .pw-actions,
body.avatar-editing #avatar-button {
    display: none !important;
}
