:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #4cc9f0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --success-color: #06d6a0;
    --warning-color: #ffd166;
    --danger-color: #ef476f;
    --border-radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

* {
    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: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--dark-color);
}

.container {
    max-width: 1920px;
    margin: 0 auto;
}

.header {
    color: white;
    margin-bottom: 20px;
    padding: 12px 20px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1920px;
    margin: 0 auto;
}

.header-title {
    text-align: center;
    flex: 1;
}

.header h1 {
    font-size: 1.8em;
    margin-bottom: 4px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    font-weight: 600;
}

.subtitle {
    font-size: 0.9em;
    opacity: 0.85;
}

.user-menu {
    position: relative;
}

.user-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
    transition: var(--transition);
}

.user-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.user-icon {
    font-size: 1.2em;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    min-width: 200px;
    display: none;
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown.show {
    display: block;
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-info {
    padding: 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.user-name {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 4px;
}

.user-email {
    font-size: 0.85em;
    color: #6c757d;
}

.dropdown-divider {
    height: 1px;
    background: #e9ecef;
}

.dropdown-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95em;
    color: var(--dark-color);
    transition: var(--transition);
}

.dropdown-item:hover {
    background: #f8f9fa;
}

.dropdown-item span {
    font-size: 1.1em;
}

.main-content {
    display: grid;
    grid-template-columns: 320px 1fr 400px;
    gap: 20px;
    height: calc(100vh - 120px);
}

.input-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 25px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.card {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    margin-bottom: 25px;
    transition: none;
}

.card:hover {
    transform: none;
    box-shadow: none;
}

.card h2 {
    font-size: 1.2em;
    margin-bottom: 16px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

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

.card-header h2 {
    margin-bottom: 0;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
    line-height: 1.5;
}

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

.upload-area {
    border: 2px dashed #adb5bd;
    border-radius: var(--border-radius);
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #f8f9fa;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.upload-area.dragover {
    background: #e8ebff;
    border-color: var(--primary-color);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 5px;
}

.file-list {
    margin-top: 16px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f1f3f5;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.file-item:hover {
    background: #e9ecef;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    font-size: 0.85em;
    color: #6c757d;
}

.remove-file {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
}

.remove-file:hover {
    background: #dc3545;
}

.generate-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    margin-top: auto;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.2em;
}

.output-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.output-section .card {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin-bottom: 0;
    padding: 25px;
}

.output-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 14px;
    line-height: 1.8;
    background: #fafafa;
}

.output-content h2 {
    font-size: 1.5em;
    color: var(--primary-color);
    margin: 16px 0 12px 0;
    font-weight: 600;
}

.output-content h3 {
    font-size: 1.3em;
    color: var(--secondary-color);
    margin: 14px 0 10px 0;
    font-weight: 600;
}

.output-content h4 {
    font-size: 1.1em;
    color: #555;
    margin: 12px 0 8px 0;
    font-weight: 600;
}

.output-content p {
    margin: 8px 0;
    text-align: justify;
}

.output-content:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.output-content .placeholder {
    color: #999;
    font-style: italic;
}

.icon-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.2em;
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* AI对话面板 */
.chat-panel {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
}

.chat-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

.chat-subtitle {
    font-size: 0.9rem;
    color: #6c757d;
    margin-top: 5px;
}

.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.chat-message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    flex-shrink: 0;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.bot-message .message-avatar {
    background: #f0f0f0;
}

.message-text {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.6;
    font-size: 14px;
    max-width: 85%;
}

.user-message .message-text {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-text {
    background: #f1f3f5;
    color: var(--dark-color);
    border-bottom-left-radius: 4px;
}

.message-text ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.message-text li {
    margin: 4px 0;
}

.chat-input-area {
    padding: 16px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 8px;
    background: #fafafa;
}

.chat-input-area textarea {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    transition: var(--transition);
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chat-send-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.chat-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chat-send-btn:active {
    transform: translateY(0);
}

.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.output-content::-webkit-scrollbar {
    width: 8px;
}

.output-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.output-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.output-content::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.input-section::-webkit-scrollbar {
    width: 8px;
}

.input-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.input-section::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.input-section::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: var(--dark-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    color: #6c757d;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--dark-color);
}

.modal-body {
    padding: 25px;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: var(--dark-color);
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 1em;
    transition: var(--transition);
}

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

.form-input[readonly] {
    background: #f8f9fa;
    cursor: not-allowed;
}

.error-message {
    background: #fee;
    color: var(--danger-color);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    font-size: 0.9em;
}

.error-message.show {
    display: block;
}

.success-message {
    background: #efe;
    color: var(--success-color);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    font-size: 0.9em;
}

.success-message.show {
    display: block;
}

/* 加载对话框样式 */
#loadingModal .modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    padding: 40px 50px;
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(102, 126, 234, 0.3);
    text-align: center;
    max-width: 380px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#loadingModal .modal-content p {
    margin: 0;
    font-size: 1.1em;
    color: #555;
    font-weight: 500;
}

/* 现代化加载动画容器 */
.loading-animation {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 25px;
}

/* 主旋转圆环 */
.spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100px;
    height: 100px;
    border: 4px solid transparent;
    border-top: 4px solid var(--primary-color);
    border-right: 4px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 内圈旋转 */
.spinner-inner {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 70px;
    height: 70px;
    border: 3px solid transparent;
    border-bottom: 3px solid var(--accent-color);
    border-left: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite reverse;
}

/* 中心图标 */
.spinner-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    animation: pulse 1.5s ease-in-out infinite;
}

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

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.8;
    }
}

