/**
 * MetaoFly — Image & Scanned PDF to Text Converter (Client-Side OCR Studio) CSS
 * Strict 2-column Desktop / 1-column Mobile layout architecture
 */

.mf-ocr-studio {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 20px 80px;
    color: var(--mf-text-primary, #f1f5f9);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Header & Trust Banner */
.mf-tool-header {
    text-align: center;
    margin-bottom: 28px;
}

.mf-tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #10b981;
    margin-bottom: 12px;
}

.mf-badge-pulse {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    animation: mfPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes mfPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.3); }
}

.mf-tool-title {
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
    color: var(--mf-text-primary, #ffffff);
}

.mf-tool-desc {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--mf-text-secondary, #94a3b8);
    max-width: 840px;
    margin: 0 auto 18px;
}

.mf-ocr-trust-banner {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(56, 189, 248, 0.25);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 0.88rem;
    color: var(--mf-text-secondary, #cbd5e1);
    max-width: 900px;
}

.mf-trust-icon {
    font-size: 1.2rem;
}

.mf-trust-content strong {
    color: #38bdf8;
}

.mf-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(56, 189, 248, 0.15);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #38bdf8;
    margin-left: auto;
    white-space: nowrap;
}

/* WORKSPACE GRID: STRICT 2 COLUMNS ON DESKTOP, 1 COLUMN ON MOBILE */
.mf-ocr-workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 440px);
    gap: 24px;
    align-items: start;
    margin-bottom: 48px;
}

@media (max-width: 1024px) {
    .mf-ocr-workspace-grid {
        grid-template-columns: 1fr;
    }
}

/* STAGE CARD (LEFT COLUMN) */
.mf-ocr-stage-card {
    background: var(--mf-surface-card, #0f172a);
    border: 1px solid var(--mf-border, rgba(255, 255, 255, 0.08));
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 580px;
}

/* Dropzone */
.mf-ocr-dropzone {
    border: 2px dashed rgba(56, 189, 248, 0.35);
    background: rgba(15, 23, 42, 0.6);
    border-radius: 14px;
    padding: 60px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 440px;
}

.mf-ocr-dropzone:hover,
.mf-ocr-dropzone.dragover {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.06);
    transform: translateY(-2px);
}

.mf-file-hidden {
    display: none;
}

.mf-dropzone-icon {
    color: #38bdf8;
    margin-bottom: 16px;
    background: rgba(56, 189, 248, 0.1);
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px -6px rgba(56, 189, 248, 0.3);
}

.mf-dropzone-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #f8fafc;
}

.mf-dropzone-sub {
    font-size: 0.92rem;
    color: #94a3b8;
    margin-bottom: 22px;
}

.mf-clipboard-paste-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    font-size: 0.8rem;
    color: #94a3b8;
}

.mf-clipboard-paste-pill kbd {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: inherit;
    font-weight: 700;
    color: #f1f5f9;
}

/* PDF Navigation Bar */
.mf-ocr-pdf-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-bottom: 12px;
}

.mf-pdf-nav-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mf-pdf-page-indicator {
    font-size: 0.88rem;
    font-weight: 600;
    color: #cbd5e1;
}

/* Toolbar */
.mf-ocr-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-bottom: 14px;
}

.mf-tool-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mf-tool-group-right {
    margin-left: auto;
}

.mf-btn-tool {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border-radius: 6px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mf-btn-tool:hover {
    background: #334155;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}

.mf-btn-tool.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
    color: #38bdf8;
}

.mf-btn-danger-tool:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
}

.mf-zoom-val {
    font-size: 0.82rem;
    font-weight: 600;
    color: #94a3b8;
    min-width: 44px;
    text-align: center;
}

/* Viewport / Stage */
.mf-ocr-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 480px;
    background: #020617;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    position: relative;
    overflow: auto;
    padding: 20px;
}

.mf-stage-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

.mf-ocr-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.mf-ocr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    cursor: crosshair;
}

/* Draggable Crop Box */
.mf-crop-box {
    position: absolute;
    border: 2px dashed #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
    pointer-events: auto;
    cursor: move;
    z-index: 10;
}

.mf-crop-drag-bar {
    position: absolute;
    top: -24px;
    left: 0;
    background: #38bdf8;
    color: #041427;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px 4px 0 0;
    white-space: nowrap;
    pointer-events: none;
    letter-spacing: 0.03em;
}

.mf-crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #ffffff;
    border: 2px solid #0284c7;
    border-radius: 2px;
    z-index: 12;
}

.handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }

/* Tooltip for OCR Bounding Boxes */
.mf-ocr-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid #38bdf8;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
    color: #f8fafc;
    pointer-events: none;
    z-index: 50;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    transform: translate(-50%, -120%);
    white-space: nowrap;
}

