/* NEW 4-BAR LAYOUT FOR COMPRESS TOOL */

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0a0a0a;
    color: #fff;
    overflow-x: hidden;
    overflow-y: auto;
    /* Prevent bounce/overscroll on iOS */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar - Desktop with mouse only (not touch devices) */
@media (hover: hover) and (pointer: fine) {
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }

    ::-webkit-scrollbar-track {
        background: #1a1a1a;
        border-radius: 4px;
    }

    ::-webkit-scrollbar-thumb {
        background: linear-gradient(135deg, #00ffa3 0%, #00d4aa 100%);
        border-radius: 4px;
        transition: background 0.3s ease;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(135deg, #00d4aa 0%, #00b894 100%);
    }

    /* Firefox Scrollbar */
    * {
        scrollbar-width: thin;
        scrollbar-color: #00ffa3 #1a1a1a;
    }
}

/* Main Tool Container - Fits viewport, scrollable content below */
.tool-container {
    width: 100vw;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ============================================
   1. TOP TOOLBAR - Tool-specific styles only
   (Base toolbar styles are in common.css)
   ============================================ */
.session-btn {
    background: transparent;
    border: none;
    color: #ff8800;
}

.session-btn:hover {
    background: rgba(255, 136, 0, 0.2);
}

.cached-images-btn {
    background: transparent;
    border: none;
    color: #ff8800;
}

.cached-images-btn:hover {
    background: rgba(255, 136, 0, 0.15);
    color: #ff9922;
}

/* Zoom Controls */
.toolbar-divider {
    width: 1px;
    height: 30px;
    background: #444;
    margin: 0 0.5rem;
}

.zoom-btn {
    min-width: 50px;
}

.zoom-btn .btn-text {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: -0.25rem;
}

.zoom-slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 150px;
    padding: 0.25rem 0.5rem;
}

.zoom-slider {
    width: 100%;
    height: 4px;
    background: #444;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #00ffa3 0%, #00d4aa 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 255, 163, 0.3);
    transition: all 0.2s;
}

.zoom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(0, 255, 163, 0.5);
}

.zoom-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #00ffa3 0%, #00d4aa 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 255, 163, 0.3);
    transition: all 0.2s;
}

.zoom-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(0, 255, 163, 0.5);
}

.zoom-slider:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.zoom-slider:disabled::-webkit-slider-thumb {
    cursor: not-allowed;
}

.zoom-slider:disabled::-moz-range-thumb {
    cursor: not-allowed;
}

.zoom-level-display {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 255, 163, 0.1);
    border: 1px solid rgba(0, 255, 163, 0.3);
    border-radius: 4px;
    color: #00ffa3;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* ============================================
   2. MAIN AREA (Left Sidebar + Canvas + Right Sidebar)
   ============================================ */
.main-area {
    flex: 1;
    display: grid;
    grid-template-columns: 60px 1fr 60px;
    overflow: hidden;
    position: relative;
    /* Background and transition now in common.css */
}

/* LEFT SIDEBAR (Settings Icons) */
.left-sidebar {
    background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    padding: 1rem 0.5rem;
    gap: 0.5rem;
    z-index: 100;
}

/* Hide mobile sidebar on desktop */
.mobile-sidebar {
    display: none;
}

.settings-btn {
    width: 100%;
    min-height: 50px;
    background: transparent;
    border: none;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    transition: all 0.2s;
    color: #888;
    padding: 0.5rem 0.25rem;
}

.settings-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.settings-btn span {
    font-size: 0.625rem;
    font-weight: 500;
    text-align: center;
    word-wrap: break-word;
    line-height: 1.2;
}

.settings-btn:hover,
.settings-btn.active {
    background: rgba(0, 255, 163, 0.08);
    color: #00ffa3;
}

/* Settings Panels (Slide from left sidebar's right edge) */
/* Note: Positioning and animation now handled in common.css */
.settings-panel {
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    /* Background now in common.css */
}

.settings-panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #00ffa3;
}

.settings-panel-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.close-panel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    color: #888;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
}

.close-panel:hover {
    background: rgba(255, 0, 0, 0.1);
    border-color: #ff0000;
    color: #ff0000;
}

