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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: 
        radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(16, 185, 129, 0.05) 0%, transparent 50%),
        linear-gradient(145deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    padding: 0;
    overflow-x: hidden;
}

.header {
    background: white;
    padding: 16px 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
}

.header-left h1 {
    font-size: 24px;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: -0.3px;
}

.subtitle {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
}

.user-profile {
    position: relative;
    cursor: pointer;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.user-info:hover {
    background-color: #f1f5f9;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
}

.user-role {
    font-size: 12px;
    color: #64748b;
    background-color: #f1f5f9;
    padding: 2px 8px;
    border-radius: 12px;
}

.user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 1000;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    color: #1e293b;
    font-size: 14px;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: #f1f5f9;
}

.menu-item span.iconify {
    font-size: 16px;
    color: #64748b;
}

.main-layout {
    display: flex;
    gap: 24px;
    padding: 24px 40px;
    max-width: 1600px;
    margin: 0 auto;
    min-height: calc(100vh - 72px);
}

.left-panel {
    width: 400px;
    flex-shrink: 0;
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    
}

.result-panel {
    flex: 1;
    
}

.optimized-panel {
    flex: 1;
    
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}

.panel-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.panel-icon {
    font-size: 20px;
    color: #3b82f6;
}
.model-selector {
    margin-bottom: 16px;
}

.model-selector label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 8px;
}

.model-selector select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.model-selector select:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.model-selector select:focus {
    outline: none;
    border-color: #3b82f6;
}

.content-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.content-editor textarea {
    flex: 1;
    /* width: 100%; */
    padding: 16px;
    min-height: 400px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.6;
    resize: none;
    background: #f8fafc;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.content-editor textarea:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.content-editor textarea:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
}

.content-editor textarea[readonly] {
    background: #f8fafc;
    cursor: default;
}

.char-count {
    text-align: right;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 8px;
}

.action-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

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

.action-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.result-status {
    margin-bottom: 20px;
}

.result-status p {
    font-size: 14px;
    color: #64748b;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #94a3b8;
}

.result-status.compliant p {
    background: #dcfce7;
    color: #166534;
    border-left-color: #22c55e;
}

.result-status.non-compliant p {
    background: #fee2e2;
    color: #991b1b;
    border-left-color: #ef4444;
}

.violations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    border-radius: 12px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    min-height: 100px;
}

.violation-card {
    background: #fef3c7;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 10px;
    border-left: 4px solid #f59e0b;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.violation-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.violation-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.violation-number {
    background: #f59e0b;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.violation-rule {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 6px;
    padding-left: 28px;
}

.violation-suggestion {
    font-size: 13px;
    color: #334155;
    padding-left: 28px;
    line-height: 1.4;
}

/* 原文批注展示样式 */
.annotated-content-container {
    margin-bottom: 20px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    min-height: 100px;
    overflow-y: auto;
}

.annotated-content {
    font-size: 15px;
    line-height: 1.8;
    color: #1e293b;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.annotated-content .violation-highlight {
    position: relative;
    background: linear-gradient(120deg, #fee2e2 0%, #fecaca 100%);
    padding: 2px 4px;
    border-radius: 4px;
    border-bottom: 2px solid #ef4444;
    cursor: pointer;
    transition: all 0.2s;
}

.annotated-content .violation-highlight:hover {
    background: linear-gradient(120deg, #fecaca 0%, #fca5a5 100%);
}

.annotated-content .violation-highlight::after {
    content: attr(data-violation-index);
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.annotated-content .violation-highlight.high {
    background: linear-gradient(120deg, #fee2e2 0%, #fecaca 100%);
    border-bottom-color: #ef4444;
}

.annotated-content .violation-highlight.medium {
    background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%);
    border-bottom-color: #f59e0b;
}

.annotated-content .violation-highlight.low {
    background: linear-gradient(120deg, #dbeafe 0%, #bfdbfe 100%);
    border-bottom-color: #3b82f6;
}

.annotated-content .violation-highlight.high::after {
    background: #ef4444;
}

.annotated-content .violation-highlight.medium::after {
    background: #f59e0b;
}

.annotated-content .violation-highlight.low::after {
    background: #3b82f6;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    font-size: 14px;
}

.violation-card {
    background: #fef3c7;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 10px;
    border-left: 4px solid #f59e0b;
    animation: slideIn 0.3s ease-out;
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}


/* Toast 样式 */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 200px;
    max-width: 400px;
    text-align: center;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    background: linear-gradient(135deg, #10b981, #059669);
    border-left: 4px solid #047857;
}

.toast-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-left: 4px solid #b91c1c;
}

.toast-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-left: 4px solid #92400e;
}

.toast-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-left: 4px solid #1d4ed8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .toast {
        max-width: 90%;
    }
}

.violation-card.high {
    background: #fee2e2;
    border-left-color: #ef4444;
}

.violation-card.high .violation-number {
    background: #ef4444;
}

.violation-card.medium {
    background: #fef3c7;
    border-left-color: #f59e0b;
}

.violation-card.medium .violation-number {
    background: #f59e0b;
}

.violation-card.low {
    background: #dbeafe;
    border-left-color: #3b82f6;
}

.violation-card.low .violation-number {
    background: #3b82f6;
}

.violation-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.violation-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 50%;
    flex-shrink: 0;
}

.violation-rule {
    color: #64748b;
    font-size: 13px;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.5);
    border-radius: 6px;
}

.violation-suggestion {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
}

.violation-suggestion strong {
    color: #1e293b;
}

.highlight-text {
    background: #fee2e2;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 500;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.secondary-btn {
    flex: 1;
    padding: 12px;
    background: white;
    color: #3b82f6;
    border: 2px solid #3b82f6;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.secondary-btn:hover {
    background: #3b82f6;
    color: white;
}

@media (max-width: 1200px) {
    .main-layout {
        flex-direction: column;
    }
    
    .panel {
        min-height: auto;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 16px 20px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .main-layout {
        padding: 20px;
        gap: 16px;
    }
    
    .panel {
        padding: 20px;
        border-radius: 12px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

.image-upload-section {
    margin-bottom: 16px;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.upload-label:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.upload-label.drag-over {
    border-color: #3b82f6;
    background: #dbeafe;
    transform: scale(1.02);
}

.upload-label input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 32px;
    color: #94a3b8;
    margin-bottom: 12px;
}

.upload-text {
    font-size: 14px;
    color: #64748b;
    text-align: center;
}

.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.image-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
}

.image-preview-item .remove-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.optimized-image-container {
    margin-bottom: 16px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}

.optimized-image-label {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
}

.optimized-image-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.optimized-image-wrapper img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.download-btn .iconify {
    font-size: 16px;
}
