/* 个人中心页面样式 */
.profile-container {
    display: flex;
    flex-direction: row; /* Default to row (desktop-first for layout) */
    flex-wrap: nowrap;   
    padding: 30px;
    background-color: var(--light-bg);
    min-height: calc(100vh - 200px); /* 调整高度以填满页面 */
    justify-content: flex-start; /* 左对齐 */
    align-items: flex-start; /* 从顶部开始对齐 */
    margin: 45px auto 55px; /* 增加底部边距，避免与底部红色区域紧贴 */
    max-width: 100%; /* 修改为100%，不限制最大宽度 */
    position: relative; /* 确保定位正确 */
    width: 100%; /* 确保容器占满可用空间 */
    background-image: none; /* 移除可能的背景图片 */
}

/* 响应式布局 */
@media (max-width: 768px) {
    .profile-container {
        flex-direction: column;
        padding: 15px;
        margin: 10px 10px 30px; /* 增加底部边距 */
        min-height: auto;
    }
    
    .profile-sidebar {
        width: 100%;
        flex-basis: auto; /* 确保在移动端时，width:100%可以生效 */
        margin-right: 0;
        margin-left: 0; /* 移动端不需要左边距 */
        margin-bottom: 20px;
        position: relative;
        top: 0;
        border-left: none;
        border-top: 3px solid var(--theme-primary);
    }
    
    .profile-content {
        width: 100%;
        min-height: 400px;
        margin-bottom: 30px; /* 增加底部边距 */
    }
}

/* 侧边栏样式 */
.profile-sidebar {
    flex: 0 0 300px; /* 不伸展、不收缩、基础宽度300px */
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 25px;
    margin-right: 40px; /* 增加右侧边距 */
    /* position: sticky; */ /* Temporarily removed for diagnosis */
    /* top: 30px; */ /* Temporarily removed for diagnosis */
    align-self: flex-start;
    height: fit-content;
    border-left: 3px solid var(--theme-primary);
    margin-left: 10px; /* 向左移动一些 */
}

.user-info {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.user-avatar {
    width: 80px;
    height: 80px;
    background-color: var(--theme-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    margin: 0 auto 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-size: cover;
    background-position: center;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.user-info h2 {
    font-size: 18px;
    color: var(--dark-text);
    margin-bottom: 5px;
}

.user-info p {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

/* 用户统计信息 */
.user-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #eee;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: var(--theme-primary);
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

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

.profile-menu li {
    margin-bottom: 10px;
    border-radius: 4px;
    transition: all 0.3s;
}

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

.profile-menu li.active {
    background-color: #f0f0f0;
}

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

.profile-menu li.active a::before {
    content: '▶';
    font-size: 10px;
    margin-right: 8px;
    color: var(--theme-primary);
}

#logout-btn {
    cursor: pointer;
    padding: 12px 15px;
    color: #d32f2f;
    border-radius: 4px;
    transition: all 0.3s;
    font-weight: 500;
    margin-top: 20px;
    border-top: 1px dashed #eee;
    padding-top: 15px;
}

#logout-btn:hover {
    background-color: #ffebee;
}

#logout-btn::before {
    content: '⟲';
    margin-right: 8px;
    font-size: 12px;
}

/* 内容区域样式 */

.history-scroll-wrapper {
    max-height: 600px; /* 可滚动区域的最大高度 */
    overflow-y: auto; /* 垂直方向可滚动 */
    overflow-x: hidden; /* 水平方向不可滚动，防止页面出现水平滚动条 */
    padding-right: 15px; /* 为滚动条添加一些内边距 */
    border: 1px solid #eee; /* 添加边框以区分 */
    border-radius: 8px; /* 圆角与其他元素保持一致 */
    margin-bottom: 20px; /* 与其他元素保持间距 */
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); /* 内阴影增加立体感 */
    scrollbar-width: thin; /* Firefox滚动条样式 */
    scrollbar-color: #ddd #f5f5f5; /* Firefox滚动条颜色 */
    position: relative; /* 确保定位正确 */
    width: 100%; /* 确保容器占满可用空间 */
    box-sizing: border-box; /* 确保内边距不会增加元素总宽度 */
}

.profile-content {
    flex: 1 1 auto; /* 允许伸展、允许收缩、基础宽度自动 */
    min-width: 0; /* 确保内容区可以正确缩小，与flex:1 1 auto配合 */
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 25px;
    position: relative;
    transition: all 0.3s ease;
    overflow: visible; /* 允许内容溢出显示 */
    width: 100%; /* 确保内容区域占满可用空间 */
    min-height: 600px; /* 设置最小高度 */
    display: flex;
    flex-direction: column;
    margin-bottom: 5px; /* 增加底部边距，避免与底部红色区域紧贴 （详情页面与下方底栏的距离）*/
    /* position: static;  (Removed to test flexbox layout) */
}

.content-section {
    display: none;
    height: 100%;
}