/* CANVAS AREA (Center) */
/* Note: grid-column positioning now handled in common.css */
/* Canvas background and layout now defined in common.css with radial dot pattern */

.canvas-area.dragover {
    background: rgba(0, 255, 163, 0.05);
    border: 2px dashed #00ffa3;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

/* Dedicated Grid Area - Separate from canvas for multi-image view */
.grid-area {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
    position: absolute;
    top: 0;
    left: 0;
}

.grid-area.active {
    display: block;
}

.canvas-wrapper.zoomed {
    cursor: grab;
    overflow: auto;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 50vh 50vw;
}

.canvas-wrapper.zoomed:active {
    cursor: grabbing;
}

.canvas-wrapper.panning {
    cursor: grabbing;
    user-select: none;
}

.canvas-wrapper.zoomed #canvas {
    max-width: none;
    max-height: none;
}

/* Fit to Screen Button - Positioned at top right of canvas */
.fit-to-screen-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 1px solid #444;
    border-radius: 8px;
    color: #888;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.fit-to-screen-btn svg {
    width: 20px;
    height: 20px;
}

.fit-to-screen-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #2d2d2d 0%, #3d3d3d 100%);
    border-color: #00ffa3;
    color: #00ffa3;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 163, 0.2);
}

.fit-to-screen-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: center;
    color: #888;
    max-width: 400px;
    padding: 2rem;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

.empty-state .upload-text {
    font-size: 0.875rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #888;
    margin-bottom: 0.5rem;
    min-height: 30px;
}

.empty-state p {
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.empty-state .supported-formats {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.empty-state .btn {
    margin-top: 0.5rem;
    width: auto;
    min-width: 300px;
    min-height: 50px;
    padding: 0.875rem 2rem;
    font-size: 1rem;
}

/* View All Images Button (Canvas Overlay) */
.canvas-view-all-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 255, 163, 0.3);
    border-radius: 8px;
    color: #00ffa3;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
    font-family: 'Inter', sans-serif;
}

.canvas-view-all-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.canvas-view-all-btn:hover {
    background: rgba(0, 255, 163, 0.15);
    border-color: #00ffa3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 163, 0.3);
}

.canvas-view-all-btn:active {
    transform: translateY(0);
}

@keyframes fadeInButton {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile adjustments for View All button */
@media (max-width: 768px) {
    .canvas-view-all-btn {
        top: 0.5rem;
        left: 0.5rem;
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .canvas-view-all-btn svg {
        width: 14px;
        height: 14px;
    }
}

/* Canvas */
#canvas {
    max-width: 100%;
    max-height: 100%;
    display: none;
}

#canvas.visible {
    display: block;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 200;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #333;
    border-top: 4px solid #00ffa3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#loadingText {
    color: #00ffa3;
    font-size: 0.875rem;
    font-weight: 500;
}


/* Mobile Sidebar Bottom (Hidden by default, visible on mobile) */
.mobile-sidebar-bottom {
    display: none;
}

/* ============================================
   4. PANEL COMPONENTS
   ============================================ */

/* Input Group */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    color: #ccc;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.input-group input[type="number"],
.input-group input[type="text"],
.input-group .select {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
}

.input-group input:focus,
.input-group .select:focus {
    outline: none;
    border-color: #00ffa3;
}

.input-hint {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
}

/* Slider */
.slider {
    width: 100%;
    height: 6px;
    background: #333;
    outline: none;
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #00ffa3 0%, #00d4aa 100%);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #00ffa3 0%, #00d4aa 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: transform 0.2s;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, #00ffa3 0%, #00d4aa 50%, #00b894 100%);
    color: #000;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 255, 163, 0.2);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 255, 163, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid #00ffa3;
    color: #00ffa3;
}

.btn-outline:hover {
    background: rgba(0, 255, 163, 0.15);
}

.btn-secondary {
    background: linear-gradient(135deg, #444 0%, #555 100%);
    color: #fff;
    border: 1px solid #666;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #555 0%, #666 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 163, 0.1);
}

/* Quality Panel Format Selection */
.quality-format-section {
    margin-bottom: 1.5rem;
}

.quality-format-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quality-format-btn {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #444;
    border-radius: 8px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.quality-format-btn svg {
    width: 40px;
    height: 40px;
    color: #888;
    transition: color 0.2s;
    flex-shrink: 0;
}

.quality-format-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.quality-format-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ccc;
}

.quality-format-desc {
    font-size: 0.75rem;
    color: #666;
}

.quality-format-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #00ffa3;
}

