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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding-bottom: 20px;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.login-box h2 {
    text-align: center;
    color: #333;
    margin-bottom: 5px;
    font-size: 28px;
}

.subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 30px;
    font-size: 14px;
}

.tabs {
    display: flex;
    margin-bottom: 25px;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 5px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    color: #666;
    transition: all 0.3s;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.required-star {
    color: #f44336;
    margin-left: 2px;
}

input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.3s;
}

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

.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    resize: vertical;
    transition: border-color 0.3s;
}

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

.tip {
    font-size: 12px;
    color: #ff6b6b;
    margin-top: 8px;
}

.required-star {
    color: #ff6b6b;
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(17, 153, 142, 0.4);
}

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

.btn-danger:hover {
    background: #ff5252;
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.alert {
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.footer-text {
    text-align: center;
    color: #aaa;
    margin-top: 25px;
    font-size: 12px;
}

.header {
    background: white;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header h1 {
    color: #333;
    font-size: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.user-info span {
    color: #555;
    font-size: 14px;
}

.user-info .points {
    background: #fff3e0;
    color: #ff9800;
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
}

.user-info a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
}

.user-info a:hover {
    text-decoration: underline;
}

.main-content {
    padding: 0 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.search-bar {
    background: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    background: #fafafa;
}

.search-bar input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

/* ========== 搜索框 + 下拉 ========== */
.search-select {
    position: relative;
    background: white;
    padding: 22px;
    border-radius: 18px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    box-sizing: border-box;
}

.search-select-wrap {
    position: relative;
}

.search-select-input {
    width: 100%;
    padding: 18px 55px 18px 22px;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    font-size: 18px;
    background: #fafafa;
    box-sizing: border-box;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    line-height: 1.5;
}

.search-select-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.18);
}

.search-select-arrow {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 20px;
    pointer-events: none;
    transition: transform 0.2s, color 0.2s;
}

.search-select-arrow.open {
    transform: translateY(-50%) rotate(180deg);
    color: #667eea;
}

.search-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
}

.search-select-item {
    padding: 18px 22px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    min-width: 0;
    margin-bottom: 4px;
    border-radius: 10px;
    margin: 4px 8px;
    transition: background 0.2s;
}

.search-select-item:hover,
.search-select-item.active {
    background: #f0f4ff;
}

.search-select-item .item-name {
    color: #333;
    font-size: 16px;
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.6;
}

.search-select-item .item-id {
    color: #667eea;
    font-size: 13px;
    flex: 0 0 auto;
    white-space: nowrap;
    margin-top: 4px;
    background: #f0f4ff;
    padding: 3px 10px;
    border-radius: 12px;
}

.search-select-empty {
    padding: 25px;
    text-align: center;
    color: #999;
    font-size: 15px;
}

/* ========== 课程详情（防溢出） ========== */
.course-detail {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.course-detail .detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 8px;
}

.course-detail .detail-header h3 {
    color: #333;
    font-size: 20px;
    line-height: 1.4;
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
    margin: 0;
}

.course-detail .detail-close {
    flex: 0 0 auto;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

.course-detail .detail-close:hover {
    color: #ff6b6b;
}

.course-detail .detail-id {
    color: #999;
    font-size: 13px;
    margin-bottom: 15px;
    word-break: break-all;
}

.course-detail .content {
    color: #555;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: 14px;
}

.main-content h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 18px;
}

.course-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.course-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.course-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.course-card.selected {
    border-color: #667eea;
    background: #f8f9ff;
}

.course-card .course-id {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}

.course-card h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 16px;
    line-height: 1.4;
}

.course-card .price {
    color: #ff6b6b;
    font-weight: 600;
    font-size: 16px;
}

.course-card .category {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    margin-top: 10px;
}

.order-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.order-section h3 {
    color: #333;
    margin-bottom: 20px;
}

.order-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.order-form .form-group {
    margin-bottom: 0;
}

.order-form .form-group.full-width,
.order-form .select-courses-btn,
.order-form .selected-courses {
    grid-column: span 2;
}

