/* Editor specific styles */

/* All buttons should have pointer cursor */
button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

/* Canvas wrapper */
#canvas-wrapper {
    position: relative;
    background: #fff;
    overflow: hidden;
}

/* Pan mode cursors */
#canvas-wrapper.pan-ready .canvas-container,
#canvas-wrapper.pan-ready .canvas-container canvas {
    cursor: grab !important;
}

#canvas-wrapper.is-panning .canvas-container,
#canvas-wrapper.is-panning .canvas-container canvas {
    cursor: grabbing !important;
}

/* Fabric.js canvas controls customization */
.canvas-container {
    margin: 0 auto;
}

/* Toolbar button active state */
.toolbar-btn.active {
    color: #f59e0b;
    background-color: #fffbeb;
}

/* Text toolbar button active state */
#text-toolbar button.active {
    background-color: #f59e0b;
    color: white;
}

/* Sticker item */
.sticker-item {
    cursor: grab;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 4px;
    transition: all 0.2s;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
}

.sticker-item:hover {
    border-color: #f59e0b;
    background: #fffbeb;
}

.sticker-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.sticker-item:active {
    cursor: grabbing;
}

/* Sticker dragging state */
.sticker-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

[data-sticker-url].dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

/* Canvas drop zone highlight */
#canvas-wrapper.drag-over {
    outline: 3px dashed #f59e0b;
    outline-offset: -3px;
    background: rgba(245, 158, 11, 0.05);
}

/* Theme preset active state */
.theme-preset.active {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

/* Toast notification */
.toast {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
}

.toast-success {
    background: #f59e0b;
    color: white;
}

.toast-error {
    background: #ef4444;
    color: white;
}

.toast-info {
    background: #3b82f6;
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.removing {
    animation: slideOut 0.3s ease forwards;
}

/* Photo placeholder styling */
.photo-placeholder {
    border: 2px dashed #d1d5db;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.photo-placeholder:hover {
    border-color: #f59e0b;
    background: #fffbeb;
}

/* Export modal animation */
#export-modal {
    transition: opacity 0.2s;
}

#export-modal.show {
    opacity: 1;
}

#export-modal > div {
    transform: scale(0.95);
    transition: transform 0.2s;
}

#export-modal.show > div {
    transform: scale(1);
}

/* Layers controls - bottom left */

.layers-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    color: #9ca3af;
    transition: all 0.2s;
}

.layers-btn:hover {
    color: #6b7280;
}

.layers-btn.active {
    color: #f59e0b;
    background: #fffbeb;
}

.layers-popup {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    width: 220px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.layers-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid #f3f4f6;
}

.layers-list {
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
}

.layers-list .layer-item {
    font-size: 12px;
}

/* Lock button in layers panel */
.layer-item .lock-btn {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.layer-item:hover .lock-btn,
.layer-item .lock-btn.text-amber-500 {
    opacity: 1;
}

/* Locked layer style */
.layer-item.layer-locked {
    cursor: default;
}

.layer-item.layer-locked .layer-name {
    text-decoration: line-through;
    text-decoration-color: rgba(0, 0, 0, 0.2);
}

/* Zoom controls - pill design */
#zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 12px;
    border-radius: 999px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

#zoom-controls button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #9ca3af;
    transition: all 0.2s;
    flex-shrink: 0;
}

#zoom-controls button:hover {
    color: #6b7280;
}

#zoom-track {
    width: 100px;
    height: 2px;
    background: #e5e7eb;
    border-radius: 999px;
    position: relative;
    display: flex;
    align-items: center;
}

#zoom-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 2px;
    background: transparent;
    cursor: pointer;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

#zoom-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 2px;
    background: #e5e7eb;
    border-radius: 999px;
}

#zoom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #6b7280;
    border-radius: 50%;
    cursor: pointer;
    margin-top: -5px;
    transition: transform 0.15s ease;
}

#zoom-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#zoom-range::-moz-range-track {
    width: 100%;
    height: 2px;
    background: #e5e7eb;
    border-radius: 999px;
}

#zoom-range::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #6b7280;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

#zoom-range::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* Loading spinner for stickers */
.sticker-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    #stickers-panel {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 100;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
    }

    #theme-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
    }
}

/* Color picker styling */
input[type="color"] {
    -webkit-appearance: none;
    border: none;
    padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Canvas selection controls customization */
.upper-canvas {
    cursor: default;
}

/* Hide default Fabric.js selection border, we'll customize it */
.canvas-container .lower-canvas,
.canvas-container .upper-canvas {
    border-radius: 0;
}