.quality-format-btn:hover svg,
.quality-format-btn:hover .quality-format-name {
    color: #00ffa3;
}

.quality-format-btn.active {
    background: rgba(0, 255, 163, 0.15);
    border-color: #00ffa3;
}

.quality-format-btn.active svg,
.quality-format-btn.active .quality-format-name {
    color: #00ffa3;
}

.quality-format-btn.active .quality-format-desc {
    color: #00d4aa;
}

/* Quality Preset Buttons */
.quality-preset-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.quality-preset-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #444;
    border-radius: 6px;
    color: #888;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.quality-preset-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #00ffa3;
    color: #00ffa3;
}

.quality-preset-btn.active {
    background: rgba(0, 255, 163, 0.15);
    border-color: #00ffa3;
    color: #00ffa3;
}

/* Preset Buttons */
.preset-section {
    margin-top: 1.5rem;
}

.preset-section h4 {
    font-size: 0.875rem;
    color: #ccc;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.preset-buttons {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 0.5rem;
}

.preset-buttons::-webkit-scrollbar {
    display: none;
}

.preset-btn {
    flex: 0 0 auto;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #444;
    border-radius: 6px;
    color: #888;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 90px;
}

.preset-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #00ffa3;
    color: #00ffa3;
}

.preset-btn.active {
    background: rgba(0, 255, 163, 0.15);
    border-color: #00ffa3;
    color: #00ffa3;
}

.preset-label {
    display: flex;
    align-items: center;
    font-weight: 600;
}

.preset-size {
    font-size: 0.65rem;
    color: #666;
}

.preset-btn.active .preset-size {
    color: #00d4aa;
}

/* Scroll Dots */
.scroll-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 0.5rem;
}

.scroll-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #444;
    transition: all 0.3s;
}

.scroll-dot.active {
    background: #00ffa3;
    transform: scale(1.3);
}

/* Category Toggle */
.category-toggle-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.category-toggle-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #444;
    border-radius: 6px;
    color: #888;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.category-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.category-toggle-btn.active {
    background: rgba(0, 255, 163, 0.15);
    border-color: #00ffa3;
    color: #00ffa3;
}

.preset-category {
    display: none;
}

/* Format Options */
.format-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.format-option {
    cursor: pointer;
}

.format-option input[type="radio"] {
    display: none;
}

.format-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #444;
    border-radius: 8px;
    transition: all 0.2s;
}

.format-card svg {
    width: 32px;
    height: 32px;
    color: #888;
}

.format-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.format-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ccc;
}

.format-desc {
    font-size: 0.75rem;
    color: #666;
}

.format-option:hover .format-card {
    background: rgba(255, 255, 255, 0.08);
    border-color: #00ffa3;
}

.format-option:hover .format-card svg,
.format-option:hover .format-name {
    color: #00ffa3;
}

.format-option.active .format-card {
    background: rgba(0, 255, 163, 0.15);
    border-color: #00ffa3;
}

.format-option.active .format-card svg,
.format-option.active .format-name {
    color: #00ffa3;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #ccc;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #00ffa3;
}

/* ============================================
   MOBILE RESPONSIVE (768px and below)
   ============================================ */
