/* 
 * Online Scanner - Professional Styles 
 * Theme: Modern Clean (Blue/White/Gray)
 */

:root {
    --os-primary: #0066ff;
    --os-primary-dark: #0052cc;
    --os-bg: #f5f7fa;
    --os-surface: #ffffff;
    --os-border: #e2e8f0;
    --os-text: #1e293b;
    --os-text-light: #64748b;
    --os-radius: 8px;
    --os-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Main Wrapper - Centered & Bounded */
.os-scanner-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 1200px;
    margin: 20px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    color: #1e293b;
}

/* Header */
.os-header {
    text-align: center;
    padding: 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.os-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.os-header p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 0.9rem;
}

/* Upload Area */
.os-upload-area {
    padding: 60px 20px;
    background: var(--os-bg);
}

.os-dropzone {
    max-width: 600px;
    margin: 0 auto;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    background: #fff;
    transition: all 0.2s;
}

.os-dropzone.drag-over {
    border-color: var(--os-primary);
    background: #eff6ff;
}

.os-icon {
    font-size: 48px;
    margin-bottom: 20px;
    display: block;
}

.os-upload-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 25px 0;
    flex-wrap: wrap;
}

/* Workspace Layout */
.os-workspace {
    display: flex;
    flex-direction: row;
    /* Desktop Default */
    height: 750px;
    background: #f1f5f9;
}

/* Sidebar (Left) */
.os-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.os-sidebar-header {
    padding: 15px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.os-thumbnails {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.os-thumb-item {
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #e2e8f0;
    transition: all 0.2s ease;
}

.os-thumb-item:hover {
    border-color: #cbd5e1;
}

.os-thumb-item.active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.os-thumb-item img {
    width: 100%;
    height: auto;
    display: block;
}

.os-thumb-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    display: none;
}

.os-thumb-item:hover .os-thumb-actions {
    display: block;
}

/* Main Stage (Right) */
.os-main-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Contain canvas */
}

/* Toolbar - The "Control Center" */
.os-toolbar {
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 15px;
    align-items: center;
    overflow-x: auto;
    white-space: nowrap;
    /* Scrollbar Styling */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.os-toolbar::-webkit-scrollbar {
    height: 6px;
}

.os-toolbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.os-tool-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 15px;
    margin-right: 15px;
    border-right: 1px solid #e2e8f0;
}

.os-tool-group:last-child {
    border: none;
    margin: 0;
    padding: 0;
}

/* Tool Buttons */
.os-tool-btn {
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    color: #475569;
    min-width: 64px;
    width: 64px;
    height: 56px;
    transition: all 0.2s;
    gap: 2px;
}

.os-tool-btn:hover {
    background: #f8fafc;
    color: #1e293b;
}

.os-tool-btn.active {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

/* Icon container - same height for all buttons so they align */
.os-tool-btn .os-tool-icon,
.os-tool-btn .dashicons,
.os-tool-btn > span:first-child {
    font-size: 20px;
    line-height: 1;
    width: 22px;
    height: 22px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.os-tool-btn .os-tool-label {
    font-size: 0.7rem;
    white-space: nowrap;
    display: block;
}

/* Inline SVG icons (work in standalone + WordPress, no font dependency) */
.os-tool-icon {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.os-tool-icon-crop {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 2v13h13'/%3E%3Cpath d='M2 7h13v13'/%3E%3Cpath d='M17 2v8M22 2h-5'/%3E%3Cpath d='M2 17h8M2 22v-5'/%3E%3C/svg%3E");
}

.os-tool-icon-bw {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 2v20M2 12h20' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Canvas Area */
.os-canvas-container {
    flex: 1;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: auto;
    padding: 40px;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 20px 20px;
}

.os-canvas-wrapper {
    position: relative;
    display: inline-block;
    line-height: 0;
}

#os-main-canvas {
    display: block;
}

canvas {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    background: #fff;
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* Export Bar */
.os-export-bar {
    padding: 15px 25px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.os-file-info {
    font-weight: 600;
    color: #334155;
}

.os-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #e2e8f0;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #64748b;
    margin-left: 10px;
    font-weight: normal;
}

.os-export-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    /* Vertical center */
}

/* Dropdown Menu */
.os-dropdown {
    position: relative;
    display: inline-block;
}

.os-dropdown-content {
    display: none;
    position: absolute;
    bottom: 100%;
    /* Show above button */
    right: 0;
    background-color: #fff;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    z-index: 100;
    overflow: hidden;
    margin-bottom: 8px;
    /* Space from button */
}

.os-dropdown:hover .os-dropdown-content {
    display: block;
    animation: fadeIn 0.2s;
}

.os-dropdown-content a {
    color: #334155;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: background 0.1s;
}

.os-dropdown-content a:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Buttons General */
.os-btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    /* Match other buttons */
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s;
}

.os-btn-icon:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}

.os-btn {
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.1s, background 0.2s;
}

.os-btn:active {
    transform: translateY(1px);
}

/* Format Select */
.os-format-select select {
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.os-format-select select:hover {
    border-color: #94a3b8;
}

.os-btn-primary {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.os-btn-primary:hover {
    background: #1d4ed8;
}

.os-btn-success {
    background: #10b981;
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

.os-btn-success:hover {
    background: #059669;
}

.os-btn-outline {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.os-btn-outline:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

/* Utilities */
.os-hidden {
    display: none !important;
}

/* Toast Notification */
.os-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: #1e293b;
    color: #fff;
    border-radius: 8px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.os-toast.show {
    opacity: 1;
}

/* FAQ */
.os-faq-section {
    padding: 20px;
    background: #fff;
    border-top: 1px solid var(--os-border);
}

.os-faq-section details {
    margin-bottom: 10px;
}

.os-faq-section summary {
    cursor: pointer;
    font-weight: 500;
}

.os-faq-section p {
    margin: 5px 0 0 20px;
    color: var(--os-text-light);
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .os-workspace {
        flex-direction: column;
        height: auto;
    }

    .os-sidebar {
        width: 100%;
        height: auto;
        max-height: 180px;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }

    .os-thumbnails {
        flex-direction: row;
    }

    .os-thumb-item {
        width: 100px;
        flex-shrink: 0;
    }

    .os-toolbar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 15px;
    }

    .os-canvas-container {
        min-height: 500px;
        padding: 20px;
    }

    .os-export-bar {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}