body {
    font-family: Arial, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    background-color: #f5f5f5;
}

.container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 30px;
}

/* Three-Panel Layout */
.three-panel-wrapper {
    display: flex;
    gap: 20px;
    min-height: 600px;
    margin-top: 20px;
}

.control-panel {
    flex: 0 0 280px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.page-panel {
    flex: 1;
    min-width: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
}

.results-panel {
    flex: 0 0 350px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
}

/* Initial Setup Area */
.initial-setup {
    max-width: 800px;
    margin: 0 auto;
}

/* Upload Areas */
.upload-area {
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    margin-bottom: 20px;
    cursor: pointer;
    transition: border-color 0.3s;
}

.upload-area-small {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s;
    background: white;
}

.upload-area:hover,
.upload-area-small:hover {
    border-color: #007bff;
}

.upload-area.dragover,
.upload-area-small.dragover {
    border-color: #007bff;
    background-color: #f0f8ff;
}

.upload-section h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 16px;
}

/* OCR Settings Section */
.ocr-settings {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
}

.ocr-settings h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 8px;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #495057;
    font-size: 14px;
}

.setting-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
}

.setting-group select:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.api-config-panel {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.api-key-input-panel {
    margin-bottom: 10px;
}

.api-key-input-panel label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #495057;
    font-size: 14px;
}

.api-key-input-panel input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 8px;
}

.api-key-buttons {
    display: flex;
    gap: 5px;
}

.api-key-buttons .btn {
    flex: 1;
    padding: 6px 10px;
    font-size: 12px;
}

.api-help-panel {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.4;
}

.api-help-panel a {
    color: #007bff;
    text-decoration: none;
}

.api-help-panel a:hover {
    text-decoration: underline;
}

/* Control Panel Styling */
.controls-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.controls-column .btn {
    margin: 0;
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    padding: 10px 20px;
    font-size: 16px;
}

/* Text Selection Help */
.text-selection-help {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
    margin: 15px 0;
}

.text-selection-help h4 {
    margin: 0 0 8px 0;
    color: #495057;
    font-size: 14px;
}

.help-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 12px;
    color: #6c757d;
}

.help-list li {
    margin: 4px 0;
    padding-left: 16px;
    position: relative;
}

.help-list li::before {
    content: "•";
    color: #007bff;
    position: absolute;
    left: 4px;
}

.help-list kbd {
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 3px;
    color: #495057;
    font-family: monospace;
    font-size: 11px;
    padding: 2px 4px;
}

.batch-controls {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
}

.batch-controls h3 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 18px;
    font-weight: bold;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
}

input[type="file"] {
    display: none;
}

.btn {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin: 10px 5px;
}

.btn:hover {
    background-color: #0056b3;
}

.btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.preview-container {
    margin: 20px 0;
    text-align: center;
}

.preview-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.progress-container {
    margin: 20px 0;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #007bff;
    transition: width 0.3s;
    border-radius: 10px;
}

.result-container {
    margin-top: 20px;
}

.result-text {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    min-height: 100px;
    white-space: pre-wrap;
    font-family: monospace;
}

.error {
    color: red;
    background-color: #ffe6e6;
    border: 1px solid #ffcccc;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
}

.language-select {
    margin: 10px 0;
}

select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.hidden {
    display: none;
}

.supported-formats {
    color: #666;
    font-size: 14px;
}

.pages-container {
    margin: 20px 0;
}

