/**
 * 用户侧边栏样式 - 可在多个页面复用
 */

/* 三栏布局容器 */
.page-container-with-sidebar {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    gap: 20px;
    padding: 20px;
}

/* 左侧用户信息侧边栏 */
.left-sidebar {
    width: 320px;
    flex-shrink: 0;
}

.user-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    text-align: center;
}

.user-card-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 10px;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.user-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-card-avatar i {
    font-size: 30px;
    color: #999;
}

.user-card-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
}

.user-card-username {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
}

.user-card-stats {
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    margin: 10px 0;
}

.user-stat-item {
    text-align: center;
}

.user-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #4a9ff5;
}

.user-stat-label {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.user-card-actions {
    margin-top: 10px;
}

.user-card-actions .btn {
    font-size: 12px;
    padding: 6px 12px;
}

/* 今日统计 */
.today-stats {
    margin: 10px 0;
    padding: 10px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 8px;
}

.stats-title {
    font-size: 12px;
    font-weight: 600;
    color: #1976d2;
    margin-bottom: 8px;
    text-align: left;
}

.stats-row {
    display: flex;
    justify-content: space-around;
}

.stat-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.stat-mini i {
    font-size: 16px;
    color: #1976d2;
}

.stat-mini span {
    font-size: 16px;
    font-weight: 700;
    color: #1565c0;
}

.stat-mini small {
    font-size: 10px;
    color: #666;
}

/* 最近活动区域 */
.recent-section {
    margin: 10px 0;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    text-align: left;
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.recent-list {
    max-height: 100px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 隐藏滚动条但保持可滚动 */
.recent-list::-webkit-scrollbar {
    width: 4px;
}

.recent-list::-webkit-scrollbar-track {
    background: transparent;
}

.recent-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.recent-list::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

.recent-item {
    padding: 6px 8px;
    margin-bottom: 4px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
}

.recent-item:hover {
    background: #e3f2fd;
    transform: translateX(2px);
}

.recent-item-title {
    color: #333;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}

.recent-item-time {
    color: #999;
    font-size: 10px;
}

.empty-hint {
    text-align: center;
    color: #999;
    font-size: 11px;
    padding: 15px 0;
}

/* 学习日历 */
.study-calendar {
    margin: 10px 0;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    text-align: left;
}

/* 学习统计 */
.study-stats {
    margin: 10px 0;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    margin: 8px 0;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%; /* 确保不超出容器 */
}

.stats-grid .stat-item {
    text-align: center;
    padding: 6px 2px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 6px;
    box-sizing: border-box;
    min-width: 0; /* 防止内容溢出 */
    overflow: hidden;
    width: 100%; /* 确保项目不超出网格 */
}

.stats-grid .stat-value {
    font-size: 14px;
    font-weight: 700;
    color: #4a9ff5;
    margin-bottom: 2px;
}

.stats-grid .stat-label {
    font-size: 9px;
    color: #666;
}

.study-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.study-actions .btn {
    font-size: 10px;
    padding: 4px 8px;
    flex: 1;
}

/* 活动日历 */
.activity-calendar {
    margin: 10px 0;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    text-align: left;
}

.calendar-container {
    margin-top: 8px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.calendar-month {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.calendar-nav {
    background: none;
    border: none;
    color: #4a9ff5;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 14px;
}

.calendar-nav:hover {
    background: #e3f2fd;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}

.calendar-weekdays > div {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: #666;
    padding: 4px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.calendar-day:hover {
    background: #f0f0f0;
}

.calendar-day.other-month {
    color: #ccc;
}

.calendar-day.today {
    background: #4a9ff5;
    color: white;
    font-weight: 700;
}

.calendar-day.has-create {
    background: #c8e6c9;
    color: #2e7d32;
    font-weight: 600;
}

.calendar-day.has-edit {
    background: #fff9c4;
    color: #f57f17;
    font-weight: 600;
}

.calendar-day.has-both {
    background: linear-gradient(135deg, #c8e6c9 50%, #fff9c4 50%);
    color: #333;
    font-weight: 700;
}

.calendar-legend {
    display: flex;
    justify-content: space-around;
    margin-top: 8px;
    font-size: 10px;
    color: #666;
}

.calendar-legend span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.calendar-legend i {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

.legend-create {
    background: #c8e6c9;
}

.legend-edit {
    background: #fff9c4;
}

.legend-both {
    background: linear-gradient(135deg, #c8e6c9 50%, #fff9c4 50%);
}

/* 学习日历图例 */
.legend-today {
    background: #4a9ff5;
}

.legend-study {
    background: #c8e6c9;
}

.legend-empty {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

/* 学习日历特殊样式 */
.calendar-day.has-study {
    background: #c8e6c9;
    color: #2e7d32;
    font-weight: 600;
}

.calendar-day.has-study::after {
    content: '';
    position: absolute;
    bottom: 1px;
    width: 3px;
    height: 3px;
    background: #2e7d32;
    border-radius: 50%;
}

/* 主内容区 */
.main-content-with-sidebar {
    flex: 1;
    min-width: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .page-container-with-sidebar {
        flex-direction: column;
    }
    
    .left-sidebar {
        width: 100%;
    }
    
    .user-card {
        position: static;
    }
}
