:root {
    /* Color Palette - Premium & Modern */
    --primary-color: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    /* Indigo 600 */
    --secondary-color: #ec4899;
    /* Pink 500 */
    --accent-color: #8b5cf6;
    /* Violet 500 */

    --bg-gradient-start: #f3f4f6;
    --bg-gradient-end: #e5e7eb;

    --text-main: #1f2937;
    --text-muted: #6b7280;
    --text-light: #ffffff;

    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --font-main: 'Noto Sans SC', system-ui, -apple-system, sans-serif;
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    /* Fallback or specific gradient choice - keeping it light and airy */
    background: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
    color: var(--text-main);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
    box-shadow: var(--glass-shadow);
}

.logo h1 {
    font-size: 1.5rem;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* Main Workspace (Single Column) */
.main-workspace {
    max-width: 900px;
    margin: 0 auto;
}

/* Top Actions Bar */
.top-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.top-actions .spacer {
    flex: 1;
}

/* Side Drawer */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 90vw;
    height: 100vh;
    background: white;
    z-index: 950;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}

.drawer.active {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.drawer-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.drawer-body {
    padding: 24px;
}

/* Compact Form Styles */
.compact-form-panel {
    padding: 16px 20px;
    margin-bottom: 16px;
}

.compact-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-row-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.form-group-sm {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group-sm label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group-sm select,
.form-group-sm input {
    padding: 6px 10px;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-sm);
    background: white;
    min-width: 90px;
    height: 32px;
    box-sizing: border-box;
}

.form-group-sm input[type="text"] {
    min-width: 120px;
}

.row-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    min-width: 60px;
    flex-shrink: 0;
}

.tags-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.tag-sm {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.8rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    height: 28px;
    box-sizing: border-box;
}

.tag-sm:hover {
    background: #e5e7eb;
}

.tag-sm input {
    display: none;
}

.tag-sm:has(input:checked) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 500;
}

.tag-sm.scenario:has(input:checked) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.custom-input-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
    border: 1px dashed #d1d5db;
    border-radius: 999px;
    background: transparent;
    width: 80px;
    height: 28px;
    box-sizing: border-box;
}

.custom-input-sm:focus {
    border-color: var(--primary);
    outline: none;
}

/* Inline actions container */
.form-actions-inline {
    display: flex;
    gap: 8px;
    margin-left: auto;
    align-items: center;
}

/* Smaller buttons for compact form */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Legacy: Keep old grid for fallback but add display:none */
.workflow-container {
    display: none;
}

/* Panels */
.panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
    padding: 24px;
    box-shadow: var(--glass-shadow);
    transition: transform 0.2s ease;
}

.panel:hover {
    transform: translateY(-2px);
}

.panel-header {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 12px;
}

.panel-header h2 {
    font-size: 1.25rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Placeholders */
.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 20px;
    border: 2px dashed rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
}

/* Action Bar */
.action-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin: 12px 0;
}

.btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
}

.btn-lg {
    padding: 14px 40px;
    font-size: 1.1rem;
    border-radius: var(--radius-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #ccc;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    max-width: 600px;
    text-align: center;
}

.progress-bar {
    height: 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
}

.hidden {
    display: none !important;
}

/* Form Styles */
.student-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-main);
}

.required {
    color: #ef4444;
}

input[type="text"],
select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.8);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

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

.form-row.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

/* Tags Input */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-checkbox {
    cursor: pointer;
}

.tag-checkbox input {
    display: none;
}



/* 使用 ::after 或直接操作父元素样式比较困难，这里假设简单的文本节点样式化
   更推荐的方式是 tag-checkbox 本身作为容器 */
.tag-checkbox {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.2s;
    user-select: none;
}

.tag-checkbox.checked {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.custom-tag-input input {
    width: 100px;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px dashed #d1d5db;
    background: transparent;
}

/* Radio Cards */
.radio-group-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.radio-card {
    cursor: pointer;
}

.radio-card input {
    display: none;
}

.card-content {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid #d1d5db;
    border-radius: var(--radius-md);
    padding: 12px;
    transition: all 0.2s;
    height: 100%;
}

.radio-card input:checked+.card-content {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.card-content .title {
    font-weight: 600;
    margin-bottom: 4px;
}

.card-content .desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

@media (max-width: 600px) {

    .form-row,
    .form-row.three-col,
    .radio-group-cards {
        grid-template-columns: 1fr;
    }
}

/* Import Styles */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

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

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.4);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.drop-zone .icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    display: block;
}

