/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* 顶部导航栏 */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar .container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar .logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.navbar .nav-links {
    display: flex;
    gap: 2rem;
}

.navbar .nav-links a {
    color: white;
    transition: opacity 0.3s;
}

.navbar .nav-links a:hover {
    opacity: 0.8;
}

.navbar .user-info {
    color: white;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 2rem;
    margin-bottom: 2rem;
}

.card-header {
    border-bottom: 2px solid #667eea;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    color: #667eea;
}

.card-header h3 {
    color: #667eea;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table th,
table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background-color: #667eea;
    color: white;
    font-weight: 600;
}

table tr:hover {
    background-color: #f8f9fa;
}

/* 登录页面 */
.login-container {
    max-width: 400px;
    margin: 5rem auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.login-container h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 2rem;
}

/* 学生端首页 */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.dashboard-card:hover {
    transform: translateY(-5px);
}

.dashboard-card .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.dashboard-card h3 {
    color: #667eea;
    margin-bottom: 1rem;
}

.dashboard-card p {
    color: #666;
    margin-bottom: 1.5rem;
}

/* 单词卡片 */
.word-card {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.word-card .word {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.word-card .pronunciation {
    font-family: 'Courier New', monospace;
    color: #999;
    margin-bottom: 1rem;
}

.word-card .meaning {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.word-card .example {
    color: #666;
    font-style: italic;
}

/* 闯关游戏界面 */
.quiz-container {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.question-number {
    font-size: 0.9rem;
    color: #999;
    margin-bottom: 0.5rem;
}

.question-text {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.option:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

.option.selected {
    border-color: #667eea;
    background: #e8ebff;
}

.option.correct {
    border-color: #28a745;
    background: #d4edda;
}

.option.wrong {
    border-color: #dc3545;
    background: #f8d7da;
}

/* 排行榜 */
.leaderboard-table {
    margin-top: 1.5rem;
}

.rank {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 50%;
    background: #667eea;
    color: white;
    font-weight: bold;
}

.rank-1 {
    background: #ffd700;
}

.rank-2 {
    background: #c0c0c0;
}

.rank-3 {
    background: #cd7f32;
}

/* 提示消息 */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-card .number {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.stat-card .label {
    color: #666;
    margin-top: 0.5rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .navbar .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 0.5rem;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 180px;
    }

    .chart-modal-content {
        width: 95%;
        margin: 2% auto;
    }

    .chart-modal-body {
        padding: 1rem;
    }

    .chart-modal-header h3 {
        font-size: 1.2rem;
    }
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

/* 标签 */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* 图表容器 */
.charts-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    margin-bottom: 0;
    cursor: pointer;
    transition: box-shadow 0.3s;
}

.chart-card:hover {
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.chart-container {
    position: relative;
    height: 180px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-container canvas {
    max-width: 100%;
    max-height: 100%;
}

.click-hint {
    font-size: 0.75rem;
    color: #999;
    font-weight: normal;
}

/* 模态框样式 */
.chart-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    animation: fadeIn 0.3s;
}

.chart-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    animation: slideDown 0.3s;
}

.chart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.chart-modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.chart-modal-body {
    padding: 2rem;
    max-height: calc(90vh - 100px);
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-modal-body canvas {
    max-width: 100%;
    max-height: 60vh;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.data-table {
    margin-top: 1rem;
}

.progress-text {
    display: block;
    text-align: center;
    font-size: 0.9rem;
    color: #667eea;
    font-weight: bold;
    margin-top: 0.25rem;
}

@media (max-width: 1024px) {
    .charts-row {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }

    .chart-modal-content {
        width: 95%;
        max-width: 800px;
    }
}


