/* ========== 整体容器 ========== */
.tocr-wrapper {
    max-width: 820px;
    margin: 24px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ========== 未登录提示（美化版） ========== */
.tocr-login-prompt {
    max-width: 460px;
    margin: 30px auto;
    padding: 40px 30px;
    text-align: center;
    background: linear-gradient(145deg, #ffffff, #f7f9fc);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #e8ecf1;
}

.tocr-login-prompt-icon {
    font-size: 52px;
    margin-bottom: 16px;
    display: block;
}

.tocr-login-prompt h3 {
    font-size: 22px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 8px 0;
}

.tocr-login-prompt p {
    font-size: 15px;
    color: #646970;
    margin: 0 0 24px 0;
}

.tocr-login-prompt-btn {
    display: inline-block;
    padding: 12px 40px;
    background: #2271b1;
    color: #ffffff !important;
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.25);
}

.tocr-login-prompt-btn:hover {
    background: #135e96;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(34, 113, 177, 0.35);
}

/* ========== 使用次数信息 ========== */
.tocr-usage-info {
    background: #f0f7ff;
    padding: 10px 16px;
    border-radius: 8px;
    border-left: 4px solid #2271b1;
    margin-bottom: 20px;
    font-size: 14px;
    color: #1d2327;
}

.tocr-usage-info strong {
    color: #2271b1;
    font-size: 16px;
}

/* ========== 上传区域 ========== */
.tocr-upload-area {
    border: 2px dashed #d0d5dd;
    border-radius: 12px;
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background-color: #fafcfe;
    position: relative;
}

.tocr-upload-area:hover {
    border-color: #2271b1;
    background-color: #f5f9ff;
}

.tocr-upload-area.dragover {
    border-color: #2271b1;
    background-color: #e8f0fe;
    box-shadow: inset 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.tocr-upload-area p {
    margin: 0 0 6px 0;
    font-size: 15px;
    color: #8c8f94;
}

.tocr-upload-area input[type="file"] {
    display: none;
}

#tocr-file-info {
    margin-top: 8px;
    color: #2271b1;
    font-weight: 500;
    font-size: 14px;
}

/* ========== 缩略图预览 ========== */
#tocr-preview-container {
    margin-top: 14px;
    display: flex;
    justify-content: center;
}

#tocr-preview-image {
    max-width: 280px;
    max-height: 200px;
    border-radius: 8px;
    border: 2px solid #e0e5ea;
    padding: 4px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    object-fit: contain;
}

/* ========== 操作栏（重构） ========== */
.tocr-options {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: #f7f9fc;
    padding: 14px 18px;
    border-radius: 10px;
    border: 1px solid #e8ecf1;
}

.tocr-options-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.tocr-option-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tocr-option-group label {
    font-size: 14px;
    font-weight: 500;
    color: #3c434a;
    white-space: nowrap;
}

.tocr-option-group select {
    padding: 7px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #ffffff;
    font-size: 14px;
    color: #1d2327;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    min-width: 140px;
    appearance: auto;
}

.tocr-option-group select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
}

/* ========== 按钮样式（全新设计） ========== */
.tocr-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 28px;
    background: linear-gradient(135deg, #2271b1 0%, #1a5c8f 100%);
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 10px rgba(34, 113, 177, 0.30);
    white-space: nowrap;
    line-height: 1.4;
}

.tocr-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #1a5c8f 0%, #0f4a73 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(34, 113, 177, 0.40);
}

.tocr-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.15);
}

.tocr-btn-primary .tocr-btn-icon {
    font-size: 17px;
}

.tocr-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 16px;
    background: #ffffff;
    color: #3c434a !important;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.tocr-btn-secondary:hover {
    background: #f0f2f5;
    border-color: #b0b8c4;
    color: #1d2327 !important;
}

.tocr-btn-secondary:active {
    transform: scale(0.97);
}

/* ========== 进度条 ========== */
.tocr-progress {
    margin-top: 16px;
    background: #f0f2f5;
    border-radius: 8px;
    height: 32px;
    position: relative;
    overflow: hidden;
    border: 1px solid #e0e5ea;
}

.tocr-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2271b1, #4a9eff, #2271b1);
    background-size: 200% 100%;
    animation: tocr-shimmer 1.8s infinite linear;
    width: 0%;
    transition: width 0.35s ease;
    border-radius: 8px;
}

@keyframes tocr-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.tocr-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
    text-shadow: 0 0 8px rgba(255,255,255,0.6);
}

/* ========== 结果区域 ========== */
.tocr-result-area {
    margin-top: 20px;
    border: 1px solid #e0e5ea;
    border-radius: 12px;
    padding: 16px 20px 20px;
    background: #fafcfe;
}

.tocr-result-area h4 {
    margin: 0 0 12px 0;
    color: #1d2327;
    font-size: 16px;
    font-weight: 600;
}

.tocr-result-actions {
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#tocr-text-output {
    background: #ffffff;
    padding: 16px 18px;
    border: 1px solid #e8ecf1;
    border-radius: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.7;
    margin: 0;
    color: #1d2327;
}

/* ========== 错误提示 ========== */
.tocr-error {
    margin-top: 14px;
    padding: 10px 16px;
    background: #fef0ef;
    border: 1px solid #f5c2c2;
    border-radius: 8px;
    color: #b32d2d;
    font-size: 14px;
}

/* ========== 次数用完提示 ========== */
.tocr-limit-exceeded {
    padding: 24px 28px;
    background: #fef8e7;
    border: 1px solid #f0dbaa;
    border-radius: 10px;
    text-align: center;
    color: #7a5d00;
    font-size: 15px;
}

.tocr-limit-exceeded p {
    margin: 0;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .tocr-options {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 16px;
    }
    
    .tocr-options-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .tocr-option-group {
        flex-wrap: wrap;
    }
    
    .tocr-option-group select {
        flex: 1;
        min-width: 100px;
    }
    
    .tocr-btn-primary {
        justify-content: center;
        padding: 10px 20px;
    }
    
    .tocr-login-prompt {
        padding: 28px 20px;
        margin: 16px 0;
    }
    
    .tocr-login-prompt h3 {
        font-size: 19px;
    }
    
    #tocr-preview-image {
        max-width: 200px;
        max-height: 150px;
    }
    
    .tocr-result-area {
        padding: 14px 14px 18px;
    }
}




/* ========== Toast 提示 ========== */
.tocr-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1d2327;
    color: #ffffff;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    z-index: 99999;
    animation: tocr-toast-in 0.3s ease;
    max-width: 90%;
    text-align: center;
}

@keyframes tocr-toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}