@media (max-width: 768px) {
    /* Mobile layout - prevent URL bar bounce */
    .tool-container {
        display: flex;
        flex-direction: column;
        /* Use dvh (dynamic viewport height) for better mobile browser support */
        height: 100dvh;
        height: calc(var(--vh, 1vh) * 100);
        /* Initially prevent scroll - only allow when SEO content opens */
        overflow: hidden;
        position: fixed;
        width: 100%;
        top: 0;
        left: 0;
    }
    
    /* Allow scroll only when SEO content is visible */
    .tool-container.allow-scroll {
        overflow-y: auto;
        position: relative;
    }
    
    /* Top toolbar stays at top */
    .top-toolbar {
        order: 1;
        flex-shrink: 0;
    }
    
    /* Main Area - Change to flex column */
    .main-area {
        order: 3;
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow: hidden;
        min-height: 300px;
        grid-template-columns: none !important;
    }
    
    /* When panel opens, it overlays from bottom */
    .main-area.panel-open {
        /* Panel overlays, no padding needed */
    }
    
    /* Hide desktop sidebars */
    .desktop-sidebar {
        display: none !important;
    }
    
    /* Canvas Area - Flex to fill space */
    .canvas-area {
        flex: 1;
        min-height: 0; /* Allow flex to shrink */
        grid-column: auto;
        order: 2;
        display: flex;
        flex-direction: column;
    }
    
    .main-area.panel-open .canvas-area {
        grid-column: auto;
        /* When panel is open (130px height), reduce canvas area */
        flex: 1;
        min-height: 0;
        max-height: calc(100% - 130px);
    }
    
    .canvas-wrapper {
        flex: 1;
        min-height: 0;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile Button Size Fix */
    .empty-state .btn {
        width: auto;
        min-width: 200px;
        min-height: 48px;
        padding: 0.75rem 1.75rem;
        font-size: 0.9375rem;
    }
    
    .empty-state h3 {
        font-size: 1rem;
    }
    
    .empty-state svg {
        width: 60px;
        height: 60px;
    }
    
    /* Mobile active state - only icon and text green */
    .mobile-sidebar .settings-btn.active {
        color: #00ffa3 !important;
    }
    
    .mobile-sidebar .settings-btn:hover {
        color: #00ffa3 !important;
    }
    
    /* Settings Panels - Slide from bottom */
    .settings-panel {
        position: absolute;
        top: auto;
        left: 0;
        right: 0;
        bottom: -130px;
        width: 100%;
        height: 130px;
        border-right: none;
        border-top: 1px solid #333;
        border-radius: 12px 12px 0 0;
        overflow-y: auto;
    }
    
    .settings-panel.active {
        bottom: 0px;
        left: 0;
    }
    
    .settings-panel-header {
        display: none;
    }
    
    .settings-panel-content {
        padding: 0.4rem 0.5rem;
    }
    
    /* Mobile Format Buttons - Keep horizontal and optimize for 130px panel */
    .quality-format-section {
        margin-bottom: 0.25rem;
    }
    
    .quality-format-buttons {
        flex-direction: row;
        gap: 0.15rem;
    }
    
    .quality-format-btn {
        flex-direction: column;
        gap: 0.1rem;
        padding: 0.2rem 0.15rem;
    }
    
    .quality-format-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .quality-format-text {
        align-items: center;
    }
    
    .quality-format-name {
        font-size: 0.55rem;
        line-height: 1;
    }
    
    .quality-format-desc {
        font-size: 0.5rem;
        display: none;
    }
    
    /* Mobile Quality Slider - Compact */
    .input-group {
        margin-bottom: 0.25rem;
    }
    
    .input-group label {
        font-size: 0.6rem;
        margin-bottom: 0.15rem;
    }
    
    .slider {
        height: 4px;
    }
    
    .slider::-webkit-slider-thumb {
        width: 12px;
        height: 12px;
    }
    
    .slider::-moz-range-thumb {
        width: 12px;
        height: 12px;
    }
    
    /* Mobile Quality Preset Buttons - Compact */
    .quality-preset-buttons {
        gap: 0.15rem;
        margin-top: 0.25rem;
    }
    
    .quality-preset-btn {
        padding: 0.25rem 0.35rem;
        font-size: 0.6rem;
        min-height: auto;
    }
    
    /* Quality Panel Compact */
    #qualityPanel .settings-panel-content {
        padding: 0.4rem 0.5rem;
    }
    
    /* Output Panel Compact */
    #outputPanel .settings-panel-content {
        padding: 0.4rem 0.5rem;
    }
    
    #outputPanel .input-group {
        margin-bottom: 0;
    }
    
    #outputPanel .checkbox-label {
        font-size: 0.7rem;
        gap: 0.4rem;
    }
    
    #outputPanel .checkbox-label input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }
    
    #outputPanel .input-hint {
        font-size: 0.6rem;
        margin-top: 0.15rem;
    }
    
    /* Mobile Sidebar Bottom */
    .mobile-sidebar-bottom {
        display: flex;
        order: 4;
        width: 100%;
        height: 60px;
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
        border-top: 1px solid #333;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        padding: 0.5rem;
        flex-shrink: 0;
        z-index: 200;
    }
    
    .mobile-sidebar-bottom .settings-btn {
        width: 38px;
        height: 38px;
        min-height: auto;
        gap: 1px;
        padding: 0.25rem;
    }
    
    .mobile-sidebar-bottom .settings-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .mobile-sidebar-bottom .settings-btn span {
        font-size: 0.55rem;
    }
    
    
    /* Empty State Mobile */
    .empty-state {
        padding: 1rem;
        max-width: 300px;
    }
    
    .empty-state svg {
        width: 60px;
        height: 60px;
        margin-bottom: 1rem;
    }
    
    .empty-state h2,
    .empty-state h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .empty-state p {
        font-size: 0.75rem;
    }
    
    .empty-state .supported-formats {
        font-size: 0.65rem;
    }
}

