:root {
    /* 核心主题色 - 参考图片 */
    --primary-color: #6C5DD3; /* 鲜艳的紫 */
    --primary-light: #CFC8FF;
    --accent-orange: #FFCECE; /* 柔和粉橙 */
    --accent-blue: #C3F0FA;   /* 柔和蓝 */
    --accent-purple: #D6C4F7; /* 柔和紫 */
    --accent-pink: #FAD2E1;   /* 柔和粉 */
    
    /* 背景色 */
    --bg-body: #F7F7F9; /* 极淡的灰紫背景 */
    --bg-white: #FFFFFF;
    
    /* 文本色 */
    --text-main: #11142D;
    --text-gray: #808191;
    
    /* 圆角 */
    --radius-l: 24px;
    --radius-m: 16px;
    --radius-s: 12px;
    
    /* 阴影 */
    --shadow-soft: 0 10px 40px rgba(29, 22, 23, 0.03);
    --shadow-hover: 0 16px 40px rgba(29, 22, 23, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden; /* 防止整个页面滚动，只滚动主内容区 */
}

/* 布局容器 */
.dashboard-container {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* ================== 侧边栏 ================== */
.sidebar {
    width: 260px;
    background: var(--bg-white);
    height: 100%;
    padding: 32px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0,0,0,0.02);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 50px;
    color: var(--text-main);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text-gray);
    border-radius: var(--radius-s);
    transition: all 0.3s;
    font-weight: 500;
    font-size: 15px;
}

.nav-item:hover, .nav-item.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 8px 16px rgba(108, 93, 211, 0.2);
}

.nav-item i {
    font-size: 20px;
}

.sidebar-footer {
    margin-top: auto;
}

.upgrade-card {
    background: var(--bg-body);
    padding: 20px;
    border-radius: var(--radius-m);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.upgrade-card i {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: block;
}

.upgrade-card p {
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 15px;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upgrade-card button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-s);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.3s;
}

.upgrade-card button:hover {
    opacity: 0.9;
}

/* ================== 主内容区 ================== */
.main-content {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
    position: relative;
}

/* 顶部栏 */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.search-bar {
    background: var(--bg-white);
    width: 400px;
    height: 50px;
    border-radius: var(--radius-s);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    color: var(--text-gray);
    position: relative;
}

.search-bar input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 14px;
    color: var(--text-main);
    background: transparent;
}

.search-results {
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 100;
    padding: 10px;
}

.search-results.hidden {
    display: none;
}

.result-item {
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}
.result-item:hover { background: var(--bg-body); }

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-gray);
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    color: var(--primary-color);
    background: #EBE9F5;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #C4D2E5; /* 占位色 */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* 欢迎 Banner */
.hero-banner {
    background: linear-gradient(135deg, #6C5DD3 0%, #8E7CFF 100%);
    border-radius: var(--radius-l);
    padding: 40px 60px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(108, 93, 211, 0.2);
}

.hero-banner::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    top: -50px;
    right: -50px;
}

.hero-text {
    max-width: 500px;
    z-index: 1;
}

.hero-text h1 {
    font-size: 32px;
    margin-bottom: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.hero-text p {
    font-size: 15px;
    opacity: 0.9;
    margin-bottom: 24px;
    line-height: 1.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-btn {
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-s);
    font-weight: 600;
    cursor: pointer;
    font-size: 15px;
    transition: transform 0.2s;
}

.hero-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.hero-image {
    position: relative;
    z-index: 1;
    animation: float 6s infinite ease-in-out;
}

@keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

/* 核心板块 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.view-all {
    color: var(--text-gray);
    font-size: 14px;
    text-decoration: none;
    font-weight: 500;
}
.view-all:hover { color: var(--primary-color); }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

/* 新版卡片样式 */
.course-card {
    background: var(--bg-white);
    border-radius: var(--radius-l);
    padding: 24px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    position: relative;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(108, 93, 211, 0.1);
}

.card-image-bg {
    width: 100%;
    height: 140px;
    border-radius: var(--radius-m);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin-bottom: 20px;
    color: white;
    position: relative;
    background-size: cover;
    background-position: center;
}

/* 背景图片优化：使用预加载和懒加载 */
.bg-purple { 
    background-image: url('课程教材背景.png'); 
    box-shadow: 0 10px 20px rgba(108, 93, 211, 0.2);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.bg-orange { 
    background-image: url('知识图解背景.png'); 
    box-shadow: 0 10px 20px rgba(254, 148, 150, 0.2);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.bg-blue { 
    background-image: url('交互实验背景.png'); 
    box-shadow: 0 10px 20px rgba(80, 155, 245, 0.2);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.bg-pink { 
    background-image: url('期末检测背景.png'); 
    box-shadow: 0 10px 20px rgba(255, 143, 163, 0.2);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.card-info h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-main);
}

.subtitle {
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 20px;
    min-height: 20px;
}

.grade-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.tag {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--bg-body);
    color: var(--text-gray);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.tag:hover {
    background: var(--primary-color);
    color: white;
}

.card-action {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    transition: all 0.2s;
}

.course-card:hover .card-action {
    background: var(--primary-color);
    color: white;
}

/* 响应式适配 */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 20px 10px;
    }
    .sidebar-nav span, .logo span, .upgrade-card, .sidebar-nav i {
        display: none;
    }
    .sidebar-nav i {
        display: block;
        font-size: 24px;
        margin: 0;
    }
    .nav-item {
        justify-content: center;
        padding: 14px 0;
    }
    .logo { justify-content: center; margin-bottom: 30px; }
    
    .hero-image { display: none; }
    .hero-banner { text-align: center; justify-content: center; }
}

@media (max-width: 768px) {
    .dashboard-container { flex-direction: column; height: auto; overflow: auto; }
    .sidebar { width: 100%; height: auto; flex-direction: row; justify-content: space-between; align-items: center; padding: 10px 20px; border-bottom: 1px solid #eee; border-right: none; }
    .sidebar-nav { flex-direction: row; flex: unset; }
    .logo { margin-bottom: 0; }
    .nav-item { padding: 10px; }
    .nav-item i { display: block; }
    
    .main-content { padding: 20px; overflow: unset; }
    .cards-grid { grid-template-columns: 1fr; }
    
    .top-header { flex-direction: column; gap: 20px; }
    .search-bar { width: 100%; }
    .header-right { width: 100%; justify-content: space-between; }
}

/* ================== 登录页面样式 ================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(247, 247, 249, 0.95);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* 显示登录层 */
.login-overlay.active {
    opacity: 1;
    visibility: visible;
}

.login-card {
    background: white;
    width: 400px;
    padding: 40px;
    border-radius: var(--radius-l);
    box-shadow: 0 20px 60px rgba(108, 93, 211, 0.15);
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.login-overlay.active .login-card {
    transform: translateY(0);
}

.login-header {
    margin-bottom: 30px;
}

.login-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 20px;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.login-header p {
    color: var(--text-gray);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 16px;
    color: var(--text-gray);
    font-size: 18px;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    border: 2px solid #F0F0F3;
    border-radius: var(--radius-s);
    font-size: 14px;
    transition: all 0.3s;
    outline: none;
    background: #F7F7F9;
}

.input-wrapper input:focus {
    border-color: var(--primary-color);
    background: white;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-s);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.login-btn:hover {
    background: #5b4cc4;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(108, 93, 211, 0.2);
}