/* Stage Hint */
.mf-stage-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #94a3b8;
    margin-top: 10px;
}

/* CONTROLS CARD (RIGHT COLUMN) */
.mf-ocr-controls-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.mf-control-panel {
    background: var(--mf-surface-card, #0f172a);
    border: 1px solid var(--mf-border, rgba(255, 255, 255, 0.08));
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.mf-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.mf-panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mf-panel-icon {
    font-size: 1.15rem;
}

.mf-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mf-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
}

.mf-select {
    width: 100%;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #f8fafc;
    padding: 10px 12px;
    font-size: 0.92rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.mf-select:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.mf-field-note {
    font-size: 0.76rem;
    color: #64748b;
    margin-top: 4px;
    line-height: 1.4;
}

/* Switches & Toggles */
.mf-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.mf-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mf-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #334155;
    transition: 0.3s;
    border-radius: 22px;
}

.mf-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .mf-slider {
    background-color: #10b981;
}

input:checked + .mf-slider:before {
    transform: translateX(18px);
}

.mf-toggles-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.mf-checkbox-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.8rem;
    color: #cbd5e1;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: all 0.2s;
}

.mf-checkbox-pill input {
    accent-color: #38bdf8;
}

.mf-slider-group {
    margin-bottom: 12px;
}

.mf-slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: #94a3b8;
    margin-bottom: 6px;
}

.mf-slider-val {
    color: #38bdf8;
    font-weight: 700;
}

.mf-range {
    width: 100%;
    accent-color: #38bdf8;
    cursor: pointer;
}

/* Action Box & Progress Bar */
.mf-action-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}

.mf-btn-primary {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.mf-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45);
}

.mf-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.mf-btn-block {
    width: 100%;
}

.mf-btn-lg {
    padding: 14px 24px;
    font-size: 1.05rem;
}

.mf-btn-success {
    background: #10b981;
    color: #ffffff;
}
.mf-btn-success:hover {
    background: #059669;
}

.mf-btn-secondary {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}
.mf-btn-secondary:hover {
    background: #334155;
    color: #ffffff;
}

.mf-btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    cursor: pointer;
}
.mf-btn-xs:hover {
    background: #334155;
    color: #ffffff;
}

.mf-btn-accent {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.35);
    color: #38bdf8;
}
.mf-btn-accent:hover {
    background: rgba(56, 189, 248, 0.25);
    color: #7dd3fc;
}

.mf-ocr-progress-container {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px 14px;
}

.mf-ocr-progress-bar {
    width: 100%;
    height: 8px;
    background: #0f172a;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.mf-ocr-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #10b981);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.mf-ocr-progress-status {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: #94a3b8;
}

/* NOTEPAD & OUTPUT STUDIO */
.mf-notepad-panel {
    border-color: rgba(56, 189, 248, 0.2);
}

.mf-notepad-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mf-accuracy-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 9999px;
    font-size: 0.76rem;
    font-weight: 700;
    color: #10b981;
}

.mf-acc-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

.mf-stats-bar {
    display: flex;
    gap: 16px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 10px;
}

.mf-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.mf-stat-label {
    color: #64748b;
}

.mf-stat-val {
    color: #f1f5f9;
    font-weight: 700;
}

.mf-text-tools-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.mf-textarea-container {
    margin-bottom: 14px;
}

.mf-ocr-textarea {
    width: 100%;
    min-height: 220px;
    background: #020617;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 12px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88rem;
    line-height: 1.6;
    color: #f1f5f9;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.mf-ocr-textarea:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.mf-export-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
    gap: 8px;
}

@media (max-width: 640px) {
    .mf-export-grid {
        grid-template-columns: 1fr 1fr;
    }
    .mf-export-grid #ocrCopyBtn {
        grid-column: span 2;
    }
}

/* SEO Section */
.mf-tool-seo-section {
    margin-top: 60px;
}

.mf-seo-card {
    background: var(--mf-surface-card, #0f172a);
    border: 1px solid var(--mf-border, rgba(255, 255, 255, 0.08));
    border-radius: 16px;
    padding: 32px;
}

.mf-seo-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #f8fafc;
}

.mf-seo-card p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #94a3b8;
    margin-bottom: 24px;
}

.mf-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-bottom: 36px;
}

.mf-step-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 20px;
    position: relative;
}

.mf-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #0284c7;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.mf-step-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #f1f5f9;
}

.mf-step-card p {
    font-size: 0.88rem;
    color: #94a3b8;
    margin-bottom: 0;
    line-height: 1.6;
}

.mf-faq-block h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: #f8fafc;
}

.mf-faq-item {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 16px 0;
}

.mf-faq-item:first-of-type {
    border-top: none;
}

.mf-faq-item h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #38bdf8;
    margin-bottom: 6px;
}

.mf-faq-item p {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 0;
    line-height: 1.6;
}