/* 当前项目显示 */
.current-project {
    padding: 12px 15px;
    border: 2px dashed #e0e0e0;
    border-radius: 10px;
    background: #fafafa;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    flex-wrap: wrap;
}

.current-project .no-project {
    color: #bbb;
    font-size: 14px;
}

.current-project .project-name {
    color: #333;
    font-size: 15px;
    font-weight: 600;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.current-project .project-cid {
    color: #667eea;
    font-size: 13px;
    background: #f0f4ff;
    padding: 3px 10px;
    border-radius: 15px;
    white-space: nowrap;
}

.selected-courses {
    background: #f5f5f5;
    border-radius: 10px;
    padding: 15px;
    min-height: 80px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

.selected-courses .course-tag {
    display: inline-flex;
    align-items: center;
    background: #667eea;
    color: white;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 13px;
    margin: 5px;
    max-width: 100%;
    min-width: 0;
}

.selected-courses .course-tag .tag-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
    max-width: 280px;
}

.selected-courses .course-tag .tag-remove {
    margin-left: 8px;
    cursor: pointer;
    flex: 0 0 auto;
    line-height: 1;
    padding: 0 2px;
}

.selected-courses #noCourseTip {
    color: #999;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    margin-top: 50px;
    margin-bottom: 20px;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.modal-header button {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-course-info {
    margin-bottom: 12px;
    padding: 10px 15px;
    background: linear-gradient(135deg, #f0f4ff, #f8f0ff);
    border-radius: 8px;
    font-size: 14px;
    color: #555;
}

.course-user-info .course-count {
    color: #667eea;
    font-weight: 600;
    margin-left: 10px;
}

.modal-search {
    margin-bottom: 15px;
}

.modal-search input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    box-sizing: border-box;
    background: #fafafa;
}

.modal-search input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.modal-course-list {
    min-height: 100px;
}

.modal-empty {
    text-align: center;
    color: #999;
    padding: 30px 10px;
    font-size: 14px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.course-checkbox {
    margin-bottom: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.course-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex: 0 0 auto;
}

.course-checkbox .course-name {
    flex: 1 1 auto;
    min-width: 0;
    color: #333;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
}

.course-checkbox .course-id {
    flex: 0 0 auto;
    color: #999;
    font-size: 12px;
    white-space: nowrap;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.admin-container {
    background: white;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh;
    padding: 20px;
    position: fixed;
}

.admin-sidebar h2 {
    color: white;
    margin-bottom: 30px;
    font-size: 20px;
    text-align: center;
}

.admin-sidebar ul {
    list-style: none;
}

.admin-sidebar li {
    margin-bottom: 10px;
}

.admin-sidebar a {
    display: block;
    padding: 12px 15px;
    color: #bdc3c7;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
}

.admin-sidebar a:hover, .admin-sidebar a.active {
    background: #3498db;
    color: white;
}

.admin-content {
    margin-left: 270px;
    padding: 30px;
}

.admin-content h2 {
    color: #333;
    margin-bottom: 30px;
}

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

.table th, .table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.table th {
    background: #f8f9fa;
    color: #555;
    font-weight: 600;
}

.table tr:hover {
    background: #f8f9fa;
}

.status-pending {
    color: #ff9800;
}

.status-active {
    color: #4caf50;
}

.status-disabled {
    color: #f44336;
}

/* ========== 后台专用样式 ========== */
.admin-alert {
    max-width: 680px;
    margin-bottom: 20px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.admin-form {
    max-width: 680px;
    background: #fafafa;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.admin-section-title {
    color: #333;
    margin: 0 0 20px 0;
    font-size: 17px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e8ecff;
}

.admin-submit-btn {
    margin-top: 10px;
    max-width: 200px;
}

.admin-tip {
    color: #999;
    font-size: 13px;
    margin-top: 10px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.mail-test-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: stretch;
}

.mail-test-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    box-sizing: border-box;
}

.mail-test-input:focus {
    outline: none;
    border-color: #667eea;
}

.mail-test-btn {
    width: auto;
    padding: 12px 25px;
    white-space: nowrap;
}

.admin-content h2 {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.admin-content .form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    resize: vertical;
 transition: border-color 0.