/* profile.css - 个人中心专用样式 */

/* 基础布局 */
.profile-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.profile-content {
    display: flex;
    gap: 30px;
    margin-top: 30px;
}
.info-message {
    margin-left: 10px;
    font-size: 14px;
    color: #666;
    font-weight: normal;
}

.info-message.success {
    color: #4CAF50;
}

.info-message.error {
    color: #F44336;
}

.info-message.info {
    color: #2196F3;
}

/* 侧边栏样式 */
.profile-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.profile-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.message {
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: 4px;
    transition: opacity 0.5s ease;
}
.message.loading {
    background: #f8f9fa;
    color: #6c757d;
}
.message.success {
    background: #d4edda;
    color: #155724;
}
.message.error {
    background: #f8d7da;
    color: #721c24;
}

.avatar-upload img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #f0f0f0;
    margin-bottom: 15px;
}

/* 头像上传区域 */
.avatar-upload {
    position: relative;
    text-align: center; /* 确保内部元素居中 */
    display: flex;
    flex-direction: column;
    align-items: center; /* 水平居中 */
    gap: 10px; /* 头像和按钮之间的间距 */
}

/* 更换按钮样式 */
.upload-btn {
    display: inline-block;
    padding: 2px 15px;
    background-color: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    font-weight: 500;
    width: auto; /* 根据内容自适应宽度 */
    margin: 0 auto; /* 水平居中（备用方案） */
    margin-top: -40px; /* 原值可能是 10px，减少这个值让按钮上移 */
}

/* 悬停效果（与保存按钮一致） */
.upload-btn:hover {
    background-color: var(--primary-color-dark);
    border-color: var(--primary-color-dark);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.upload-btn:active {
    transform: translateY(0);
}

.profile-menu {
    list-style: none;
    padding: 0;
    margin-top: 20px;
}

.profile-menu li {
    margin-bottom: 10px;
}

.profile-menu a {
    display: block;
    padding: 10px 15px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s;
}

.profile-menu a:hover, 
.profile-menu li.active a {
    background: #f5f5f5;
    color: var(--primary-color);
}

/* 主内容区样式 */
.profile-main {
    flex: 1;
}

.profile-form {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.form-section {
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h2 i {
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.form-group label {
    width: 100px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group textarea {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.1);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-actions {
    text-align: right;
    margin-top: 30px;
}

.btn-save {
    padding: 12px 25px;
    background-color: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color); /* 添加边框 */
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    font-weight: 500; /* 加粗文字 */
}
.btn-save:hover {
    background-color: var(--primary-color-dark);
    border-color: var(--primary-color-dark); /* 悬停时边框颜色同步变化 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); /* 添加轻微阴影提升层次感 */
    transform: translateY(-1px); /* 轻微上浮效果 */
}
.btn-save:active {
    transform: translateY(0); /* 点击时取消上浮 */
}
/* 添加到profile.css */
#messageContainer {
    position: fixed;
    top: 210px;
    left: 50%;          /* 水平居中关键属性 */
    transform: translateX(-50%); /* 水平居中关键属性 */
    z-index: 1000;
    max-width: 400px;
    width: auto;        /* 确保宽度自适应内容 */
    text-align: center; /* 文字居中 */
}
/* 消息提示样式 */
.message {
    padding: 15px 20px;
    margin-bottom: 15px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 1;
    transition: opacity 0.5s ease, transform 0.3s ease;
    transform: translateY(0);
    display: flex;
    align-items: center;
}
.message.loading {
    background: #f8f9fa;
    color: #495057;
    border-left: 4px solid #adb5bd;
}

.message.success {
    background: #fff;
    color: #2b8a3e;
    border-left: 4px solid #2b8a3e;
}

.message.error {
    background: #fff;
    color: #c92a2a;
    border-left: 4px solid #c92a2a;
}
.message i {
    margin-right: 10px;
    font-size: 1.2em;
}
.message.info {
    background-color: #f0f0f0;
    color: #666;
    border: 1px solid #d9d9d9;
}

/* 内容区域样式 */
.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}
/* 加载动画样式 */
.icon-spinner {
    display: inline-block;
    animation: spin 1s infinite linear;
    margin-right: 5px;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading {
    opacity: 0.7;
    pointer-events: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .profile-content {
        flex-direction: column;
    }
    
    .profile-sidebar {
        width: 100%;
        margin-bottom: 30px;
    }
    
    .form-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .form-group label {
        width: 100%;
        margin-bottom: 8px;
    }
}