/* 加载进度点 */
.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 加载提示文字动画 */
.loading-text {
    font-size: 1.1em;
    color: #555;
    font-weight: 500;
    margin-top: 5px;
}

.loading-subtext {
    font-size: 0.85em;
    color: #888;
    margin-top: 8px;
}

.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 2000;
    display: none;
    animation: slideIn 0.3s;
}

.message.show {
    display: block;
}

.message.success {
    background: var(--success-color);
    color: white;
}

.message.error {
    background: var(--danger-color);
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 300px 1fr 350px;
    }
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 280px 1fr;
        grid-template-rows: 1fr auto;
        height: auto;
        min-height: calc(100vh - 120px);
    }
    
    .chat-panel {
        grid-column: 1 / -1;
        height: 500px;
        margin-top: 20px;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
    }
    
    .chat-panel {
        grid-column: 1;
        height: 400px;
    }
    
    .input-section {
        margin-bottom: 20px;
    }
}

/* 模板和素材选择样式 */
.card-header-with-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.mode-select {
    padding: 6px 12px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 0.9em;
    background: white;
    color: var(--dark-color);
    cursor: pointer;
    transition: var(--transition);
    min-width: 100px;
}

.mode-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.mode-select:hover {
    border-color: var(--primary-color);
}

.select-list {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 1em;
    margin-bottom: 10px;
}

.btn-small {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9em;
    transition: var(--transition);
}

.btn-small:hover {
    background: var(--secondary-color);
}

.material-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 8px;
}

.material-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
}

.material-item:last-child {
    margin-bottom: 0;
}

.material-item-name {
    font-weight: 500;
    color: var(--dark-color);
}

.material-item-actions {
    display: flex;
    gap: 8px;
}

.material-item-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: var(--transition);
}

.material-item-btn.select {
    background: var(--primary-color);
    color: white;
}

.material-item-btn.delete {
    background: var(--danger-color);
    color: white;
}

.material-item-btn:hover {
    opacity: 0.8;
}

/* 设置对话框标签页 */
.settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.settings-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    color: #6c757d;
    cursor: pointer;
    font-size: 1em;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}

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

.settings-tab-content {
    display: none;
    padding-top: 20px;
}

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

.template-list, .material-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 20px;
}

.template-item, .material-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}

.template-item-name, .material-item-name {
    font-weight: 500;
    color: var(--dark-color);
    flex: 1;
}

.template-item-actions, .material-item-actions {
    display: flex;
    gap: 8px;
}

.template-item-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: var(--transition);
}

.template-item-btn.edit {
    background: var(--primary-color);
    color: white;
}

.template-item-btn.delete {
    background: var(--danger-color);
    color: white;
}

.template-item-btn:hover {
    opacity: 0.8;
}

.upload-area-small {
    border: 2px dashed #adb5bd;
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #f8f9fa;
}

.upload-area-small:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.file-info-display {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9em;
}

/* 模式切换按钮组样式 */
.mode-toggle {
    display: flex;
    background: #f1f3f5;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.mode-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    color: #6c757d;
    transition: var(--transition);
    white-space: nowrap;
}

.mode-btn:hover {
    color: var(--primary-color);
}

.mode-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.action-divider {
    width: 1px;
    height: 24px;
    background: #dee2e6;
    margin: 0 8px;
    align-self: center;
}

/* 预览模式样式 */
.output-content.preview-mode {
    background: white;
}

.output-content.preview-mode .citation-tag {
    display: none !important;
}

/* 编辑模式提示 */
.mode-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #e8f4fd;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.85em;
    color: #0066cc;
}

.mode-indicator.preview {
    background: #e8f5e9;
    color: #2e7d32;
}

.mode-indicator-icon {
    font-size: 1em;
}

/* 引用提示条样式 */
.citation-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.citation-hint-icon {
    font-size: 1.1em;
}

.citation-hint-text {
    font-size: 0.85em;
    color: #555;
}

.citation-tag-demo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-size: 0.7em;
    font-weight: 600;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    vertical-align: middle;
}

/* 引用标签样式 */
.citation-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-size: 0.7em;
    font-weight: 600;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-left: 2px;
    cursor: pointer;
    position: relative;
    vertical-align: super;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.citation-tag:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.5);
}

/* 引用弹出框 - 使用伪元素和 attr() 显示，避免内容污染 */
.citation-tag::before {
    content: '📄 ' attr(data-source);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 10px 14px;
    min-width: 200px;
    max-width: 300px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.citation-tag::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0 8px;
    border-style: solid;
    border-color: white transparent transparent transparent;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

.citation-tag:hover::before,
.citation-tag:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 引用面板（侧边栏显示所有引用） */
.references-panel {
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border: 1px solid #e9ecef;
}

.references-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--primary-color);
}

.references-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reference-item {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: var(--transition);
}

.reference-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.reference-number {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-size: 0.8em;
    font-weight: 600;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.reference-content {
    flex: 1;
    min-width: 0;
}

.reference-source {
    font-size: 0.8em;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 4px;
}

.reference-text {
    font-size: 0.85em;
    color: #666;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
