/* ============================================================
   user/style.css — 个人主页样式（随机背景 + 磨砂玻璃 + 响应式）
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Nunito", "Noto Sans SC", sans-serif;
    min-height: 100vh;
    background: #5c3d2e;
    background-image: url("https://api.elaina.cat/random/");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #3e2c1f;
    -webkit-font-smoothing: antialiased;
}
/* 半透明遮罩保证文字可读 */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(245, 230, 202, 0.78);
    z-index: 0;
}
#app {
    position: relative;
    z-index: 1;
}

/* ====== 导航栏 ====== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
    background: rgba(255, 249, 240, 0.55);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(139, 94, 60, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #3e2c1f;
    font-weight: 800;
    font-size: 20px;
}
.navbar-logo-icon {
    font-size: 26px;
}
.navbar-links {
    display: flex;
    align-items: center;
    gap: 16px;
}
.navbar-links a,
.btn-logout {
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 10px;
    transition: all 0.2s;
}
.navbar-links a {
    color: #6b4f3a;
}
.navbar-links a:hover {
    color: #8b5e3c;
    background: rgba(139, 94, 60, 0.06);
}
.btn-logout {
    background: transparent;
    color: #a67b5b;
    border: 1px solid rgba(166, 123, 91, 0.3);
    cursor: pointer;
    font-family: inherit;
}
.btn-logout:hover {
    background: rgba(220, 38, 38, 0.08);
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.25);
}

/* ====== 加载中 ====== */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 16px;
    color: #6b4f3a;
}
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(139, 94, 60, 0.15);
    border-top-color: #8b5e3c;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ====== 主容器 ====== */
.profile-container {
    max-width: 560px;
    margin: 48px auto;
    padding: 0 20px 64px;
}

/* ====== 磨砂玻璃卡片 ====== */
.profile-card {
    background: rgba(255, 249, 240, 0.55);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-radius: 24px;
    border: 1px solid rgba(139, 94, 60, 0.1);
    box-shadow: 0 8px 40px rgba(62, 44, 31, 0.1);
    padding: 40px 36px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* ====== 头像区 ====== */
.avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(139, 94, 60, 0.08);
}
.avatar-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    border: 3px solid rgba(139, 94, 60, 0.2);
    transition:
        border-color 0.2s,
        transform 0.2s;
}
.avatar-wrapper:hover {
    border-color: #8b5e3c;
    transform: scale(1.03);
}
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #a67b5b, #8b5e3c);
    display: flex;
    align-items: center;
    justify-content: center;
}
.avatar-initial {
    font-size: 48px;
    font-weight: 700;
    color: #fff9f0;
    text-transform: uppercase;
}
.avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.avatar-wrapper:hover .avatar-overlay {
    opacity: 1;
}
.avatar-camera {
    font-size: 32px;
}
.avatar-hint {
    font-size: 13px;
    color: rgba(107, 79, 58, 0.5);
    margin: 0;
}
.avatar-status {
    font-size: 13px;
    color: #8b5e3c;
}
.avatar-status.error {
    color: #dc2626;
}

/* ====== 信息编辑区 ====== */
.info-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #5c3d2e;
}
.field-icon {
    font-size: 18px;
}
.field-badge {
    font-size: 11px;
    font-weight: 500;
    color: rgba(107, 79, 58, 0.45);
    background: rgba(139, 94, 60, 0.06);
    padding: 2px 10px;
    border-radius: 20px;
    margin-left: 4px;
}
.field-row {
    display: flex;
    gap: 10px;
}
.field-sub-row {
    display: flex;
    gap: 10px;
}
.field-sub {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ====== 输入框 — 磨砂 ====== */
.field-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(139, 94, 60, 0.2);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    color: #3e2c1f;
    background: rgba(255, 249, 240, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}
.field-input:focus {
    border-color: #8b5e3c;
    box-shadow: 0 0 0 3px rgba(139, 94, 60, 0.1);
}
.field-input.readonly {
    background: rgba(139, 94, 60, 0.04);
    color: #6b4f3a;
    cursor: not-allowed;
}
.field-input::placeholder {
    color: rgba(107, 79, 58, 0.3);
}

/* ====== 按钮 ====== */
.btn {
    font-family: inherit;
    border: none;
    cursor: pointer;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.btn-sm {
    padding: 10px 20px;
    font-size: 14px;
}
.btn-primary {
    background: #8b5e3c;
    color: #fff9f0;
}
.btn-primary:hover:not(:disabled) {
    background: #6b3f2a;
    transform: translateY(-1px);
}

/* ====== 反馈信息 ====== */
.field-error {
    font-size: 13px;
    color: #dc2626;
    margin: 0;
}
.field-success {
    font-size: 13px;
    color: #16a34a;
    margin: 0;
}

/* ====== 响应式 ====== */
@media (max-width: 640px) {
    .navbar {
        padding: 10px 16px;
    }
    .navbar-logo-text {
        font-size: 16px;
    }
    .profile-container {
        margin: 24px auto;
        padding: 0 12px 48px;
    }
    .profile-card {
        padding: 24px 18px;
        gap: 24px;
    }
    .avatar-wrapper {
        width: 96px;
        height: 96px;
    }
    .avatar-initial {
        font-size: 38px;
    }
    .field-row {
        flex-direction: column;
    }
    .field-input {
        width: 100%;
    }
}