/* ============================================
   MULTIPLE IMAGES GRID LAYOUT
   ============================================ */

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
    width: 100%;
    align-content: start;
    box-sizing: border-box;
}

/* Better responsive grid breakpoints */
@media (min-width: 1400px) {
    .images-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 1024px) and (max-width: 1399px) {
    .images-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 769px) and (max-width: 1023px) {
    .images-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
}

.grid-item {
    position: relative;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 1px solid #333;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 1;
}

.grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 255, 163, 0.15);
    border-color: #00ffa3;
}

.grid-item-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.grid-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 70%, transparent 100%);
    padding: 1rem 0.75rem 0.75rem;
    opacity: 1;
}

.grid-item-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-item-meta {
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-item-delete {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    background: rgba(255, 0, 0, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
}

.grid-item:hover .grid-item-delete {
    opacity: 1;
}

.grid-item-delete:hover {
    transform: scale(1.1);
    background: rgba(255, 0, 0, 1);
}

.grid-item-delete svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

.grid-item-status {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 32px;
    height: 32px;
    background: rgba(0, 255, 163, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.grid-item-status svg {
    width: 18px;
    height: 18px;
    color: #000;
}

/* Mobile Grid Adjustments */
@media (max-width: 768px) {
    .images-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 1rem;
    }
    
    .grid-item-info {
        opacity: 1;
        padding: 0.75rem 0.5rem 0.5rem;
    }
    
    .grid-item-name {
        font-size: 0.75rem;
    }
    
    .grid-item-meta {
        font-size: 0.65rem;
    }
    
    .grid-item-delete {
        opacity: 1;
        width: 28px;
        height: 28px;
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .grid-item-delete svg {
        width: 14px;
        height: 14px;
    }
    
    .grid-item-status {
        width: 28px;
        height: 28px;
        top: 0.5rem;
        left: 0.5rem;
    }
    
    .grid-item-status svg {
        width: 16px;
        height: 16px;
    }
}


/* ============================================
   CANVAS COMPARISON SLIDER - Professional Squoosh-style
   ============================================ */

/* Comparison container - wraps both canvases and slider */
.comparison-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    overflow: hidden;
    z-index: 5;
}

.comparison-container.active {
    display: block;
}

/* Hide main canvas when comparison is active to avoid overlap */
.canvas-wrapper.comparison-active #canvas {
    visibility: hidden;
}

/* Original canvas inside comparison container - base layer */
#canvasOriginal {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    display: block;
}

/* Compressed canvas - overlay layer (right side visible via clip-path) */
#canvasCompressed {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    pointer-events: none;
}

/* Comparison labels */
.comparison-label {
    position: absolute;
    top: 12px;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.comparison-container.active .comparison-label {
    opacity: 1;
}

.comparison-label.original {
    left: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.comparison-label.compressed {
    right: 12px;
    border: 1px solid rgba(0, 255, 163, 0.4);
    color: #00ffa3;
}

/* Comparison Slider - Squoosh-style */
.canvas-comparison-slider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 44px;
    transform: translateX(-50%);
    z-index: 20;
    cursor: ew-resize;
    user-select: none;
    touch-action: none;
}

/* Slider line - vertical divider */
.canvas-slider-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    transform: translateX(-50%);
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.3) 0%, 
        rgba(255, 255, 255, 1) 15%, 
        rgba(255, 255, 255, 1) 85%, 
        rgba(255, 255, 255, 0.3) 100%
    );
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5),
                0 0 30px rgba(0, 255, 163, 0.2);
}

