/* style.css - 样式文件 */

/* ========================================
   基础样式
======================================== */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #2D2A26;
}

h1, h2, h3, h4 {
    font-family: 'Crimson Pro', serif;
}

/* ========================================
   模式切换标签
======================================== */

.mode-tab {
    background: white;
    color: #3A3632;
    border: 2px solid transparent;
}

.mode-tab:hover {
    background: #FFF9F0;
    border-color: #F4A261;
}

.mode-tab.active {
    background: linear-gradient(135deg, #E07B39 0%, #F4A261 100%);
    color: white;
    border-color: #E07B39;
    box-shadow: 0 4px 12px rgba(224, 123, 57, 0.3);
}

/* ========================================
   作文类型标签
======================================== */

.essay-type-tab {
    background: white;
    color: #3A3632;
    border: 2px solid transparent;
}

.essay-type-tab:hover:not(:disabled) {
    background: #FFF9F0;
    border-color: #F4A261;
}

.essay-type-tab.active {
    background: linear-gradient(135deg, #E07B39 0%, #F4A261 100%);
    color: white;
    border-color: #E07B39;
    box-shadow: 0 4px 12px rgba(224, 123, 57, 0.3);
}

/* ========================================
   拖拽区域
======================================== */

.dragover {
    background: linear-gradient(135deg, #FFF9F0 0%, #FFE8CC 100%) !important;
    border-color: #E07B39 !important;
    transform: scale(1.02);
}

/* ========================================
   加载动画
======================================== */

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #F8F4EC;
    border-top-color: #E07B39;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid #F8F4EC;
    border-top-color: #E07B39;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   图片预览项
======================================== */

.image-preview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: white;
    border: 1px solid #F4A261;
    border-radius: 8px;
    transition: all 0.3s;
}

.image-preview-item:hover {
    background: #FFF9F0;
    box-shadow: 0 2px 8px rgba(224, 123, 57, 0.2);
}

.image-preview-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #F4A261;
}

.image-preview-item .info {
    flex: 1;
    min-width: 0;
}

.image-preview-item .name {
    font-size: 12px;
    font-weight: 500;
    color: #2D2A26;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-preview-item .size {
    font-size: 11px;
    color: #3A3632;
    opacity: 0.6;
}

.image-preview-item .remove-btn {
    padding: 4px 12px;
    background: #FEE;
    color: #E53E3E;
    border: 1px solid #FCC;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.image-preview-item .remove-btn:hover {
    background: #FCC;
    border-color: #E53E3E;
}

/* ========================================
   字数统计样式
======================================== */

.word-count-good {
    color: #38A169;
    font-weight: 500;
}

.word-count-warning {
    color: #DD6B20;
    font-weight: 500;
}

/* ========================================
   批改结果卡片
======================================== */

.grading-card {
    background: white;
    border: 1px solid #F4A261;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s;
}

.grading-card:hover {
    box-shadow: 0 4px 12px rgba(224, 123, 57, 0.15);
    transform: translateY(-2px);
}

.grading-card h4 {
    font-size: 16px;
    font-weight: 600;
    color: #2D2A26;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #F4A261;
}

.grading-card .content {
    font-size: 14px;
    color: #3A3632;
    line-height: 1.8;
}

.grading-card ul {
    list-style: none;
    padding-left: 0;
}

.grading-card ul li {
    padding-left: 24px;
    position: relative;
    margin-bottom: 8px;
}

.grading-card ul li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #E07B39;
    font-weight: bold;
    font-size: 18px;
}

/* 范文卡片特殊样式 */
.model-answer-card {
    background: linear-gradient(135deg, #FFF9F0 0%, #FFE8CC 100%);
    border: 2px solid #F4A261;
}

.model-answer-card .content {
    font-family: 'Crimson Pro', serif;
    font-size: 15px;
    line-height: 2;
    color: #2D2A26;
}

/* ========================================
   Toast 提示
======================================== */

.success-toast,
.error-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
}

.success-toast {
    background: linear-gradient(135deg, #38A169 0%, #48BB78 100%);
    color: white;
}

.error-toast {
    background: linear-gradient(135deg, #E53E3E 0%, #FC8181 100%);
    color: white;
}

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

/* ========================================
   滚动条样式
======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #F8F4EC;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #E07B39 0%, #F4A261 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #D87645 0%, #E39550 100%);
}

/* ========================================
   响应式设计
======================================== */

@media (max-width: 768px) {
    /* 移动端优化 */
    header h1 {
        font-size: 20px;
    }
    
    .mode-tab,
    .essay-type-tab {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    main {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .grid.md\\:grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .grading-card h4 {
        font-size: 14px;
    }
    
    .grading-card .content {
        font-size: 13px;
    }
    
    /* 移动端按钮组 */
    .flex.gap-2 {
        flex-direction: column;
        gap: 8px;
    }
    
    .flex.gap-2 button {
        width: 100%;
    }
    
    /* Toast 移动端优化 */
    .success-toast,
    .error-toast {
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

/* ========================================
   打印样式
======================================== */

@media print {
    header,
    footer,
    button {
        display: none;
    }
    
    .bg-gradient-to-br {
        background: white !important;
    }
    
    .grading-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ========================================
   辅助类
======================================== */

.hidden {
    display: none !important;
}

.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 防止文本溢出 */
.text-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   动画效果
======================================== */

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

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 按钮点击效果 */
button:active:not(:disabled) {
    transform: scale(0.98);
}

/* 焦点样式 */
button:focus-visible,
textarea:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 2px solid #E07B39;
    outline-offset: 2px;
}

/* ========================================
   暗色模式支持（可选）
======================================== */

@media (prefers-color-scheme: dark) {
    /* 如果需要支持暗色模式，在这里添加样式 */
}