.drop-zone p {
    color: var(--text-main);
    font-weight: 500;
}

.sub-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.template-link {
    text-align: center;
    margin-top: 12px;
}

.template-link a {
    color: var(--primary-color);
    font-size: 0.9rem;
    text-decoration: none;
}

.template-link a:hover {
    text-decoration: underline;
}

#pasteArea {
    width: 100%;
    height: 150px;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-md);
    resize: vertical;
    font-family: monospace;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.8);
}

#pasteArea:focus {
    outline: none;
    border-color: var(--primary-color);
}

#parsePasteBtn {
    margin-top: 8px;
    width: 100%;
}

.import-preview {
    margin-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 16px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.btn-text {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 8px;
}

.text-danger {
    color: #ef4444;
}

.preview-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-item {
    background: rgba(255, 255, 255, 0.5);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-item .name {
    font-weight: 600;
}

.preview-item .info {
    color: var(--text-muted);
    font-size: 0.8rem;
}




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

.table-container {
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.results-table th,
.results-table td {
    padding: 14px 16px;
    text-align: left;
    vertical-align: top;
}

/* 表头样式 - 更强对比度 */
.results-table th {
    font-weight: 600;
    font-size: 0.85rem;
    color: #5b6b7d;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* 姓名列 - 固定宽度，强调 */
.results-table td:first-child {
    font-weight: 600;
    color: var(--text-primary);
    width: 80px;
    min-width: 80px;
}

/* 信息列 - 固定宽度，次要信息 */
.results-table td:nth-child(2) {
    width: 100px;
    min-width: 100px;
    color: #64748b;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* 评语内容列 - 自动扩展，良好可读性 */
.results-table td:nth-child(3) {
    line-height: 1.8;
    color: #334155;
    font-size: 0.95rem;
    padding-right: 24px;
}

/* 操作列 - 固定宽度 */
.results-table td:last-child {
    width: 60px;
    min-width: 60px;
    text-align: center;
    vertical-align: middle;
}

/* 斑马条纹 - 交替行背景 */
.results-table tbody tr:nth-child(odd) {
    background: #ffffff;
}

.results-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

/* 行悬停效果 */
.results-table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #e2e8f0;
}

.results-table tbody tr:hover {
    background: linear-gradient(90deg, #eef2ff 0%, #faf5ff 100%);
    box-shadow: inset 4px 0 0 var(--primary-color);
}

/* 最后一行无边框 */
.results-table tbody tr:last-child {
    border-bottom: none;
}

/* 内容单元格 - 评语区域优化 */
.results-table .content-cell {
    max-height: 150px;
    overflow-y: auto;
    display: block;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.results-table .content-cell::-webkit-scrollbar {
    width: 4px;
}

.results-table .content-cell::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* 复制按钮优化 */
.results-table .btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}


.main-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 24px;
}

.bg-red {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.bg-red:hover {
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* Queue Panel Styles */
.queue-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.queue-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.queue-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
}

.queue-empty p {
    font-weight: 500;
    margin-bottom: 4px;
}

.queue-item {
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.queue-item:hover {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.queue-item .info {
    flex: 1;
}

.queue-item .name {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.queue-item .details {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.tag-mini {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.7rem;
    background: #f3f4f6;
    border-radius: 4px;
    color: #6b7280;
}

.tag-mini.style {
    background: #dbeafe;
    color: #1d4ed8;
}

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

.tag-mini.trait {
    background: #fef3c7;
    color: #92400e;
}

.tag-mini.position {
    background: #d1fae5;
    color: #065f46;
}

.queue-item .remove-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 1.1rem;
    transition: color 0.2s;
    margin-top: 4px;
}

.queue-item .remove-btn:hover {
    color: #ef4444;
}

/* Button Block Style */
.btn-block {
    width: 100%;
}

.form-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Confirmation Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    margin-bottom: 12px;
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-outline {
    background: transparent;
    border: 1px solid #d1d5db;
    color: var(--text-main);
}

/* Large Modal & History Styles */
.modal-content.modal-lg {
    max-width: 800px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

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

.modal-footer {
    padding: 12px 24px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: #f9fafb;
    border: 1px solid #eee;
    border-radius: var(--radius-sm);
    padding: 12px;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.history-item-content {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-main);
}

.text-sm {
    font-size: 0.85rem;
}