/* Slider handle - circular grab button */
.canvas-slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 52px;
    height: 52px;
    background: linear-gradient(145deg, #ffffff 0%, #f0f0f0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4),
                0 0 0 3px rgba(255, 255, 255, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.canvas-slider-handle::before {
    content: '';
    position: absolute;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    pointer-events: none;
}

.canvas-slider-handle svg {
    width: 26px;
    height: 26px;
    color: #1a1a1a;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

/* Hover and dragging states */
.canvas-comparison-slider:hover .canvas-slider-handle {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5),
                0 0 0 4px rgba(0, 255, 163, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.canvas-comparison-slider.dragging .canvas-slider-handle {
    transform: translate(-50%, -50%) scale(1.12);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5),
                0 0 0 5px rgba(0, 255, 163, 0.5),
                0 0 40px rgba(0, 255, 163, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.canvas-comparison-slider.dragging .canvas-slider-line {
    background: linear-gradient(180deg, 
        rgba(0, 255, 163, 0.3) 0%, 
        rgba(0, 255, 163, 1) 15%, 
        rgba(0, 255, 163, 1) 85%, 
        rgba(0, 255, 163, 0.3) 100%
    );
    box-shadow: 0 0 20px rgba(0, 255, 163, 0.6),
                0 0 40px rgba(0, 255, 163, 0.3);
}

/* Size indicators on slider edges */
.slider-size-indicator {
    position: absolute;
    bottom: 12px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.comparison-container.active .slider-size-indicator {
    opacity: 1;
}

.slider-size-indicator.original-size {
    left: 12px;
}

.slider-size-indicator.compressed-size {
    right: 12px;
    color: #00ffa3;
}

/* Compare toggle button */
.compare-toggle-btn {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 6px;
    z-index: 25;
    transition: all 0.2s ease;
}

.compare-toggle-btn:hover {
    background: rgba(0, 255, 163, 0.2);
    border-color: rgba(0, 255, 163, 0.5);
    color: #00ffa3;
}

.compare-toggle-btn.active {
    background: rgba(0, 255, 163, 0.3);
    border-color: #00ffa3;
    color: #00ffa3;
}

.compare-toggle-btn svg {
    width: 16px;
    height: 16px;
}

/* Canvas wrapper adjustments for comparison mode */
.canvas-wrapper.comparison-active {
    overflow: hidden;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .canvas-slider-handle {
        width: 36px;
        height: 36px;
    }
    
    .canvas-slider-handle::before {
        width: 44px;
        height: 44px;
    }
    
    .canvas-slider-handle svg {
        width: 18px;
        height: 18px;
    }
    
    .canvas-comparison-slider {
        width: 36px;
    }
    
    .canvas-slider-line {
        width: 2px;
    }
    
    .comparison-label {
        font-size: 9px;
        padding: 3px 8px;
        top: 6px;
        border-radius: 4px;
    }
    
    .comparison-label.original {
        left: 6px;
    }
    
    .comparison-label.compressed {
        right: 6px;
    }
    
    .slider-size-indicator {
        font-size: 9px;
        padding: 2px 6px;
        bottom: 6px;
    }
    
    .compare-toggle-btn {
        bottom: 8px;
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .canvas-slider-handle {
        width: 32px;
        height: 32px;
    }
    
    .canvas-slider-handle::before {
        width: 40px;
        height: 40px;
        border-width: 1.5px;
    }
    
    .canvas-slider-handle svg {
        width: 16px;
        height: 16px;
    }
    
    .canvas-comparison-slider {
        width: 32px;
    }
    
    .comparison-label {
        font-size: 8px;
        padding: 2px 6px;
        top: 4px;
        letter-spacing: 0.3px;
    }
    
    .comparison-label.original {
        left: 4px;
    }
    
    .comparison-label.compressed {
        right: 4px;
    }
    
    .slider-size-indicator {
        font-size: 8px;
        padding: 2px 5px;
        bottom: 4px;
    }
}
