/* ===== 全局重置 & 变量 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0b081a;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.09);
    --bg-input: rgba(255, 255, 255, 0.07);
    --border-glass: rgba(255, 255, 255, 0.10);
    --text-primary: #f0edff;
    --text-secondary: #b8b0d9;
    --text-muted: #7a72a0;
    --accent-1: #7c6df0;
    --accent-2: #a78bfa;
    --accent-3: #6ee7b7;
    --shadow-glow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 80px rgba(124, 109, 240, 0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(124, 109, 240, 0.10) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(110, 231, 183, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(167, 139, 250, 0.05) 0%, transparent 50%);
}

.app-container {
    width: 100%;
    max-width: 1200px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-glass);
    border-radius: 32px;
    padding: 32px 36px 40px;
    box-shadow: var(--shadow-glow);
    position: relative;
}

.app-container::before {
    content: '';
    position: absolute;
    top: -180px;
    right: -120px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(124, 109, 240, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
.app-container::after {
    content: '';
    position: absolute;
    bottom: -160px;
    left: -100px;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(110, 231, 183, 0.07) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* ===== 头部 ===== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
    gap: 16px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    box-shadow: 0 4px 20px rgba(124, 109, 240, 0.35);
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #f0edff 0%, #b8b0d9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.logo-text span {
    font-weight: 300;
    opacity: 0.6;
    -webkit-text-fill-color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border: none;
    border-radius: 50px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: #fff;
    border: none;
    box-shadow: 0 4px 24px rgba(124, 109, 240, 0.30);
}
.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 32px rgba(124, 109, 240, 0.45);
}

.btn-ai {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
    border: none;
    box-shadow: 0 4px 24px rgba(245, 158, 11, 0.30);
}
.btn-ai:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 32px rgba(249, 115, 22, 0.45);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #34d399, #6ee7b7);
    color: #0b081a;
    border: none;
    box-shadow: 0 4px 20px rgba(110, 231, 183, 0.25);
}
.btn-success:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 28px rgba(110, 231, 183, 0.35);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.20);
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.view-toggle {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.view-toggle .btn {
    border-radius: 50px;
    padding: 6px 14px;
    background: transparent;
    border: none;
    color: var(--text-muted);
}
.view-toggle .btn.active {
    background: rgba(255, 255, 255, 0.10);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.view-toggle .btn:hover {
    color: #fff;
}

/* ===== 页面切换 ===== */
.page {
    display: none;
    position: relative;
    z-index: 1;
    animation: fadeSlide 0.4s ease;
}
.page.active {
    display: block;
}

@keyframes fadeSlide {
    0% { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ===== 课程一览 ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.2px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-title i {
    color: var(--accent-2);
    font-size: 20px;
}
.page-title .badge {
    font-size: 13px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.07);
    padding: 2px 14px;
    border-radius: 50px;
    color: var(--text-secondary);
    margin-left: 4px;
}

/* 课程网格 (卡片) */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.course-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 22px 24px 24px;
    transition: var(--transition);
    backdrop-filter: blur(4px);
    position: relative;
    overflow: hidden;
}
.course-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.30);
}

.course-card .card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.course-card .card-code {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-1);
    margin-right: 6px;
    flex-shrink: 0;
}

.course-card .card-title-group {
    display: flex;
    align-items: baseline;
    gap: 0;
}

.course-card .card-title-group .course-name {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid transparent;
}
.course-card .card-title-group .course-name:hover {
    color: var(--accent-2);
    border-bottom-color: var(--accent-2);
}

.course-card .course-status {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    margin-top: 2px;
}

