/* =========================================================
   1. GLOBAL & DESKTOP STYLES (Default)
   ========================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif; }
body { background-color: #f5f7fa; color: #333; padding-bottom: 50px; }

/* Main Container: Centered on desktop */
.container { 
    max-width: 1000px; 
    margin: 0 auto; 
    padding: 0 20px; 
}

/* =========================================================
   2. LOGIN / REGISTER PAGE STYLES
   ========================================================= */
.auth-box { 
    background: white; 
    padding: 40px; 
    border-radius: 16px; 
    width: 400px; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.1); 
    text-align: center;
}

/* Role Switcher */
.role-switch { 
    display: flex; 
    background: #f5f5f5; 
    border-radius: 8px; 
    padding: 5px; 
    margin-bottom: 25px; 
}
.role-btn { 
    flex: 1; 
    padding: 10px; 
    font-size: 14px; 
    cursor: pointer; 
    border-radius: 6px; 
    color: #666; 
    transition: 0.3s; 
    text-align: center;
}
.active-student { background: white; color: #009688; box-shadow: 0 2px 5px rgba(0,0,0,0.05); font-weight: bold; }
.active-teacher { background: white; color: #1976d2; box-shadow: 0 2px 5px rgba(0,0,0,0.05); font-weight: bold; }
.active-admin   { background: white; color: #d32f2f; box-shadow: 0 2px 5px rgba(0,0,0,0.05); font-weight: bold; }

/* Inputs */
input[type="text"], input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: 0.3s;
    outline: none;
}
input:focus { border-color: #009688; box-shadow: 0 0 0 3px rgba(0,150,136,0.1); }

/* Buttons */
.btn {
    width: 100%;
    padding: 12px;
    background: #009688;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 10px;
}
.btn:hover { opacity: 0.9; transform: translateY(-2px); }

/* Links */
.link {
    display: block;
    margin-top: 20px;
    color: #009688;
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
}

.invite-code-group {
    background: #fff3e0;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px dashed #ffb74d;
    display: none; 
}

/* =========================================================
   3. DASHBOARD & GENERAL STYLES
   ========================================================= */
.brand-header { text-align: center; padding: 40px 0 30px; }
.brand-cn { font-size: 36px; font-weight: 800; color: #004d40; letter-spacing: 2px; }
.brand-en { font-size: 13px; color: #888; text-transform: uppercase; letter-spacing: 3px; margin-top: 8px; }

.card { background: white; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); margin-bottom: 30px; overflow: hidden; }

/* User Profile Bar (Desktop) */
.user-bar { 
    display: flex; 
    align-items: center; 
    padding: 25px 40px; 
    border-left: 6px solid #009688; 
    cursor: pointer; 
    transition: background 0.2s; 
    flex-direction: row; 
}
.user-bar:hover { background-color: #fafafa; }
.avatar { width: 80px; height: 80px; border-radius: 50%; border: 4px solid #e0f2f1; object-fit: cover; margin-right: 25px; }
.user-details { flex-grow: 1; text-align: left; }
.username { font-size: 22px; font-weight: bold; margin-bottom: 5px; }
.user-stats { display: flex; gap: 40px; text-align: center; }
.stat-item h4 { font-size: 24px; margin: 0; color: #333; }
.stat-item span { font-size: 12px; color: #999; text-transform: uppercase; }

.male { color: #2196F3 !important; }    
.female { color: #E91E63 !important; } 
.secret { color: #333 !important; }    

/* Exam Modes Grid */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; margin-bottom: 40px; }
.mode-card { 
    height: 220px; border-radius: 16px; padding: 30px; cursor: pointer; 
    display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; 
    box-shadow: 0 10px 20px rgba(0,0,0,0.06); transition: all 0.3s ease; color: white; text-decoration: none;
}
.mode-card:hover { transform: translateY(-8px); box-shadow: 0 15px 35px rgba(0,0,0,0.2); }
.mode-basic { background: linear-gradient(135deg, #00b09b 0%, #96c93d 100%); }
.mode-mock { background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); }
.mode-icon { font-size: 56px; margin-bottom: 15px; }
.mode-title { font-size: 26px; font-weight: bold; margin-bottom: 8px; }
.mode-desc { font-size: 14px; opacity: 0.9; }

/* Leaderboard */
.rank-header { display: flex; padding: 20px 20px 0; gap: 20px; border-bottom: 1px solid #eee; }
.rank-type-btn { flex: 1; text-align: center; padding: 15px; font-size: 18px; font-weight: bold; color: #999; cursor: pointer; border-radius: 12px 12px 0 0; background: #f9f9f9; transition: 0.3s; }
.rank-type-btn.active-basic { background: white; color: #00b09b; border-top: 4px solid #00b09b; }
.rank-type-btn.active-mock { background: white; color: #1e3c72; border-top: 4px solid #1e3c72; }

.rank-sub-tabs { display: flex; background: white; padding: 15px 20px; border-bottom: 1px solid #f0f0f0; justify-content: center; gap: 10px; }
.sub-tab { padding: 8px 30px; border-radius: 20px; font-size: 14px; font-weight: bold; color: #666; cursor: pointer; transition: 0.2s; }
.sub-tab.active { background: #333; color: white; }
.rank-container.mode-basic-active .sub-tab.active { background: #00b09b; }
.rank-container.mode-mock-active .sub-tab.active { background: #1e3c72; }

.rank-list-container { height: 400px; overflow-y: auto; background: white; }
.rank-list { display: none; }
.rank-list.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity:0; transform: translateY(5px); } to { opacity:1; transform: translateY(0); } }
.rank-item { display: flex; align-items: center; padding: 12px 30px; border-bottom: 1px solid #f9f9f9; transition: 0.2s; cursor: pointer; }
.rank-item:hover { background-color: #f0fdfc; }
.rank-num { width: 35px; font-size: 16px; font-weight: 900; color: #ccc; font-style: italic; text-align: center; margin-right: 15px; }
.rank-1 { color: #FFD700; font-size: 20px; } .rank-2 { color: #C0C0C0; font-size: 20px; } .rank-3 { color: #CD7F32; font-size: 20px; }
.rank-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; margin-right: 15px; border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

/* Modals */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); justify-content: center; align-items: center; z-index: 1000; backdrop-filter: blur(4px); }
.modal-content { background: white; border-radius: 20px; width: 320px; text-align: center; overflow: hidden; animation: zoomIn 0.3s ease; position: relative; box-shadow: 0 25px 50px rgba(0,0,0,0.3); }
@keyframes zoomIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header-profile { background: #009688; padding: 30px 20px; color: white; }
.btn-save { width: 100%; padding: 12px; background: #009688; color: white; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; margin-top: 10px; }
.btn-logout { display: block; width: 100%; padding: 12px; margin-top: 15px; color: #e53935; background: #ffebee; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; text-decoration: none; box-sizing: border-box; }
.user-modal-bg { height: 100px; background: linear-gradient(135deg, #FFC371 0%, #FF5F6D 100%); }
.user-modal-avatar { width: 90px; height: 90px; border-radius: 50%; border: 4px solid white; margin-top: -45px; object-fit: cover; background: white; }
.user-modal-info { padding: 10px 25px 25px; }
.user-modal-name { font-size: 22px; font-weight: bold; margin-top: 10px; }
.btn-worship { width: 100%; padding: 12px; background: #ffc107; color: #333; border: none; border-radius: 50px; font-weight: bold; font-size: 16px; cursor: pointer; box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4); display: flex; justify-content: center; align-items: center; gap: 8px; }
.worship-container { position: relative; width: 100%; }
.plus-one { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #ff9800; font-size: 24px; font-weight: bold; opacity: 0; pointer-events: none; z-index: 10; }
.animate-plus { animation: floatUp 0.8s ease-out forwards; }
@keyframes floatUp { 0% { opacity: 1; transform: translate(-50%, -20px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1.5); } }

/* =========================================================
   4. MOBILE STYLES (Max-width: 768px)
   ========================================================= */
@media (max-width: 768px) {
    .container { width: 100%; max-width: 100%; padding: 0 15px; }
    .brand-cn { font-size: 28px; }
    .brand-en { font-size: 10px; letter-spacing: 1px; }

    /* Login Page Mobile */
    .auth-box { width: 90% !important; margin: 20px auto; padding: 25px !important; }

    /* Optimized Profile Card for Mobile */
    .user-bar {
        flex-direction: row; 
        text-align: left;    
        padding: 15px 20px;  
        align-items: center; 
        gap: 15px;           
        min-height: auto;    
    }
    .avatar {
        margin: 0;           
        width: 60px;         
        height: 60px;
        border-width: 3px;   
        flex-shrink: 0;      
    }
    .user-stats {
        margin-top: 0;       
        gap: 15px;           
        justify-content: flex-end; 
        flex-shrink: 0;      
    }
    .stat-item h4 { font-size: 18px; }
    .stat-item span { font-size: 10px; }

    .mode-grid { grid-template-columns: 1fr; gap: 15px; }
    .mode-card { height: auto; padding: 25px; }

    /* Optimized Leaderboard Tabs for Mobile */
    .rank-header { padding: 15px 10px 0; gap: 10px; }
    .rank-type-btn { font-size: 15px; padding: 10px 5px; }

    /* Evenly spaced tabs */
    .rank-sub-tabs {
        display: flex;
        width: 100%;
        padding: 10px 5px;
        justify-content: space-between; 
        gap: 5px;
        overflow-x: hidden;
    }
    .sub-tab {
        flex: 1;
        text-align: center;
        padding: 8px 0;
        margin: 0;
        font-size: 13px;
        white-space: nowrap;
        border-radius: 8px;
    }
    
    .modal-content { width: 90%; max-width: none; }
}
/* =========================================================
   NEW: EXAM WRITING STYLES (写作板块样式)
   ========================================================= */
.writing-textarea {
    width: 100%;
    height: 300px;
    padding: 15px;
    border: 2px solid #eee; /* 与其他输入框风格保持一致 */
    border-radius: 8px;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical; /* 允许用户垂直拉伸高度，但不能水平拉伸 */
    background-color: #fafafa;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
    box-sizing: border-box;
    margin-top: 15px;
    transition: 0.3s;
}

/* 获得焦点时的样式（高亮边框） */
.writing-textarea:focus {
    border-color: #009688; /* 使用你网站的主题色 Teal */
    background-color: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 150, 136, 0.1);
}

/* 字数统计的样式 */
.word-count-display {
    text-align: right;
    color: #999;
    font-size: 13px;
    margin-top: 8px;
    font-weight: 500;
}
/* =========================================================
   NEW: 老师反馈卡片样式 (Feedback Card)
   ========================================================= */
.feedback-section { margin-bottom: 30px; }

.feedback-header { 
    display: flex; align-items: center; justify-content: space-between; 
    margin-bottom: 15px; padding: 0 5px; 
}

.feedback-title { 
    margin: 0; color: #333; font-size: 18px; 
    display: flex; align-items: center; gap: 8px; 
}

.feedback-icon-wrapper { 
    background: #e3f2fd; color: #1565c0; 
    width: 30px; height: 30px; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 16px; 
}

.feedback-tag { 
    font-size: 12px; color: #999; 
    background: rgba(0,0,0,0.05); padding: 2px 10px; border-radius: 15px; 
}

.feedback-grid { display: grid; gap: 15px; }

.feedback-card { 
    background: white; padding: 15px; border-radius: 16px; 
    display: flex; align-items: center; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.03); 
    transition: transform 0.2s, box-shadow 0.2s; 
    border: 1px solid rgba(0,0,0,0.02); 
}

.feedback-card:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 8px 25px rgba(0,0,0,0.08); 
}

.feedback-item-icon { 
    width: 50px; height: 50px; border-radius: 12px; 
    color: white; font-size: 24px; 
    display: flex; align-items: center; justify-content: center; 
    flex-shrink: 0; box-shadow: 0 4px 10px rgba(0,0,0,0.1); 
}

.feedback-content { flex: 1; margin: 0 15px; overflow: hidden; }

.feedback-meta { 
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 5px; 
}

.feedback-type { font-weight: bold; color: #333; font-size: 15px; }
.feedback-date { font-size: 12px; color: #ccc; }

.feedback-comment { 
    background: #f9f9f9; padding: 8px 12px; border-radius: 6px; 
    color: #666; font-size: 13px; line-height: 1.5; 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
    border-left: 3px solid #eee; 
}

.feedback-score { 
    text-align: center; padding-left: 15px; border-left: 1px dashed #eee; 
}

.feedback-score-num { font-size: 22px; font-weight: 800; line-height: 1; }
.feedback-score-label { font-size: 10px; color: #999; margin-top: 2px; }

/* 进场动画 */
.animate-slide-down { animation: slideDown 0.5s ease; }
@keyframes slideDown { 
    from { opacity: 0; transform: translateY(-10px); } 
    to { opacity: 1; transform: translateY(0); } 
}