/* ===== PDF 翻译工具专用样式 ===== */

/* Hero 区域 */
.translator-hero {
    min-height: 40vh;
    background: var(--gradient-hero);
    position: relative;
    display: flex;
    align-items: center;
    padding-top: 80px;
    overflow: hidden;
}

.translator-hero-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 2rem;
    text-align: center;
    width: 100%;
}

.translator-hero-content h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 1rem;
    animation: fadeInUp 0.8s ease;
}

.translator-hero-content .hero-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    animation: fadeInUp 0.8s ease 0.2s backwards;
}

/* 聊天机器人按钮区域 */
.chatbot-button-section {
    background: var(--bg-light);
    padding: 3rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-buttons-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.hero-buttons-row .chatbot-large-btn {
    min-width: 280px;
}

.chatbot-large-btn.converter-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.4);
}

.chatbot-large-btn.converter-btn:hover {
    box-shadow: 0 12px 40px rgba(124, 58, 237, 0.5);
}

.chatbot-large-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem 4rem;
    min-width: 400px;
    background: var(--gradient-btn);
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 600;
    border: none;
    border-radius: 60px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(6, 182, 212, 0.4);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.chatbot-large-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.chatbot-large-btn:hover::before {
    left: 100%;
}

.chatbot-large-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(6, 182, 212, 0.5);
}

.chatbot-large-btn .arrow-icon {
    transition: transform 0.3s ease;
}

.chatbot-large-btn:hover .arrow-icon {
    transform: translateX(6px);
}

@media (max-width: 768px) {
    .hero-buttons-row {
        flex-direction: column;
    }
    .hero-buttons-row .chatbot-large-btn,
    .chatbot-large-btn {
        min-width: auto;
        width: 100%;
        max-width: 350px;
        padding: 1.25rem 2rem;
        font-size: 1.25rem;
    }
}

/* 主要功能区域 */
.translator-main {
    padding: 4rem 2rem;
    background: var(--bg-light);
}

.translator-container {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
    align-items: start;
}

/* 上传区域 */
.upload-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.upload-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.upload-area {
    padding: 3rem 2rem;
    text-align: center;
    border: 2px dashed rgba(6, 182, 212, 0.3);
    border-radius: 16px;
    margin: 1rem;
    transition: var(--transition);
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.05);
}

.upload-area.dragover {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    color: var(--accent-cyan);
    margin-bottom: 1rem;
}

.upload-area h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.upload-area > p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.upload-area .supported-formats {
    font-size: 0.8rem;
    color: var(--accent-cyan);
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.upload-btn {
    background: var(--gradient-btn);
    color: var(--white);
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4);
}

/* 文件信息 */
.file-info {
    display: none;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(6, 182, 212, 0.1);
    margin: 0 1rem 1rem;
    border-radius: 10px;
}

.file-info.active {
    display: flex;
}

.file-icon {
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 600;
    color: var(--text-dark);
    word-break: break-all;
}

.file-size {
    font-size: 0.85rem;
    color: var(--text-light);
}

.remove-file-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.remove-file-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* API Key 区域 */
.api-key-section {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
}

.api-key-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.api-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.15));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-purple);
}

.api-key-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
}

/* AI 服务商选择 */
.provider-select-wrapper {
    margin-bottom: 1rem;
}

.provider-select-wrapper label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.provider-select-wrapper select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.95rem;
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 18px;
}

.provider-select-wrapper select:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

/* 使用默认 API Key 勾选框 */
.use-default-api {
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(59, 130, 246, 0.08) 100%);
    border-radius: 10px;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 22px;
    height: 22px;
    border: 2px solid var(--accent-cyan);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark {
    background: var(--gradient-btn);
    border-color: transparent;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.checkbox-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-dark);
}

.api-key-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.api-key-input-wrapper input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: 'Courier New', monospace;
    transition: var(--transition);
}

.api-key-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

.toggle-visibility {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
    transition: var(--transition);
}

.toggle-visibility:hover {
    color: var(--text-dark);
}

