/* 用户中心新布局样式 */

/* 顶部栏 */
.user-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.user-header-content {
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left .app-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.header-center .page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.header-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.header-icon-btn:hover {
    background: var(--primary-color);
    color: white;
}

.avatar-tiny {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

/* PC端：导航栏容器（放在TOP下面） */
.user-nav-container {
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
}

/* 主布局 - PC端不再需要flex布局来容纳左侧导航 */
.user-center-layout {
    display: block;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 80px);
    position: relative;
}

/* PC端：横向导航栏（放在TOP下面） */
.user-sidebar-nav {
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    width: 100%;
    max-width: 100%;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    z-index: 10;
    border: none;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    margin-bottom: 1.5rem;
    /* 隐藏滚动条但保持滚动功能 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 和 Edge */
}

/* PC端和移动端：统一使用抽屉式侧边栏 */
@media (min-width: 1025px) {
    .user-sidebar-nav {
        position: fixed;
        top: 0;
        right: 0;
        left: auto;
        width: min(280px, calc(100vw - 48px));
        max-width: 280px;
        height: 100vh;
        margin: 0;
        padding: 0.75rem 1rem;
        transform: translateX(110%);
        border-radius: 0;
        box-shadow: none;
        overflow-y: auto;
        overflow-x: hidden;
        background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
        z-index: 999;
        transition: transform 0.35s ease, box-shadow 0.35s ease;
    }

    .user-sidebar-nav::-webkit-scrollbar {
        display: none;
    }

    /* PC端：hover时展开 */
    .user-sidebar-nav.pc-hover-show {
        transform: translateX(0) !important;
        box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16) !important;
        border-radius: 1.5rem 0 0 1.5rem !important;
    }

    /* PC端：菜单垂直排列 */
    .user-sidebar-nav .sidebar-menu {
        flex-direction: column;
        gap: 0.4rem;
        padding: 0 0.5rem 1.5rem;
        align-items: flex-start;
    }

    /* PC端：导航链接样式 */
    .user-sidebar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 0.75rem;
        margin: 0;
        white-space: nowrap;
        width: 100%;
        justify-content: flex-start;
        text-align: left;
    }

    /* PC端：显示关闭按钮 */
    .user-sidebar-nav .user-sidebar-drawer-header {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        padding: 1rem 0.75rem 0.75rem;
    }

    /* PC端：hover时显示遮罩层 */
    .user-sidebar-overlay.pc-hover-show {
        display: block !important;
        opacity: 0.45 !important;
        pointer-events: auto !important;
    }
}

/* 隐藏横向导航栏的关闭按钮（PC端不需要） */
.user-sidebar-drawer-header {
    display: none;
}

/* Chrome, Safari, Opera - 隐藏滚动条 */
.user-sidebar-nav::-webkit-scrollbar {
    display: none;
}

.user-sidebar-drawer-header {
    display: none;
}

.sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.18);
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.sidebar-close-btn span {
    position: absolute;
    width: 16px;
    height: 2px;
    background: currentColor;
    border-radius: 999px;
    transition: transform 0.3s ease;
}

.sidebar-close-btn span:first-child {
    transform: rotate(45deg);
}

.sidebar-close-btn span:last-child {
    transform: rotate(-45deg);
}

.sidebar-close-btn:hover {
    background: var(--primary-color);
    color: #ffffff;
}

.user-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: none;
}

.user-sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* 默认：横向菜单（仅在小屏幕或特定情况下显示） */
.sidebar-menu {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}

/* PC端：横向导航链接 */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
    font-size: 0.875rem;
    border: none;
    margin: 0;
    border-radius: 0.625rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-link:hover {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.08) 0%, rgba(249, 115, 22, 0.12) 100%);
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.15);
    transform: translateY(-2px);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15) 0%, rgba(249, 115, 22, 0.2) 100%);
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

.nav-link.active::before {
    display: none;
}

.nav-icon {
    flex-shrink: 0;
    stroke: currentColor;
}

.nav-badge {
    margin-left: 0.25rem;
    background: #ef4444;
    color: white;
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-weight: 600;
}

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 1.5rem;
}

/* 主内容区 - PC端不再需要左侧边距 */
.user-main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-left: 0;
    padding-left: 0;
    width: 100%;
    flex: 1;
}

/* 永久会员横幅 */
.membership-banner {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 1rem;
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-md);
}

.banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.banner-left h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    display: inline-block;
}

.banner-tag {
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    margin-left: 0.75rem;
    font-weight: 600;
}