.page-item {
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background: #fafafa;
    position: relative;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.page-title {
    font-weight: bold;
    color: #333;
}

.page-controls {
    display: flex;
    gap: 10px;
}

.page-preview {
    position: relative;
    text-align: center;
    margin: 15px 0;
    max-height: 600px;
    overflow: auto;
}

.page-image {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: relative;
}

.text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.text-box {
    position: absolute;
    background: rgba(255, 255, 0, 0.3);
    border: 1px solid rgba(255, 255, 0, 0.6);
    cursor: pointer;
    pointer-events: all;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.2;
    padding: 2px;
    white-space: pre-wrap;
    word-wrap: break-word;
    transition: all 0.2s ease;
}

.text-box:hover {
    background: rgba(255, 255, 0, 0.5);
    border-color: rgba(255, 255, 0, 0.8);
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.text-box.selected {
    background: rgba(0, 123, 255, 0.4);
    border: 2px solid rgba(0, 123, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
    z-index: 1000;
}

.page-status {
    margin: 10px 0;
    padding: 8px;
    border-radius: 4px;
    font-size: 14px;
}

.status-pending {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.status-processing {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.status-completed {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.controls-row {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.btn-small {
    padding: 5px 10px;
    font-size: 14px;
}

.btn-success {
    background-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.toggle-overlay {
    background-color: #6c757d;
}

.toggle-overlay:hover {
    background-color: #5a6268;
}

.toggle-overlay.active {
    background-color: #007bff;
}

.progress-text {
    text-align: center;
    margin: 10px 0;
}

.ocr-engine-select {
    margin: 10px 0;
}

.api-config {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.api-key-input {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.api-key-input input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.api-help {
    font-size: 12px;
    color: #666;
}

.api-help a {
    color: #007bff;
    text-decoration: none;
}

.api-help a:hover {
    text-decoration: underline;
}

.accuracy-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 5px;
}

.accuracy-high {
    background: #d4edda;
    color: #155724;
}

.accuracy-medium {
    background: #fff3cd;
    color: #856404;
}

.accuracy-basic {
    background: #f8d7da;
    color: #721c24;
}

/* Pagination Styles */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
    padding: 12px;
    background: #007bff;
    border-radius: 8px;
    border: 1px solid #0056b3;
}

.page-info {
    font-weight: bold;
    color: white;
    font-size: 14px;
    min-width: 100px;
    text-align: center;
}

.pagination-controls .btn {
    padding: 8px 15px;
    font-size: 14px;
    min-width: 100px;
    background-color: white;
    color: #007bff;
    border: 1px solid white;
}

.pagination-controls .btn:hover:not(:disabled) {
    background-color: #f8f9fa;
    color: #0056b3;
}

.pagination-controls .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #e9ecef;
    color: #6c757d;
}

/* Text Content Container in Results Panel */
.text-content-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.text-content-container h3 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 18px;
    font-weight: bold;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
}

.page-text-area {
    flex: 1;
    min-height: 400px;
    width: 100%;
    padding: 15px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    background-color: #f8f9fa;
    resize: vertical;
    margin-bottom: 15px;
}

.page-text-area:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.text-controls {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

/* Page Panel Styling */
.current-page-container {
    flex: 1;
}

/* Mobile responsive - stack vertically on smaller screens */
@media (max-width: 1024px) {
    .three-panel-wrapper {
        flex-direction: column;
        gap: 15px;
    }

    .control-panel {
        flex: none;
        order: 1;
    }

    .page-panel {
        flex: none;
        order: 2;
    }

    .results-panel {
        flex: none;
        order: 3;
    }

    .controls-column {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .controls-column .btn {
        flex: 1;
        min-width: 150px;
        text-align: center;
    }

    .page-text-area {
        min-height: 200px;
    }
}

.current-page {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.current-page .page-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.current-page .page-title {
    font-size: 18px;
    font-weight: bold;
    color: #495057;
    margin: 0;
}

.current-page .page-controls {
    display: flex;
    gap: 10px;
}

.current-page .page-preview {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.current-page .page-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    flex-shrink: 0;
}

.pagination-controls .page-info {
    font-weight: bold;
    color: #495057;
    font-size: 14px;
}

/* Test Conversion Checkbox */
.test-conversion {
    margin: 20px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    -webkit-user-select: none;
    user-select: none;
}

.checkbox-container input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-container:hover {
    color: #007bff;
}