/* =====================================================
   PDF to Text & OCR PDF - Tool Styles
   ===================================================== */


/* =============================================
   Editor Layout
   ============================================= */
.editor-layout {
    display: block;
    animation: fadeSlideIn 0.4s ease;
}

.editor-layout.hidden {
    display: none;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================
   File Box
   ============================================= */
.file-box {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.file-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
}

.file-name {
    font-weight: 600;
    color: #1f2937;
    flex: 1;
    min-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-name::before {
    content: "📄 ";
}

.file-size {
    font-size: 14px;
    color: #6b7280;
    background: #f1f3f5;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.file-pages {
    font-size: 14px;
    color: #6b7280;
    background: #f1f3f5;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.remove-file {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    line-height: 1;
}

.remove-file:hover {
    background: #fef2f2;
    transform: scale(1.1);
}

/* =============================================
   Settings Panel
   ============================================= */
.tool-settings {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.tool-settings h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-settings h3 i {
    color: #6366f1;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-group label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.option-select,
.option-input {
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    transition: all 0.2s ease;
    width: 100%;
}

.option-select:focus,
.option-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.option-hint {
    font-size: 12px;
    color: #6b7280;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    padding: 4px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #6366f1;
    cursor: pointer;
}

/* =============================================
   Preview Section
   ============================================= */
.preview-section {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.preview-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #6b7280;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover:not(:disabled) {
    background: #f1f3f5;
    border-color: #6366f1;
}

.btn-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.preview-content {
    position: relative;
    display: flex;
    justify-content: center;
    min-height: 200px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.preview-canvas {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* OCR Overlay */
.ocr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

.ocr-loading {
    text-align: center;
    color: #1f2937;
}

.ocr-loading i {
    font-size: 48px;
    color: #6366f1;
    margin-bottom: 12px;
    display: block;
}

.ocr-loading span {
    font-size: 16px;
    font-weight: 500;
}

/* =============================================
   Action Buttons
   ============================================= */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-secondary {
    background: #f1f3f5;
    color: #374151;
}

.btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.4);
}

.btn i {
    font-size: 16px;
}

/* =============================================
   OCR Statistics
   ============================================= */
.ocr-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.stats-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s ease;
}

.stats-card:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.stats-card i {
    font-size: 28px;
    color: #6366f1;
    width: 40px;
    text-align: center;
}

.stats-card div {
    display: flex;
    flex-direction: column;
}

.stats-card span {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}

.stats-card small {
    font-size: 12px;
    color: #6b7280;
}

/* =============================================
   Extracted Sample
   ============================================= */
.extracted-sample {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.sample-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.sample-header i {
    color: #6366f1;
    font-size: 18px;
}

.sample-header span {
    font-weight: 600;
    color: #1f2937;
    flex: 1;
}

.copy-sample-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: #f1f3f5;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-sample-btn:hover {
    background: #e5e7eb;
}

.sample-content {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.8;
    color: #1f2937;
    white-space: pre-wrap;
    word-break: break-word;
}

.sample-content::-webkit-scrollbar {
    width: 6px;
}

.sample-content::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 3px;
}

.sample-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.sample-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* =============================================
   Progress Bar
   ============================================= */
.progress-container {
    width: 100%;
    background: #f1f3f5;
    border-radius: 50px;
    overflow: hidden;
    position: relative;
    height: 32px;
    margin: 16px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    transition: width 0.5s ease;
    border-radius: 50px;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* =============================================
   Messages
   ============================================= */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 10px;
    margin: 12px 0;
    display: none;
    font-size: 14px;
}

.success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    padding: 12px 16px;
    border-radius: 10px;
    margin: 12px 0;
    display: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.success-message i {
    font-size: 20px;
}

.info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #2563eb;
    padding: 12px 16px;
    border-radius: 10px;
    margin: 12px 0;
    display: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-box i {
    font-size: 20px;
}

/* =============================================
   Output Section (PDF to Text)
   ============================================= */
.output-section {
    margin: 20px 0;
}

.output-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.output-section h3 i {
    color: #6366f1;
}

.output-textarea {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.8;
    font-family: 'Courier New', monospace;
    background: #fafbfc;
    color: #1f2937;
    resize: vertical;
    transition: all 0.2s ease;
}

.output-textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* =============================================
   Responsive Design
   ============================================= */
@media (max-width: 768px) {
    .upload-area {
        padding: 40px 20px;
        min-height: 220px;
    }

    .upload-text {
        font-size: 20px;
    }

    .upload-icon {
        font-size: 48px;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .ocr-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .file-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .file-name {
        white-space: normal;
        word-break: break-all;
    }

    .preview-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .preview-controls {
        justify-content: center;
    }

    .tool-settings {
        padding: 16px;
    }

    .stats-card {
        padding: 12px;
    }

    .stats-card i {
        font-size: 22px;
        width: 32px;
    }

    .stats-card span {
        font-size: 17px;
    }
}

@media (max-width: 480px) {
    .upload-area {
        padding: 30px 16px;
        min-height: 180px;
    }

    .upload-text {
        font-size: 18px;
    }

    .upload-btn {
        padding: 10px 24px;
        font-size: 14px;
    }

    .ocr-stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .option-select,
    .option-input {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* =============================================
   Dark Mode Support (Optional)
   ============================================= */
@media (prefers-color-scheme: dark) {
    .upload-area {
        background: #1f2937;
        border-color: #374151;
    }

    .upload-area:hover {
        border-color: #818cf8;
        background: #1a2234;
    }

    .upload-area.drag-over {
        background: #1a2234;
        border-color: #818cf8;
    }

    .upload-text {
        color: #f3f4f6;
    }

    .upload-hint {
        color: #9ca3af;
    }

    .file-box {
        background: #1f2937;
        border-color: #374151;
    }

    .file-name {
        color: #f3f4f6;
    }

    .file-size,
    .file-pages {
        background: #374151;
        color: #9ca3af;
    }

    .tool-settings {
        background: #1f2937;
        border-color: #374151;
    }

    .tool-settings h3 {
        color: #f3f4f6;
    }

    .option-group label {
        color: #e5e7eb;
    }

    .option-select,
    .option-input {
        background: #111827;
        border-color: #374151;
        color: #f3f4f6;
    }

    .option-select:focus,
    .option-input:focus {
        border-color: #818cf8;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    }

    .checkbox-label {
        color: #e5e7eb;
    }

    .preview-section {
        background: #1f2937;
        border-color: #374151;
    }

    .preview-title {
        color: #f3f4f6;
    }

    .preview-controls {
        color: #9ca3af;
    }

    .btn-icon {
        background: #111827;
        border-color: #374151;
        color: #e5e7eb;
    }

    .btn-icon:hover:not(:disabled) {
        background: #1f2937;
        border-color: #818cf8;
    }

    .preview-content {
        background: #111827;
    }

    .ocr-overlay {
        background: rgba(17, 24, 39, 0.85);
    }

    .ocr-loading {
        color: #f3f4f6;
    }

    .ocr-stats {
        background: #1f2937;
    }

    .stats-card {
        background: #1f2937;
        border-color: #374151;
    }

    .stats-card span {
        color: #f3f4f6;
    }

    .stats-card small {
        color: #9ca3af;
    }

    .extracted-sample {
        background: #1f2937;
        border-color: #374151;
    }

    .sample-header span {
        color: #f3f4f6;
    }

    .sample-content {
        background: #111827;
        border-color: #374151;
        color: #e5e7eb;
    }

    .output-textarea {
        background: #1f2937;
        border-color: #374151;
        color: #e5e7eb;
    }

    .output-section h3 {
        color: #f3f4f6;
    }

    .btn-secondary {
        background: #374151;
        color: #e5e7eb;
    }

    .btn-secondary:hover:not(:disabled) {
        background: #4b5563;
    }

    .error-message {
        background: #1f2937;
        border-color: #7f1d1d;
        color: #f87171;
    }

    .success-message {
        background: #1f2937;
        border-color: #065f46;
        color: #34d399;
    }

    .info-box {
        background: #1f2937;
        border-color: #1e3a5f;
        color: #60a5fa;
    }

    .progress-container {
        background: #374151;
    }

    .progress-text {
        color: #f3f4f6;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }
}