.content-section.active {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.section-title {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title h3 {
    color: var(--theme-primary);
    font-size: 20px;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-select {
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    font-size: 14px;
    color: #555;
    cursor: pointer;
    box-sizing: border-box;
    min-width: 120px;
    height: 36px;
    display: inline-block;
    vertical-align: middle;
}

.section-actions .btn,
.section-actions .sort-select {
    height: 36px;
    vertical-align: middle;
}

/* 表单样式 */
.settings-form {
    /* 表单容器：居中布局，半透明背景增加层次感 */
    width: 100%;
    margin: 5px 0;
    padding: 25px;
    background-color: rgba(249, 245, 234, 0.5); /* 半透明背景与主题色协调 */
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* 柔和阴影提升立体感 */
    flex: 1;
    display: flex;
    flex-direction: column; /* 垂直弹性布局方便表单项排列 */
    box-sizing: border-box; /* 确保padding不会增加元素总宽度 */
}

.form-group {
    /* 表单项组：控制垂直间距 */
    margin-bottom: 20px; /* 20px间距保证表单项呼吸感 */
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-control {
    /* 输入框统一样式 */
    width: 100%;      /* 填满容器宽度 */
    padding: 10px;    /* 舒适的内边距 */
    border: 1px solid #ddd; /* 浅灰色边框 */
    border-radius: 4px;
    font-size: 14px;  /* 与整体字体比例协调 */
}

textarea.form-control {
    resize: vertical;
    min-height: 70px;
}

.avatar-settings {
    /* 头像设置区域：弹性布局适应不同设备 */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;  /* 与上方内容保持间距 */
    flex-wrap: wrap;   /* 换行显示备选头像 */
}

.current-avatar {
    width: 80px;
    height: 80px;
    background-color: var(--theme-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    margin: 0 auto 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    background-size: cover;
    background-position: center;
}

.avatar-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.primary-btn {
    /* 主按钮：使用品牌红色增强视觉焦点 */
    background-color: var(--theme-primary);
    color: white;
}

.primary-btn:hover {
    background-color: #c62828;
}

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

/* 历史记录样式 */
.history-container {
    margin-top: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box; /* 确保内边距不会增加元素总宽度 */
}

/* 自定义滚动条样式 - 适用于Chrome, Safari等浏览器 */
.history-scroll-wrapper::-webkit-scrollbar {
    width: 8px; /* 滚动条宽度 */
}

.history-scroll-wrapper::-webkit-scrollbar-track {
    background: #f5f5f5; /* 滚动条轨道背景色 */
    border-radius: 4px; /* 轨道圆角 */
}

.history-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #ddd; /* 滚动条滑块颜色 */
    border-radius: 4px; /* 滑块圆角 */
}

.history-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #ccc; /* 鼠标悬停时滑块颜色 */
}

.history-item {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid #eee;
    transition: all 0.3s ease;
    margin-bottom: 5px; /* 增加项目间距 */
    border-radius: 6px; /* 添加圆角 */
}

.history-item:hover {
    background-color: #f9f9f9;
    transform: translateY(-2px); /* 悬停时轻微上移 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* 悬停时添加阴影 */
}

.history-image {
    width: 100px; /* 增加图片宽度 */
    height: 75px; /* 增加图片高度 */
    background-size: cover;
    background-position: center;
    border-radius: 6px; /* 增加圆角与整体风格一致 */
    margin-right: 15px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 添加轻微阴影增加立体感 */
    transition: all 0.3s ease; /* 添加过渡效果 */
}

.history-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.history-info h4 {
    margin: 0 0 8px;
    font-size: 16px;
    color: var(--dark-text);
    font-weight: 500;
    /* 文本溢出处理 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.history-date {
    color: #999;
    font-weight: 500;
    background-color: #f5f5f5;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
}

/* 收藏项目样式 */
.favorites-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
    width: 100%;
    box-sizing: border-box; /* 确保内边距不会增加元素总宽度 */
}

.favorite-item {
    display: flex;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.favorite-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* 多选模式样式 */
.favorite-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    padding: 3px;
    display: none;
}

.favorite-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.multi-select-mode {
    border: 1px solid #ddd;
    padding-left: 40px;
}

.multi-select-mode.selected {
    border: 2px solid #e74c3c;
    padding-left: 40px;
}

/* 多选操作栏 */
.multi-select-actions {
    display: none;
    align-items: center;
    background-color: #f8f8f8;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.multi-select-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.multi-select-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.multi-select-actions button.active {
    opacity: 1;
}

.multi-select-actions .primary-btn {
    background-color: var(--theme-primary);
    color: white;
}

.multi-select-actions .primary-btn:hover:not(:disabled) {
    background-color: #a82828;
}

.selected-count {
    margin-left: auto;
    font-size: 14px;
    color: #666;
}

/* 禁用按钮样式 */
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background-color: #cccccc !important;
    box-shadow: none !important;
    border: 1px solid #bbbbbb;
    color: #666666 !important;
}

.multi-select-actions .btn {
    margin-right: 8px;
    padding: 8px 16px;
    font-size: 14px;
    white-space: nowrap;
    min-width: auto;
}

/* 统一按钮样式 */
.section-actions button, .section-actions select {
    padding: 8px 16px;
    font-size: 14px;
    box-sizing: border-box;
    height: 36px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .multi-select-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .multi-select-actions .btn {
        margin-right: 0;
        flex: 1;
        min-width: 120px;
    }
    
    .section-actions {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .section-actions button, .section-actions select {
        flex: 1;
        min-width: 120px;
    }
    
    .favorites-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .favorite-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .favorite-actions button {
        flex: 1;
        min-width: 120px;
    }
}



.favorite-image {
    height: 150px;
    background-size: cover;
    background-position: center;
    background-color: #eee;
    position: relative;
    z-index: 1;
}

.favorite-item.multi-select-mode .favorite-image {
    margin-left: 0;
}

.favorite-info {
    padding: 15px;
}

.favorite-info h4 {
    margin-bottom: 8px;
    color: var(--dark-text);
}

.favorite-info p {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.favorite-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.favorite-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.view-btn {
    background-color: var(--theme-primary);
    color: white;
}

.view-btn:hover {
    background-color: #a82828;
}

.remove-btn {
    background-color: #f0f0f0;
    color: #666;
}

.remove-btn:hover {
    background-color: #e0e0e0;
}

/* 清除历史记录按钮样式 */
.history-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.clear-history-btn {
    background-color: #f0f0f0;
    color: #666;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.clear-history-btn:hover {
    background-color: #e0e0e0;
    color: #d32f2f;
}

.history-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px; /* 统一设置项目间距 */
    padding: 5px; /* 内边距，避免内容紧贴容器边缘 */
}

.loading {
    text-align: center;
    padding: 30px;
    color: #666;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
}

.no-favorites,
.no-history {
    text-align: center;
    padding: 40px 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* 关注和粉丝列表样式 */
.following-container,
.followers-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 0;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.user-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: var(--theme-primary);
}

.user-item .user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 16px;
    flex-shrink: 0;
}

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

.user-item .user-info {
    flex: 1;
    min-width: 0;
}

.user-item .user-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.user-item .user-bio {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-item .user-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.user-item .user-stats span {
    display: flex;
    align-items: center;
}

.user-item .follow-time {
    font-size: 12px;
    color: #999;
}

.user-item .user-actions {
    margin-left: 16px;
}

.user-item .follow-btn,
.user-item .unfollow-btn {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-item .follow-btn {
    background: var(--theme-primary);
    color: white;
}

.user-item .follow-btn:hover {
    background: #c41e3a;
    transform: scale(1.05);
}

.user-item .unfollow-btn {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.user-item .unfollow-btn:hover {
    background: #ff4757;
    color: white;
    border-color: #ff4757;
}

.following-count,
.followers-count {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.empty-state,
.error-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
    background: #f9f9f9;
    border-radius: 12px;
    margin: 20px 0;
}

.error-state {
    color: #ff4757;
    background: #fff5f5;
    border: 1px solid #ffebee;
}

/* 内联样式替换类 */
.cancel-btn-hidden {
    display: none;
}

.progress-bar-initial {
    width: 0%;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .user-item {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .user-item .user-avatar {
        margin-right: 0;
        margin-bottom: 12px;
    }
    
    .user-item .user-info {
        margin-bottom: 16px;
    }
    
    .user-item .user-stats {
        justify-content: center;
    }
    
    .user-item .user-actions {
        margin-left: 0;
    }
}

/* ==================== 球友注册表单样式 ==================== */
.section-desc {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
    font-weight: normal;
}

.footballer-form {
    background-color: rgba(249, 245, 234, 0.5);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

.form-group .required {
    color: #d32f2f;
    margin-left: 4px;
}

.footballer-form .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.footballer-form .form-control:focus {
    outline: none;
    border-color: #2e7d32;
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.1);
}

.footballer-form textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.footballer-submit-btn {
    background-color: #2e7d32 !important;
    color: white !important;
    padding: 10px 30px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.footballer-submit-btn:hover:not(:disabled) {
    background-color: #1b5e20 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}

.footballer-submit-btn:disabled {
    background-color: #ccc !important;
    cursor: not-allowed;
}

.cancel-btn {
    background-color: #f0f0f0;
    color: #666;
    border: 1px solid #ddd;
}

.cancel-btn:hover {
    background-color: #e0e0e0;
}

/* 错误消息样式 */
.error-message {
    background-color: #ffebee;
    color: #d32f2f;
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 14px;
    display: none;
    border: 1px solid #ffcdd2;
}

/* 成功消息样式 */
.success-message {
    text-align: center;
    padding: 40px;
    background-color: #e8f5e9;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid #c8e6c9;
}

.success-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.success-message h4 {
    color: #2e7d32;
    font-size: 20px;
    margin-bottom: 10px;
}

.success-message p {
    color: #555;
    font-size: 14px;
}

.success-message .btn {
    margin-top: 20px;
    background-color: #2e7d32;
    color: white;
}

.success-message .btn:hover {
    background-color: #1b5e20;
}

/* 球友注册表单响应式 */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .footballer-form {
        padding: 15px;
    }
    
    .form-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}