/**
 * Smith Image Studio - Editor Styles
 * Phase 2: Artistry
 */

/* Editor Interface */
.editor-interface {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

.editor-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* Sidebar */
.editor-sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    height: fit-content;
}

/* Tabs */
.editor-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
}

.tab-btn {
    flex: 1;
    min-width: 60px;
    padding: 12px 8px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text);
    background: rgba(99, 102, 241, 0.1);
}

.tab-btn.active {
    color: var(--accent);
    background: rgba(99, 102, 241, 0.15);
    box-shadow: inset 0 -2px 0 var(--accent);
}

/* Tab Panels */
.tab-panel {
    display: none;
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.tab-panel.active {
    display: block;
}

.tab-panel::-webkit-scrollbar {
    width: 6px;
}

.tab-panel::-webkit-scrollbar-track {
    background: var(--bg);
}

.tab-panel::-webkit-scrollbar-thumb {
    background: var(--elevated);
    border-radius: 3px;
}

.panel-title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

/* Filter Grid */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.filter-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.filter-btn:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.filter-btn.active {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.filter-preview {
    width: 100%;
    height: 50px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.filter-btn span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.filter-btn.active span {
    color: var(--accent);
}

/* Controls */
.control-group {
    margin-bottom: 20px;
}

.control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.control-value {
    color: var(--accent);
    font-weight: 600;
}

/* Color Picker */
.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

input[type="color"] {
    width: 48px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    cursor: pointer;
}

.color-value {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Textarea */
textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    color: var(--text);
    font-size: 0.9375rem;
    resize: vertical;
    min-height: 80px;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Crop Presets */
.crop-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.crop-preset {
    padding: 10px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.crop-preset:hover {
    border-color: var(--accent);
    color: var(--text);
}

.crop-preset.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Crop Dimensions */
.crop-dimensions {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.dim-input {
    flex: 1;
}

.dim-input label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 4px;
}

.dim-input input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-size: 0.875rem;
}

.dim-input input:focus {
    outline: none;
    border-color: var(--accent);
}

.dim-separator {
    color: var(--muted);
    font-size: 1.25rem;
    padding-bottom: 10px;
}

/* Crop Overlay */
.crop-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.crop-selection {
    position: absolute;
    top: 10%;
    left: 10%;
    right: 10%;
    bottom: 10%;
    border: 2px solid var(--accent);
    background: rgba(99, 102, 241, 0.1);
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
}

.crop-handle.nw { top: -6px; left: -6px; cursor: nw-resize; }
.crop-handle.n { top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.crop-handle.ne { top: -6px; right: -6px; cursor: ne-resize; }
.crop-handle.w { top: 50%; left: -6px; transform: translateY(-50%); cursor: w-resize; }
.crop-handle.e { top: 50%; right: -6px; transform: translateY(-50%); cursor: e-resize; }
.crop-handle.sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.crop-handle.s { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.crop-handle.se { bottom: -6px; right: -6px; cursor: se-resize; }

/* Watermark Type */
.watermark-type {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.wm-type-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.wm-type-btn:hover {
    border-color: var(--accent);
}

.wm-type-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Preview Area */
.editor-preview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.preview-container {
    flex: 1;
    min-height: 400px;
    background: 
        linear-gradient(45deg, #1a1a1f 25%, transparent 25%),
        linear-gradient(-45deg, #1a1a1f 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1a1a1f 75%),
        linear-gradient(-45deg, transparent 75%, #1a1a1f 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #121216;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

#editorCanvas {
    max-width: 100%;
    max-height: 500px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease;
}

.preview-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.preview-controls .btn {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.zoom-level {
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: center;
}

.image-info {
    display: flex;
    justify-content: center;
    gap: 24px;
    font-size: 0.875rem;
    color: var(--muted);
}

/* Export Section */
.export-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.export-options {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.export-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.export-group label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 500;
}

.export-group select {
    min-width: 120px;
}

.export-group input[type="range"] {
    width: 150px;
}

.btn-large {
    padding: 14px 32px;
    font-size: 1rem;
}

/* Action Section */
.action-section {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

/* Responsive */
@media (max-width: 968px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }
    
    .editor-sidebar {
        order: 2;
    }
    
    .editor-preview {
        order: 1;
        min-height: 300px;
    }
    
    .filter-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .export-section {
        flex-direction: column;
        text-align: center;
    }
    
    .export-options {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .crop-presets {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .editor-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .tab-btn {
        min-width: 70px;
    }
}