.banner-features {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.feature-tag {
    padding: 0.375rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
}

.tag-green {
    background: #10b981;
}

.tag-blue {
    background: #3b82f6;
}

.tag-red {
    background: #ef4444;
}

.banner-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.banner-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 仪表板卡片 */
.dashboard-card {
    background: var(--bg-primary);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 每日打卡 */
.checkin-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.checkin-left,
.checkin-right {
    text-align: center;
}

.checkin-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.checkin-days {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.checkin-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

.checkin-week {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.week-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.week-days {
    display: flex;
    justify-content: space-between;
}

.week-days span {
    font-size: 0.875rem;
    color: var(--text-secondary);
    position: relative;
    padding: 0.5rem;
}

.week-days span::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bg-tertiary);
}

/* 学习统计 */
.stats-card .card-header {
    margin-bottom: 1rem;
}

.stats-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: var(--bg-tertiary);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.stats-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.stat-box {
    text-align: center;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* 快速卡片 */
.quick-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.quick-card {
    background: var(--bg-primary);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    text-align: center;
}

.quick-card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.quick-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.quick-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.review-count {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* 我的课程 */
.courses-card {
    min-height: 300px;
}

.store-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.3s;
}

.store-link:hover {
    color: var(--primary-dark);
}

.course-filter-bar,
.filter-primary,
.filter-tab,
.filter-secondary,
.filter-chip,
.filter-meta,
.filter-meta-icon,
.course-grid,
.course-card,
.course-cover,
.course-badge,
.course-badge--purple,
.course-badge--orange,
.course-body,
.course-title,
.course-meta,
.course-author,
.course-stat {
    /* 课程包列表样式移至 user-kcb.css */
}

/* 右侧小工具 */
.user-widgets {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 100px;
    height: fit-content;
    align-self: start;
    width: 320px;
    flex-shrink: 0;
}

.widget-card {
    background: var(--bg-primary);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.widget-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.heatmap-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.nav-arrow {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    transition: color 0.3s;
}

.nav-arrow:hover {
    color: var(--primary-color);
}

/* 热力图日历 */
.heatmap-calendar {
    margin-top: 1rem;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.heatmap-day {
    aspect-ratio: 1;
    background: var(--bg-tertiary);
    border-radius: 0.25rem;
}

/* 最近学习列表 */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recent-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.recent-thumb {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.recent-info {
    flex: 1;
}

.recent-course {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.recent-lesson {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 0.25rem 0;
}

.recent-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
}

.view-more-btn {
    display: block;
    text-align: center;
    margin-top: 1rem;
    padding: 0.75rem;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
    transition: color 0.3s;
}

.view-more-btn:hover {
    color: var(--primary-dark);
}

/* 复习卡片 */
.review-widget {
    text-align: center;
}

.review-content {
    padding: 2rem 1rem;
}

.review-icon {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-family: monospace;
}

.review-content p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem 0;
}

.coming-soon-tag {
    display: inline-block;
    background: #f59e0b;
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .user-widgets {
        width: 280px;
    }
}

/* 移动端：恢复为左侧抽屉式导航 */
@media (max-width: 968px) {
    /* 移动端：导航栏容器不显示横向导航，但保留元素以便JavaScript控制 */
    .user-nav-container {
        display: block;
        position: relative;
        padding: 0;
    }
    
    .user-center-layout {
        padding: 1.5rem 1rem 3rem;
    }

    .user-sidebar-overlay {
        display: block;
    }

    /* 移动端：从右侧展开的导航栏 */
    .user-sidebar-nav {
        position: fixed;
        top: 0;
        right: 0;
        left: auto;
        width: min(240px, calc(100vw - 48px));
        max-width: 240px;
        height: 100vh;
        margin: 0;
        padding: 0.75rem 1rem;
        transform: translateX(110%);
        border-radius: 0;
        box-shadow: none;
        overflow-y: auto;
        overflow-x: hidden;
        background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
        z-index: 999;
        /* 隐藏滚动条但保持滚动功能 */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE 和 Edge */
    }
    
    /* Chrome, Safari, Opera - 隐藏滚动条 */
    .user-sidebar-nav::-webkit-scrollbar {
        display: none;
    }
    
    .user-sidebar-nav.show {
        transform: translateX(0);
        box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
        border-radius: 1.5rem 0 0 1.5rem;
    }
    
    .user-sidebar-drawer-header {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        padding: 1rem 0.75rem 0.75rem;
    }
    
    .user-main-content {
        margin-left: 0;
        padding-left: 0;
        width: 100%;
    }
    
    .user-widgets {
        position: static;
        width: 100%;
        order: -1;
    }

    /* 移动端：横向菜单，居右对齐 */
    .sidebar-menu {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
        padding: 0 0.5rem 1.5rem;
        align-items: flex-end;
    }

    /* 移动端：导航链接样式，居右对齐 */
    .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 0.75rem;
        margin: 0;
        white-space: nowrap;
        width: 100%;
        justify-content: flex-end;
        text-align: right;
    }
    
    .nav-link:hover {
        transform: translateX(-2px);
    }

    .nav-link.active::before {
        display: none;
    }
    
    .nav-badge {
        margin-left: 0.5rem;
        margin-right: 0;
    }
    
    /* 移动端：图标和文字顺序调整 */
    .nav-link .nav-icon {
        order: 2;
        margin-left: 0.5rem;
        margin-right: 0;
    }
    
    .nav-link span:not(.nav-badge) {
        order: 1;
    }

    .checkin-content,
    .stats-content,
    .quick-cards {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    body.user-sidebar-open {
        overflow: hidden;
    }
}

@media (max-width: 768px) {
    .user-header-content {
        padding: 0 1rem;
    }

    .header-center {
        display: none;
    }

    .user-center-layout {
        padding: 1rem;
    }

    .banner-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .banner-features {
        flex-direction: column;
        width: 100%;
    }

    .feature-tag {
        width: 100%;
        text-align: center;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}