/* Editor Container */
#editor-container {
    display: none;
    position: relative; 
    border-radius: 12px;
    margin: 40px 0; 
}
 
/* Editor Layout */
.editor-layout {
    position: relative;
    display: flex;
    height: 80vh;
    background: var(--editor-bg);
    overflow: hidden;
}

/* Top Toolbar */
.tools-sidebar {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    z-index: 10;
    width: 100%;
    height: auto;
    background: var(--editor-toolbar-bg);
    padding: 10px 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: none;
    border-bottom: 1px solid var(--editor-border);
    border-radius: 0;
    box-shadow: none;
}

.tool-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--neutral-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: var(--editor-hover-bg);
    color: var(--color-white);
}

.tool-divider {
    width: 1px;
    height: 24px;
    background: var(--editor-divider);
    margin: 0 5px;
}

.tool-btn.active {
    background: var(--primary-color);
    color: var(--color-white);
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--editor-bg);
    z-index: 1;
    overflow: hidden;
}

.canvas-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--editor-bg);
    position: relative;
}

.canvas-wrapper {
    position: relative;
    transform-origin: center center;
    box-shadow: 0 0 30px var(--overlay-black-50);
}

#editor-canvas {
    display: block;
    background: repeating-conic-gradient(var(--editor-checker-light) 0% 25%, var(--editor-checker-dark) 0% 50%) 50% / 16px 16px;
}

/* Right Sidebar - Settings */
.settings-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--editor-toolbar-bg);
    padding: 20px 15px;
    border-left: 1px solid var(--editor-border);
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    z-index: 2;
}

.settings-group {
    background: var(--editor-panel-bg);
    border-radius: 8px;
    padding: 15px;
}

.settings-group h6 {
    color: var(--neutral-500);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 12px 0;
}

.setting-row {
    margin-bottom: 15px;
}

.setting-row:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--neutral-300);
}

.setting-value {
    color: var(--primary-color);
    font-weight: 600;
}

/* Color Palette */
.color-palette {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.color-swatch.active {
    border-color: var(--color-white);
    box-shadow: 0 0 0 2px var(--primary-color), 0 0 12px rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* Custom color input */
.form-control-color {
    height: 36px;
    padding: 3px;
    border: 1px solid var(--editor-border);
    border-radius: 6px;
    background: var(--editor-panel-bg);
    cursor: pointer;
}

.form-control-color::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.form-control-color::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Blend mode select */
.form-select {
    background-color: var(--editor-panel-bg);
    border: 1px solid var(--editor-border);
    color: var(--neutral-300);
    font-size: 13px;
    border-radius: 6px;
    padding: 6px 10px;
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.25);
    outline: none;
}

.form-select option {
    background: var(--editor-toolbar-bg);
    color: var(--neutral-300);
}

/* Bottom Bar */
.bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--editor-toolbar-bg);
    border-top: 1px solid var(--editor-border);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--editor-divider);
    border-radius: 6px;
    background: var(--editor-hover-bg);
    color: var(--color-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: var(--editor-divider);
    border-color: var(--editor-hover-border);
}

#zoom-level {
    min-width: 50px;
    text-align: center;
    color: var(--neutral-500);
    font-size: 12px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-buttons .btn {
    min-width: 140px;
}

/* Range Input Styling */
.form-range {
    width: 100%;
    height: 6px;
    padding: 0;
    background: var(--editor-hover-bg);
    border-radius: 3px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-range:focus {
    outline: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1rem;
    height: 1rem;
    background: var(--primary-color);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.form-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    color: transparent;
    cursor: pointer;
    background-color: var(--editor-divider);
    border-color: transparent;
    border-radius: 3px;
}

/* Eye detection error */
.eye-error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eye-error-box {
    background: var(--editor-toolbar-bg, #1e1e2e);
    border: 1px solid var(--editor-border, #333);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.eye-error-box .error-icon {
    font-size: 48px;
    color: #ff6b6b;
    margin-bottom: 16px;
}

.eye-error-box h4 {
    color: #fff;
    margin-bottom: 12px;
    font-size: 20px;
}

.eye-error-box p {
    color: #999;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.6;
}

.eye-error-box .btn-try-again {
    background: var(--primary-color, #4a90e2);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 32px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.eye-error-box .btn-try-again:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
    .editor-layout {
        flex-direction: column;
        height: auto;
        min-height: 80vh;
    }
    
    .canvas-area {
        min-height: 50vh;
    }
    
    .tools-sidebar {
        width: 100%;
        flex-direction: row;
        padding: 10px;
        border-right: none;
        border-bottom: 1px solid var(--editor-border);
        justify-content: center;
    }
    
    .tool-divider {
        width: 1px;
        height: 30px;
        margin: 0 10px;
    }
    
    .settings-sidebar {
        width: 100%;
        flex-shrink: 1;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 15px;
        border-left: none;
        border-top: 1px solid var(--editor-border);
    }
    
    .settings-group {
        flex: 1;
        min-width: 150px;
    }

    .bottom-bar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .color-palette {
        grid-template-columns: repeat(5, 1fr);
    }
}
