/* css/image-to-text.css */

.image-to-text-section {
    background-color: var(--card-bg-color); /* 使用现有主题变量 */
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 30px;
    box-shadow: var(--shadow); /* 使用现有主题变量 */
    text-align: center;
    border: 1px solid var(--border-color); /* 添加边框 */
}

.image-to-text-section h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.6rem;
}

.image-to-text-section p {
    margin-bottom: 15px;
    color: var(--text-color);
    line-height: 1.5;
}

.image-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px; /* 增加整体间距 */
    margin-bottom: 20px;
    /* --- NEW/MODIFIED STYLES FOR DRAG & DROP --- */
    border: 2px dashed var(--border-color); /* 添加虚线边框，指示可拖拽区域 */
    border-radius: var(--border-radius);
    padding: 20px; /* 增加内边距 */
    background-color: var(--input-bg-color); /* 背景色 */
    transition: border-color 0.3s ease, box-shadow 0.3s ease; /* 添加过渡效果 */
}

.image-upload-area.highlight { /* 用于拖拽时的高亮效果 */
    border-color: var(--accent-color);
    /* Assuming you might have a --accent-color-rgb variable for rgba, if not, use a fixed color */
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5); /* Example rgba for --accent-color: #4CAF50 */
    /* If you don't have --accent-color-rgb, you can use: box-shadow: 0 0 10px rgba(0, 150, 136, 0.5); */
}

/* --- NEW STYLES FOR BUTTONS LAYOUT --- */
.upload-buttons {
    display: flex;
    flex-wrap: wrap; /* 允许按钮换行 */
    justify-content: center;
    gap: 10px; /* 按钮之间的间距 */
    width: 100%;
    max-width: 400px; /* 限制按钮组的最大宽度 */
}

.upload-button {
    flex-grow: 1; /* 让按钮在 flex 容器中自动填充空间 */
    min-width: 120px; /* 最小宽度，防止过小 */
    background-color: var(--accent-color); /* 使用现有主题变量 */
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: var(--shadow);
}

.upload-button:hover {
    background-color: var(--accent-dark-color); /* 使用现有主题变量 */
    transform: translateY(-2px);
}

.upload-button:active {
    transform: translateY(0);
}

.file-preview {
    width: 100%;
    max-width: 350px; /* 调整预览最大宽度 */
    height: 220px; /* 调整预览高度 */
    /* --- MODIFIED: Removed border and background from here, moved to .image-upload-area --- */
    /* border: 2px dashed var(--border-color); */
    /* background-color: var(--input-bg-color); */
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column; /* 垂直排列内容 */
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 10px; /* 添加内边距 */
    box-shadow: var(--shadow-sm); /* 添加阴影，使其看起来更像一个显示区域 */
}

.file-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* 保持图片比例 */
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
}

.file-preview p#filePreviewText {
    color: var(--text-color-light); /* 使用现有主题变量 */
    font-style: italic;
    margin: 0;
    text-align: center;
    word-break: break-word; /* 允许长文本换行 */
}

.file-name-display {
    margin-top: 10px;
    font-weight: bold;
    color: var(--secondary-color);
    word-break: break-all; /* 允许文件名称在必要时断开 */
    padding: 0 5px;
}

.extracted-text-result {
    text-align: left;
    margin-top: 25px;
    padding: 20px;
    background-color: var(--input-bg-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.extracted-text-result h3 {
    color: var(--secondary-color);
    margin-bottom: 12px;
    font-size: 1.4rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

#extractedTextContent {
    min-height: 80px; /* 增加最小高度 */
    white-space: pre-wrap; /* 保留 AI 结果的格式 */
    word-wrap: break-word;
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.8;
}

#extractedTextContent .clickable-word {
    cursor: pointer;
    text-decoration: underline;
    color: var(--primary-color); /* 使用现有主题变量 */
    font-weight: 500;
}

#extractedTextContent .clickable-word:hover {
    color: var(--accent-color); /* 使用现有主题变量 */
    text-decoration: none;
}

.clear-button {
    background-color: var(--danger-color); /* 使用现有主题变量 */
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    margin-top: 15px;
    transition: background-color 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.clear-button:hover {
    background-color: var(--danger-dark-color); /* 使用现有主题变量 */
}

.processing-message {
    margin-top: 20px;
    font-style: italic;
    color: var(--secondary-color); /* 使用现有主题变量 */
    font-weight: bold;
    display: none; /* 默认隐藏 */
}

/* 响应式调整 */
@media (max-width: 768px) {
    .image-to-text-section {
        padding: 15px;
        margin-top: 20px;
    }

    .image-to-text-section h2 {
        font-size: 1.4rem;
    }

    /* Adjust button padding and font size for smaller screens */
    .upload-button {
        padding: 10px 15px;
        font-size: 0.95rem;
        min-width: 100px;
    }

    .file-preview {
        max-width: 100%;
        height: 180px;
    }

    .extracted-text-result {
        padding: 15px;
        margin-top: 20px;
    }

    .extracted-text-result h3 {
        font-size: 1.2rem;
    }

    #extractedTextContent {
        font-size: 1rem;
        min-height: 60px;
    }

    .clear-button {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}