.status-构思中 { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.status-制作中 { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.status-评估中 { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }
.status-完成   { background: rgba(110, 231, 183, 0.12); color: #6ee7b7; }

.course-card .course-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 8px 0 14px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-card .course-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 13px;
    color: var(--text-muted);
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.course-card .course-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.course-card .course-meta i {
    font-size: 13px;
    color: var(--text-muted);
    width: 16px;
}
.course-card .card-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ===== 表格视图 ===== */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    backdrop-filter: blur(4px);
}

.course-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 700px;
}
.course-table th {
    text-align: left;
    padding: 16px 18px;
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.course-table td {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text-primary);
    vertical-align: middle;
}
.course-table tr:last-child td {
    border-bottom: none;
}
.course-table tr:hover td {
    background: rgba(255,255,255,0.03);
}
.course-table .status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 50px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}
.course-table .code-td {
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
}
.course-table .course-name-td {
    font-weight: 500;
    cursor: pointer;
    color: var(--accent-2);
    transition: var(--transition);
}
.course-table .course-name-td:hover {
    color: #fff;
    text-decoration: underline;
}
.course-table .desc-td {
    max-width: 180px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.course-table .actions-td {
    display: flex;
    gap: 6px;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 48px;
    color: rgba(255, 255, 255, 0.05);
    margin-bottom: 16px;
    display: block;
}
.empty-state h3 {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.empty-state p {
    font-size: 14px;
}

/* ===== 创建/编辑 课程页面 ===== */
.form-container {
    max-width: 700px;
    margin: 0 auto;
}

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 32px 36px;
    backdrop-filter: blur(4px);
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}
.form-group label .required {
    color: #f87171;
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    transition: var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(124, 109, 240, 0.20);
    background: rgba(255, 255, 255, 0.08);
}
.form-control::placeholder {
    color: var(--text-muted);
}
textarea.form-control {
    resize: vertical;
    min-height: 80px;
}
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a72a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}
select.form-control option {
    background: #1a1630;
    color: #f0edff;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 14px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .app-container {
        padding: 20px 18px 28px;
        border-radius: 24px;
    }
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .form-card {
        padding: 24px 20px;
    }
    .course-grid {
        grid-template-columns: 1fr;
    }
    .logo-text {
        font-size: 20px;
    }
    .page-title {
        font-size: 18px;
    }
    .header-actions .btn span {
        display: none;
    }
    .header-actions .btn {
        padding: 10px 16px;
    }
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    .view-toggle {
        align-self: flex-start;
    }

}

@media (max-width: 480px) {
    .app-container {
        padding: 16px 12px 20px;
    }
    .form-card {
        padding: 18px 14px;
    }
    .course-card {
        padding: 18px;
    }
    .course-table {
        font-size: 13px;
    }
    .course-table th, .course-table td {
        padding: 10px 12px;
    }
}

/* ===== 工具类 ===== */
.hidden { display: none !important; }
.mt-1 { margin-top: 6px; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-center { align-items: center; }
.w-full { width: 100%; }

/* ===== AI 聊天 ===== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 60vh;
    min-height: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chat-msg {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.chat-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg.assistant {
    align-self: flex-start;
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    border-bottom-left-radius: 4px;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-glass);
    background: rgba(255,255,255,0.02);
}

.chat-input-area input {
    flex: 1;
    padding: 12px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: 50px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}
.chat-input-area input:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(124,109,240,0.20);
}
.chat-input-area input::placeholder {
    color: var(--text-muted);
}

.chat-input-area button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.chat-input-area button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(124,109,240,0.4);
}
.chat-input-area button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat-loading {
    align-self: flex-start;
    padding: 12px 20px;
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-loading .dot-pulse {
    display: flex;
    gap: 4px;
}
.chat-loading .dot-pulse span {
    width: 6px;
    height: 6px;
    background: var(--accent-2);
    border-radius: 50%;
    animation: dotBounce 1.2s infinite ease-in-out;
}
.chat-loading .dot-pulse span:nth-child(2) { animation-delay: 0.2s; }
.chat-loading .dot-pulse span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* ===== Filter 面板 ===== */
.filter-wrapper {
    position: relative;
}

.filter-panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: rgba(20, 16, 50, 0.97);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 20px;
    min-width: 280px;
    z-index: 100;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.filter-panel.show {
    display: block;
    animation: fadeSlide 0.25s ease;
}

.filter-panel h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.filter-section {
    margin-bottom: 14px;
}
.filter-section:last-child {
    margin-bottom: 0;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    transition: var(--transition);
    user-select: none;
}
.filter-chip:hover {
    background: rgba(255, 255, 255, 0.10);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.20);
}
.filter-chip.active {
    background: rgba(124, 109, 240, 0.25);
    color: var(--accent-2);
    border-color: var(--accent-1);
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.filter-actions .btn {
    flex: 1;
    justify-content: center;
    font-size: 12px;
    padding: 8px 16px;
}

.filter-badge {
    font-size: 11px;
    background: var(--accent-1);
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    font-weight: 600;
}

/* ===== 删除确认弹窗 ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    background: #1a1640;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 28px 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    animation: fadeSlide 0.25s ease;
}

.modal-box h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