.api-tutorial-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(59, 130, 246, 0.1));
    border-radius: 8px;
    color: var(--accent-cyan);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.api-tutorial-link:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(59, 130, 246, 0.2));
    transform: translateX(3px);
}

.api-key-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.api-key-hint::before {
    content: '🔒';
    font-size: 0.9rem;
}

/* 翻译选项 */
.translation-options {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
}

.translation-options h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.option-group {
    margin-bottom: 1rem;
}

.option-group:last-child {
    margin-bottom: 0;
}

.option-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.option-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.95rem;
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 18px;
}

.option-group select:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

/* 开始翻译按钮 */
.translate-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: var(--gradient-btn);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.translate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(6, 182, 212, 0.4);
}

.translate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 结果区域 */
.result-section {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.result-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.result-actions {
    display: flex;
    gap: 0.75rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}

/* 下载下拉菜单 */
.download-dropdown {
    position: relative;
}

.download-dropdown .action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-arrow {
    margin-left: 0.25rem;
    transition: transform 0.2s ease;
}

.download-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.download-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
    overflow: hidden;
}

.download-dropdown.active .download-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.download-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: none;
    border: none;
    font-size: 0.9rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.download-option:hover {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
}

.download-option svg {
    flex-shrink: 0;
}

.download-option:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

/* 进度条 */
.progress-section {
    display: none;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.progress-section.active {
    display: block;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-text {
    font-weight: 500;
    color: var(--text-dark);
}

.progress-percent {
    font-weight: 600;
    color: var(--accent-cyan);
}

.progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-btn);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-detail {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.75rem;
}

/* 结果内容 */
.result-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    color: var(--text-light);
}

/* 停止翻译按钮样式 */
.translate-btn.cancelling {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.empty-icon {
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.95rem;
}

/* 翻译列表 */
.translation-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.translation-item {
    position: relative;
    background: var(--bg-light);
    border-radius: 12px;
    padding: 1.25rem;
    transition: var(--transition);
}

.translation-item:hover {
    box-shadow: var(--shadow-sm);
}

.original-text,
.translated-text {
    margin-bottom: 1rem;
}

.translated-text {
    margin-bottom: 0;
}

.text-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.original-text .text-label {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}

.translated-text .text-label {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.original-text p,
.translated-text p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-dark);
}

.copy-item-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--white);
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    color: var(--text-light);
    cursor: pointer;
    opacity: 0;
    transition: var(--transition);
}

.translation-item:hover .copy-item-btn {
    opacity: 1;
}

.copy-item-btn:hover {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}

/* 翻译条目淡入动画 */
.translation-item {
    animation: fadeInItem 0.3s ease forwards;
    opacity: 0;
}

@keyframes fadeInItem {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.translation-item:nth-child(1) { animation-delay: 0.05s; }
.translation-item:nth-child(2) { animation-delay: 0.1s; }
.translation-item:nth-child(3) { animation-delay: 0.15s; }
.translation-item:nth-child(4) { animation-delay: 0.2s; }
.translation-item:nth-child(5) { animation-delay: 0.25s; }
.translation-item:nth-child(n+6) { animation-delay: 0.3s; }

/* 功能特点区域 */
.features-section {
    padding: 5rem 2rem;
    background: var(--white);
}

.features-container {
    max-width: 1280px;
    margin: 0 auto;
    text-align: center;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.feature-card {
    background: var(--bg-light);
    padding: 2rem 1.5rem;
    border-radius: 16px;
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(59, 130, 246, 0.15));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    color: var(--accent-cyan);
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .translator-container {
        grid-template-columns: 1fr;
    }

    .upload-section {
        order: 1;
    }

    .result-section {
        order: 2;
        min-height: 500px;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .translator-hero-content h1 {
        font-size: 2rem;
    }

    .result-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .result-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .features-grid {
        grid-template-columns: 1fr;
    }

    .action-btn span {
        display: none;
    }

    .action-btn {
        padding: 0.5rem;
    }
}
