/* FIMTC OCR Tool Styles */
:root {
    --fimtc-primary: #2563eb;
    --fimtc-primary-hover: #1d4ed8;
    --fimtc-secondary: #64748b;
    --fimtc-secondary-hover: #475569;
    --fimtc-success: #16a34a;
    --fimtc-bg: #ffffff;
    --fimtc-bg-alt: #f8fafc;
    --fimtc-border: #e2e8f0;
    --fimtc-text: #1e293b;
    --fimtc-text-muted: #64748b;
    --fimtc-radius: 12px;
    --fimtc-radius-sm: 8px;
    --fimtc-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --fimtc-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --fimtc-primary: #3b82f6;
        --fimtc-primary-hover: #60a5fa;
        --fimtc-bg: #0f172a;
        --fimtc-bg-alt: #1e293b;
        --fimtc-border: #334155;
        --fimtc-text: #f1f5f9;
        --fimtc-text-muted: #94a3b8;
    }
}

.fimtc-tool {
    max-width: 800px;
    margin: 0 auto;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--fimtc-text);
}

.fimtc-tool *,
.fimtc-tool *::before,
.fimtc-tool *::after {
    box-sizing: border-box;
}

/* Drop Zone */
.fimtc-drop-zone {
    border: 2px dashed var(--fimtc-border);
    border-radius: var(--fimtc-radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--fimtc-bg-alt);
    position: relative;
}

.fimtc-drop-zone:hover,
.fimtc-drop-zone:focus-visible {
    border-color: var(--fimtc-primary);
    background: rgba(37, 99, 235, 0.04);
}

.fimtc-drop-zone.fimtc-drag-over {
    border-color: var(--fimtc-primary);
    background: rgba(37, 99, 235, 0.08);
    transform: scale(1.01);
    box-shadow: var(--fimtc-shadow-lg);
}

.fimtc-upload-icon {
    width: 48px;
    height: 48px;
    color: var(--fimtc-primary);
    margin-bottom: 16px;
}

.fimtc-drop-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--fimtc-text);
}

.fimtc-drop-subtitle {
    font-size: 0.9rem;
    color: var(--fimtc-text-muted);
    margin: 0 0 12px;
}

.fimtc-drop-hint {
    font-size: 0.85rem;
    color: var(--fimtc-text-muted);
    margin: 0 0 8px;
}

.fimtc-drop-hint kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-family: inherit;
    background: var(--fimtc-bg);
    border: 1px solid var(--fimtc-border);
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

.fimtc-drop-limit {
    font-size: 0.8rem;
    color: var(--fimtc-text-muted);
    margin: 0;
    opacity: 0.7;
}

/* Image Previews */
.fimtc-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.fimtc-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: var(--fimtc-radius-sm);
    overflow: hidden;
    border: 2px solid var(--fimtc-border);
    box-shadow: var(--fimtc-shadow);
}

.fimtc-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fimtc-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s;
}

.fimtc-preview-remove:hover {
    background: rgba(220,38,38,0.9);
}

.fimtc-preview-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 6px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Progress */
.fimtc-progress-section {
    margin-top: 20px;
}

.fimtc-progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--fimtc-border);
    border-radius: 4px;
    overflow: hidden;
}

.fimtc-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--fimtc-primary), #60a5fa);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.fimtc-progress-text {
    margin: 8px 0 0;
    font-size: 0.85rem;
    color: var(--fimtc-text-muted);
    text-align: center;
}

/* Output Section */
.fimtc-output-section {
    margin-top: 24px;
}

.fimtc-output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.fimtc-output-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--fimtc-text);
}

.fimtc-output-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.fimtc-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--fimtc-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.fimtc-btn svg {
    flex-shrink: 0;
}

.fimtc-btn-primary {
    background: var(--fimtc-primary);
    color: #fff;
}

.fimtc-btn-primary:hover {
    background: var(--fimtc-primary-hover);
    box-shadow: var(--fimtc-shadow);
}

.fimtc-btn-secondary {
    background: var(--fimtc-secondary);
    color: #fff;
}

.fimtc-btn-secondary:hover {
    background: var(--fimtc-secondary-hover);
    box-shadow: var(--fimtc-shadow);
}

.fimtc-btn-outline {
    background: transparent;
    color: var(--fimtc-text-muted);
    border: 1px solid var(--fimtc-border);
}

.fimtc-btn-outline:hover {
    background: var(--fimtc-bg-alt);
    color: var(--fimtc-text);
}

.fimtc-output-textarea {
    width: 100%;
    min-height: 250px;
    padding: 16px;
    font-size: 0.95rem;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--fimtc-text);
    background: var(--fimtc-bg-alt);
    border: 1px solid var(--fimtc-border);
    border-radius: var(--fimtc-radius-sm);
    resize: vertical;
    outline: none;
}

.fimtc-output-textarea:focus {
    border-color: var(--fimtc-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.fimtc-copy-feedback {
    text-align: center;
    color: var(--fimtc-success);
    font-size: 0.85rem;
    font-weight: 500;
    margin: 8px 0 0;
    animation: fimtc-fadeIn 0.3s ease;
}

@keyframes fimtc-fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 640px) {
    .fimtc-drop-zone {
        padding: 32px 16px;
    }

    .fimtc-upload-icon {
        width: 36px;
        height: 36px;
    }

    .fimtc-drop-title {
        font-size: 1.1rem;
    }

    .fimtc-output-header {
        flex-direction: column;
        align-items: stretch;
    }

    .fimtc-output-actions {
        justify-content: stretch;
    }

    .fimtc-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
    }

    .fimtc-preview-item {
        width: 80px;
        height: 80px;
    }
}
