/**
 * 智能班级学情管理系统 - 通用组件库
 * Components Library V3.0
 * 
 * 现代化、统一的UI组件
 */

/* ============================================
   1. 按钮组件 (Button)
   ============================================ */

/* 基础按钮样式 */
.edu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    text-decoration: none;
}

.edu-btn:focus-visible {
    outline: 2px solid var(--focus-ring, rgba(24, 144, 255, 0.4));
    outline-offset: 2px;
}

.edu-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 主要按钮 */
.edu-btn-primary {
    background: var(--primary, #1890FF);
    color: white;
}

.edu-btn-primary:hover:not(:disabled) {
    background: var(--primary-hover, #40A9FF);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
}

.edu-btn-primary:active:not(:disabled) {
    background: var(--primary-dark, #096DD9);
    transform: translateY(0);
}

/* 次要按钮 */
.edu-btn-secondary {
    background: white;
    color: var(--primary, #1890FF);
    border: 2px solid var(--primary, #1890FF);
}

.edu-btn-secondary:hover:not(:disabled) {
    background: rgba(24, 144, 255, 0.05);
    border-color: var(--primary-hover, #40A9FF);
    transform: translateY(-2px);
}

/* 危险按钮 */
.edu-btn-danger {
    background: var(--danger, #F5222D);
    color: white;
}

.edu-btn-danger:hover:not(:disabled) {
    background: var(--danger-hover, #cf1322);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 34, 45, 0.3);
}

/* 成功按钮 */
.edu-btn-success {
    background: var(--success, #52C41A);
    color: white;
}

.edu-btn-success:hover:not(:disabled) {
    background: var(--success-hover, #389e0d);
    transform: translateY(-2px);
}

/* 按钮尺寸 */
.edu-btn-lg {
    padding: 12px 28px;
    font-size: 18px;
    height: 48px;
}

.edu-btn-sm {
    padding: 6px 16px;
    font-size: 14px;
    height: 32px;
}

.edu-btn-xs {
    padding: 4px 12px;
    font-size: 12px;
    height: 24px;
}

/* 按钮加载状态 */
.edu-btn-loading {
    pointer-events: none;
    position: relative;
    color: transparent !important;
}

.edu-btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 块级按钮 */
.edu-btn-block {
    display: flex;
    width: 100%;
}

/* ============================================
   2. 卡片组件 (Card)
   ============================================ */

.edu-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

.edu-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* 卡片标题 */
.edu-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light, #E8E8E8);
}

.edu-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #262626);
    margin: 0;
}

.edu-card-extra {
    font-size: 14px;
    color: var(--text-secondary, #595959);
}

/* 卡片内容 */
.edu-card-body {
    padding: 0;
}

/* 卡片底部 */
.edu-card-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light, #E8E8E8);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 信息卡片 */
.edu-card-info {
    background: linear-gradient(135deg, #E6F7FF 0%, #BAE7FF 100%);
    border-left: 4px solid var(--info, #13C2C2);
}

/* 成功卡片 */
.edu-card-success {
    background: linear-gradient(135deg, #F6FFED 0%, #D9F7BE 100%);
    border-left: 4px solid var(--success, #52C41A);
}

/* 警告卡片 */
.edu-card-warning {
    background: linear-gradient(135deg, #FFFBE6 0%, #FFE58F 100%);
    border-left: 4px solid var(--warning, #FA8C16);
}

/* 危险卡片 */
.edu-card-danger {
    background: linear-gradient(135deg, #FFF1F0 0%, #FFCCC7 100%);
    border-left: 4px solid var(--danger, #F5222D);
}

/* 统计卡片 */
.edu-card-stat {
    text-align: center;
}

.edu-card-stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary, #1890FF);
    margin-bottom: 8px;
}

.edu-card-stat-label {
    font-size: 14px;
    color: var(--text-secondary, #595959);
}

.edu-card-stat-change {
    font-size: 12px;
    margin-top: 4px;
}

.edu-card-stat-change.positive {
    color: var(--success, #52C41A);
}

.edu-card-stat-change.negative {
    color: var(--danger, #F5222D);
}

/* ============================================
   3. 表单组件 (Form)
   ============================================ */

.edu-form-group {
    margin-bottom: 20px;
}

.edu-form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #262626);
}

.edu-form-label.required::before {
    content: '*';
    color: var(--danger, #F5222D);
    margin-right: 4px;
}

.edu-form-control {
    width: 100%;
    height: 40px;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary, #262626);
    background-color: white;
    border: 1px solid var(--border-base, #D9D9D9);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.edu-form-control:hover {
    border-color: var(--primary-light, #40A9FF);
}

.edu-form-control:focus {
    border-color: var(--primary, #1890FF);
    outline: none;
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
}

.edu-form-control:disabled {
    background-color: var(--bg-tertiary, #F5F5F5);
    color: var(--text-disabled, #BFBFBF);
    cursor: not-allowed;
}

/* 表单错误状态 */
.edu-form-control.error {
    border-color: var(--danger, #F5222D);
}

.edu-form-control.error:focus {
    box-shadow: 0 0 0 3px rgba(245, 34, 45, 0.1);
}

.edu-form-error {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--danger, #F5222D);
}

/* 文本域 */
.edu-form-textarea {
    min-height: 80px;
    resize: vertical;
}

/* 下拉框 */
.edu-form-select {
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 12px;
}

/* 复选框和单选框 */
.edu-form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.edu-form-check-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.edu-form-check-label {
    font-size: 14px;
    color: var(--text-primary, #262626);
    cursor: pointer;
}

/* ============================================
   4. 表格组件 (Table)
   ============================================ */

.edu-table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.edu-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.edu-table thead {
    background: var(--bg-secondary, #FAFAFA);
}

.edu-table th {
    padding: 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #262626);
    border-bottom: 2px solid var(--border-base, #D9D9D9);
}

.edu-table td {
    padding: 16px;
    font-size: 14px;
    color: var(--text-primary, #262626);
    border-bottom: 1px solid var(--border-light, #E8E8E8);
}

.edu-table tbody tr {
    transition: background-color 0.2s ease;
}

.edu-table tbody tr:hover {
    background-color: #E6F7FF;
}

/* 斑马纹 */
.edu-table-striped tbody tr:nth-child(even) {
    background-color: var(--bg-secondary, #FAFAFA);
}

.edu-table-striped tbody tr:nth-child(even):hover {
    background-color: #E6F7FF;
}

/* 紧凑表格 */
.edu-table-sm th,
.edu-table-sm td {
    padding: 8px 12px;
}

/* ============================================
   5. 模态框组件 (Modal)
   ============================================ */

.edu-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.edu-modal.active {
    display: flex;
}

.edu-modal-dialog {
    position: relative;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    animation: zoomIn 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.edu-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border-light, #E8E8E8);
}

.edu-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary, #262626);
    margin: 0;
}

.edu-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    font-size: 24px;
    color: var(--text-tertiary, #8C8C8C);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.edu-modal-close:hover {
    background: var(--bg-tertiary, #F5F5F5);
    color: var(--text-primary, #262626);
}

.edu-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.edu-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light, #E8E8E8);
}

/* 大尺寸模态框 */
.edu-modal-lg .edu-modal-dialog {
    max-width: 900px;
}

/* 小尺寸模态框 */
.edu-modal-sm .edu-modal-dialog {
    max-width: 400px;
}

/* ============================================
   6. 标签组件 (Tag/Badge)
   ============================================ */

.edu-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    border-radius: 999px;
    white-space: nowrap;
}

.edu-tag-primary {
    background: rgba(24, 144, 255, 0.1);
    color: var(--primary, #1890FF);
}

.edu-tag-success {
    background: rgba(82, 196, 26, 0.1);
    color: var(--success, #52C41A);
}

.edu-tag-warning {
    background: rgba(250, 140, 22, 0.1);
    color: var(--warning, #FA8C16);
}

.edu-tag-danger {
    background: rgba(245, 34, 45, 0.1);
    color: var(--danger, #F5222D);
}

/* 知识点标签 */
.edu-tag-knowledge {
    background: linear-gradient(135deg, rgba(114, 46, 209, 0.1), rgba(114, 46, 209, 0.2));
    color: var(--knowledge-purple, #722ED1);
}

/* ============================================
   7. 加载动画 (Loading)
   ============================================ */

.edu-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(24, 144, 255, 0.2);
    border-top-color: var(--primary, #1890FF);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.edu-spinner-sm {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

.edu-spinner-lg {
    width: 56px;
    height: 56px;
    border-width: 5px;
}

/* 骨架屏 */
.edu-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.edu-skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.edu-skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 16px;
}

/* ============================================
   8. 提示/警告框 (Alert)
   ============================================ */

.edu-alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.edu-alert-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.edu-alert-content {
    flex: 1;
}

.edu-alert-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.edu-alert-description {
    font-size: 14px;
    line-height: 1.5;
}

.edu-alert-info {
    background: #E6F7FF;
    color: #0050B3;
    border-left: 4px solid var(--info, #13C2C2);
}

.edu-alert-success {
    background: #F6FFED;
    color: #135200;
    border-left: 4px solid var(--success, #52C41A);
}

.edu-alert-warning {
    background: #FFFBE6;
    color: #613400;
    border-left: 4px solid var(--warning, #FA8C16);
}

.edu-alert-error {
    background: #FFF1F0;
    color: #5C0011;
    border-left: 4px solid var(--danger, #F5222D);
}

/* ============================================
   9. 教育特色组件
   ============================================ */

/* 成绩等级指示器 */
.edu-grade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
}

.edu-grade-excellent {
    background: rgba(250, 173, 20, 0.1);
    color: var(--excellent-gold, #FAAD14);
}

.edu-grade-good {
    background: rgba(82, 196, 26, 0.1);
    color: var(--success, #52C41A);
}

.edu-grade-pass {
    background: rgba(19, 194, 194, 0.1);
    color: var(--info, #13C2C2);
}

.edu-grade-fail {
    background: rgba(245, 34, 45, 0.1);
    color: var(--danger, #F5222D);
}

/* 难度等级指示器 */
.edu-difficulty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.edu-difficulty-easy {
    background: rgba(82, 196, 26, 0.1);
    color: var(--success, #52C41A);
}

.edu-difficulty-medium {
    background: rgba(250, 140, 22, 0.1);
    color: var(--warning, #FA8C16);
}

.edu-difficulty-hard {
    background: rgba(245, 34, 45, 0.1);
    color: var(--danger, #F5222D);
}

/* 进度条 */
.edu-progress {
    height: 8px;
    background: var(--bg-tertiary, #F5F5F5);
    border-radius: 999px;
    overflow: hidden;
}

.edu-progress-bar {
    height: 100%;
    background: var(--primary, #1890FF);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.edu-progress-bar.success {
    background: var(--success, #52C41A);
}

.edu-progress-bar.warning {
    background: var(--warning, #FA8C16);
}

.edu-progress-bar.danger {
    background: var(--danger, #F5222D);
}
