:root {
    --primary: #1890ff;
    --primary-dark: #096dd9;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #ff4d4f;
    --text: #333;
    --text-secondary: #666;
    --border: #e8e8e8;
    --bg: #f5f5f5;
    --card-bg: #fff;
    --sidebar-width: 200px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.hidden { display: none !important; }

/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}

.login-logo { font-size: 64px; margin-bottom: 16px; }
.login-box h2 { margin-bottom: 24px; }
.login-tip { margin-top: 16px; font-size: 13px; color: var(--text-secondary); }

/* 主应用 */
.app { display: flex; min-height: 100vh; }

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

.header-left, .header-right { display: flex; align-items: center; gap: 12px; }
.menu-toggle { font-size: 20px; cursor: pointer; padding: 8px; }
.header-title { font-size: 18px; font-weight: 500; }
.user-role { 
    font-size: 12px; 
    background: rgba(255,255,255,0.2); 
    padding: 2px 8px; 
    border-radius: 4px; 
}
.btn-icon {
    width: 36px; height: 36px;
    border: none;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border);
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.3s;
}

.sidebar.open { transform: translateX(0); }
.sidebar-nav { padding: 16px 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item:hover, .nav-item.active {
    background: #e6f7ff;
    color: var(--primary);
}

.nav-icon { font-size: 20px; width: 24px; text-align: center; }

/* 主内容 */
.main-content {
    flex: 1;
    margin-top: 56px;
    margin-left: 0;
    padding: 20px;
    transition: margin-left 0.3s;
}

@media (min-width: 768px) {
    .sidebar { transform: translateX(0); }
    .main-content { margin-left: var(--sidebar-width); }
    .menu-toggle { display: none; }
}

/* 页面 */
.page { display: none; }
.page.active { display: block; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h1 { font-size: 24px; font-weight: 600; }

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #f0f0f0; color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-full { width: 100%; }
.btn-small { padding: 6px 12px; font-size: 13px; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* 卡片 */
.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 16px;
}

/* 统计 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: #e6f7ff;
}

.stat-icon.balance { background: #fffbe6; }

.stat-value { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-secondary); }

/* 快捷操作 */
.dashboard-section { margin-bottom: 24px; }
.dashboard-section h3 {
    margin-bottom: 16px;
    font-size: 16px;
    color: var(--text-secondary);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quick-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.quick-btn:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(24,144,255,0.15);
}

.quick-icon { font-size: 32px; }

/* 数据列表 */
.data-list { display: flex; flex-direction: column; gap: 12px; }

.data-item {
    background: var(--card-bg);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.data-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.data-item-title { font-size: 16px; font-weight: 600; }
.data-item-subtitle { font-size: 13px; color: var(--text-secondary); }
.data-item-body { font-size: 14px; color: var(--text-secondary); }
.data-item-body p { margin: 4px 0; }

.data-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* 标签 */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.tag-success { background: #f6ffed; color: var(--success); }
.tag-warning { background: #fffbe6; color: var(--warning); }
.tag-danger { background: #fff1f0; color: var(--danger); }

/* 筛选 */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
    flex: 1;
    min-width: 120px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

/* 点名 */
.attendance-list {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 80px;
}

.attendance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.attendance-item:last-child { border-bottom: none; }

.attendance-info { flex: 1; }
.attendance-name { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.attendance-detail { font-size: 13px; color: var(--text-secondary); }

.attendance-status { display: flex; gap: 8px; }

.status-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.status-btn.active { background: var(--success); color: white; border-color: var(--success); }
.status-btn.leave { background: var(--warning); color: white; border-color: var(--warning); }
.status-btn.absent { background: var(--danger); color: white; border-color: var(--danger); }

/* 标签页 */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-secondary);
}

.tab-btn.active { color: var(--primary); font-weight: 500; border-bottom: 2px solid var(--primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 固定底部 */
.fixed-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: white;
    border-top: 1px solid var(--border);
    z-index: 80;
}

@media (min-width: 768px) {
    .fixed-bottom { left: var(--sidebar-width); }
}

/* 提醒列表 */
.alert-list {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.alert-item:last-child { border-bottom: none; }
.alert-icon { font-size: 20px; }
.alert-content { flex: 1; }
.alert-title { font-weight: 500; }
.alert-desc { font-size: 13px; color: var(--text-secondary); }

/* 弹窗 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 18px; }

.modal-close {
    width: 32px; height: 32px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.modal-footer .btn { flex: 1; }

/* 空状态 */
.empty-text {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* 报表 */
.report-filters { margin-bottom: 20px; }
.report-section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.report-section h4 { margin-bottom: 16px; font-size: 16px; }
.report-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.report-item:last-child { border-bottom: none; }
.report-total { font-weight: 600; color: var(--primary); }

/* 弹窗容器 */
#modal-container { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; pointer-events: none; }
#modal-container:empty { display: none; }
#modal-container .modal-overlay { pointer-events: auto; }

/* 学生报名 */
.enrollment-form { max-width: 800px; margin: 0 auto; }
.form-section { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: none; }
.form-section h3 { margin-bottom: 20px; font-size: 18px; color: var(--text); }
.course-selection { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.course-option {
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}
.course-option:hover { border-color: var(--primary); }
.course-option.selected {
    border-color: var(--primary);
    background: rgba(24, 144, 255, 0.05);
}
.course-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.course-option-name { font-weight: 600; font-size: 16px; }
.course-option-price { color: var(--danger); font-weight: 600; font-size: 18px; }
.course-option-info { color: var(--text-secondary); font-size: 14px; }
.enrollment-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.btn-large { padding: 12px 48px; font-size: 16px; }

/* 可搜索下拉框 */
.searchable-select { position: relative; }
.searchable-select input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}
.searchable-select input:focus {
    outline: none;
    border-color: var(--primary);
}
.student-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 100;
    display: none;
}
.student-dropdown.active { display: block; }
.student-dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}
.student-dropdown-item:hover { background: #f5f5f5; }
.student-dropdown-item:last-child { border-bottom: none; }