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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f5f7fa;
    color: #2c3e50;
    line-height: 1.6;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}
.btn-primary {
    background: #3498db;
    color: white;
}
.btn-primary:hover {
    background: #2980b9;
}
.btn-success {
    background: #27ae60;
    color: white;
}
.btn-success:hover {
    background: #229954;
}
.btn-danger {
    background: #e74c3c;
    color: white;
}
.btn-danger:hover {
    background: #c0392b;
}
.btn-secondary {
    background: #95a5a6;
    color: white;
}
.btn-secondary:hover {
    background: #7f8c8d;
}
.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 输入框 */
input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus {
    border-color: #3498db;
}
textarea {
    resize: vertical;
    min-height: 80px;
}

/* 表单组 */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}
.form-group .hint {
    font-size: 12px;
    color: #909399;
    margin-top: 4px;
}

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

/* 徽章 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    background: #ecf0f1;
    color: #34495e;
    margin-right: 6px;
}
.badge-admin { background: #c0392b; color: white; }
.badge-teacher { background: #e67e22; color: white; }
.badge-student { background: #3498db; color: white; }

/* 难度星级 */
.difficulty-star {
    color: #f39c12;
    font-size: 14px;
}
.difficulty-star-empty {
    color: #d5d9de;
    font-size: 14px;
}

/* 顶部导航 */
.navbar {
    background: white;
    padding: 12px 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-brand {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}
.navbar-links {
    display: flex;
    gap: 16px;
    align-items: center;
}
.navbar-links a {
    color: #5c6b7a;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 4px;
}
.navbar-links a:hover {
    background: #ecf0f1;
}
.navbar-user {
    color: #7f8c8d;
    font-size: 13px;
}

/* 模态框 */
.modal-mask {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 92%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0,0,0,0.25);
    overflow: hidden;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 28px 16px;
    border-bottom: 1px solid #ecf0f1;
    flex-shrink: 0;
}
.modal-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a252f;
    line-height: 1.3;
}
.modal-close {
    cursor: pointer;
    font-size: 28px;
    color: #95a5a6;
    background: none;
    border: none;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: color .2s;
}
.modal-close:hover { color: #e74c3c; }
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
}
.modal-footer {
    padding: 14px 28px;
    border-top: 1px solid #ecf0f1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* 提示消息 */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
}
.alert-error {
    background: #fde8e8;
    color: #c0392b;
    border-left: 3px solid #e74c3c;
}
.alert-success {
    background: #e8f8f0;
    color: #229954;
    border-left: 3px solid #27ae60;
}
.alert-info {
    background: #e8f4fd;
    color: #2980b9;
    border-left: 3px solid #3498db;
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }
