/* PDF文本替换工具样式 */

/* Toast消息系统 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    backdrop-filter: blur(8px);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px;
    min-width: 280px;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    display: none;
    animation: slideInRight 0.3s ease;
    font-size: 14px;
    font-weight: 600;
}

.toast.show {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success {
    border-left: 4px solid #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.toast.error {
    border-left: 4px solid #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.toast.warning {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.toast.info {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 容器 */
.pdf-replace-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px;
    animation: fadeIn 0.4s ease;
}

/* 步骤区域 */
.step-section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.step-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.step-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.step-header h3 {
    margin: 0;
    font-size: 17px;
    color: #1f2937;
    font-weight: 600;
}

/* 文件上传区域 */
.upload-area {
    position: relative;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 32px;
    text-align: center;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.upload-area.dragover {
    border-color: #2563eb;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    transform: scale(1.02);
}

.file-input {
    display: none;
}

.upload-icon {
    font-size: 48px;
    color: #3b82f6;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.upload-hint {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 8px;
}

.file-info {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 12px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
    animation: fadeIn 0.3s ease;
}

.file-info.show {
    display: flex;
}

.file-name-display {
    color: #065f46;
    font-size: 13px;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 替换规则 */
.replace-rules {
    margin-bottom: 20px;
}

.rule-item {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    padding: 12px;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.rule-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transform: translateX(2px);
}

.rule-item input {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.rule-item input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-remove {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.btn-remove:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.btn-add {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-add:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.button {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.button:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.button:disabled,
.button.btn-disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.button:disabled:hover,
.button.btn-disabled:hover {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    transform: none;
    box-shadow: none;
}

/* 选项区域 */
.options-section {
    margin-bottom: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.options-section label strong {
    color: #1f2937;
    font-size: 15px;
}

.checkbox-group {
    margin: 12px 0;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: color 0.2s ease;
}

.checkbox-group label:hover {
    color: #3b82f6;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* AI辅助区域 */
.ai-assist {
    margin-top: 20px;
    padding: 18px;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fbbf24;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

.ai-assist label strong {
    color: #92400e;
    font-size: 15px;
}

.ai-desc {
    font-size: 13px;
    color: #78350f;
    margin: 10px 0;
}

.ai-prompt-input {
    width: calc(100% - 130px);
    padding: 10px 12px;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.ai-prompt-input:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.ai-result {
    margin-top: 12px;
    display: none;
}

.ai-result.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.ai-suggestions {
    background: white;
    padding: 12px;
    border-radius: 6px;
    margin-top: 8px;
    border: 1px solid #fbbf24;
    max-height: 300px;
    overflow-y: auto;
}

.ai-suggestions p {
    text-align: center;
    color: #6b7280;
    margin: 0;
}

.ai-suggestion-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-suggestion-item {
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    transition: all 0.2s ease;
}

.ai-suggestion-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.ai-suggestion-item code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: #1f2937;
}

.suggestion-desc {
    color: #6b7280;
    font-size: 12px;
    margin-top: 4px;
}

.btn-apply-suggestion {
    margin-top: 8px;
    padding: 6px 12px;
    font-size: 12px;
}

.ai-button {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
    margin-left: 10px;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.ai-button:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

.ai-button:disabled,
.ai-button.btn-disabled {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
    color: #6b7280;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.ai-button:disabled:hover,
.ai-button.btn-disabled:hover {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
    transform: none;
    box-shadow: none;
}

/* 结果展示 */
.query-result {
    margin-top: 20px;
    padding: 20px;
    border-radius: 10px;
    animation: fadeIn 0.4s ease;
}

.query-result h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: #1f2937;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.query-result h3::before {
    content: '📊';
    font-size: 20px;
}

.success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-left: 4px solid #10b981;
    color: #065f46;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
    animation: slideInUp 0.3s ease-out;
}

.success p {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.success ul {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}

.success ul li {
    padding: 8px 12px;
    margin: 6px 0;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    border-left: 3px solid #10b981;
    font-size: 14px;
    transition: all 0.2s ease;
}

.success ul li:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(4px);
}

.success .button {
    margin-top: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.success .button::before {
    content: '📥';
    font-size: 18px;
}

.error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fca5a5;
    border-left: 4px solid #ef4444;
    color: #991b1b;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
    animation: slideInDown 0.3s ease-out;
}

.error p {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.submit-hint {
    margin-left: 15px;
    color: #6b7280;
    font-size: 13px;
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.processing {
    position: relative;
    overflow: hidden;
}

.processing::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .rule-item {
        grid-template-columns: 1fr 1fr auto;
        gap: 8px;
    }
}

@media (max-width: 768px) {
    .step-section {
        padding: 16px;
    }
    
    .rule-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .ai-prompt-input {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .ai-button {
        margin-left: 0;
        width: 100%;
    }
    
    .submit-hint {
        display: block;
        margin-left: 0;
        margin-top: 10px;
    }
    
    .button {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .pdf-replace-container {
        padding: 8px;
    }
    
    .step-section {
        padding: 14px;
        margin-bottom: 12px;
    }
    
    .step-header h3 {
        font-size: 15px;
    }
    
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }
    
    .upload-area {
        padding: 20px;
    }
    
    .upload-icon {
        font-size: 40px;
    }
    
    .button {
        padding: 10px 20px;
        font-size: 14px;
        width: 100%;
    }
    
    .btn-add,
    .btn-remove {
        font-size: 11px;
        padding: 6px 12px;
        width: 100%;
    }
    
    .btn-remove {
        margin-top: 8px;
    }
    
    .checkbox-group {
        margin: 8px 0;
    }
    
    .checkbox-group label {
        font-size: 13px;
    }
    
    .ai-prompt-input {
        font-size: 13px;
    }
    
    .toast {
        min-width: auto;
        left: 12px;
        right: 12px;
        padding: 12px;
        font-size: 13px;
    }
    
    .query-result {
        padding: 14px;
    }
    
    .query-result h3 {
        font-size: 16px;
    }
    
    .query-result ul {
        font-size: 13px;
    }
}
