/*
 * photo-editor.css — 3-column layout
 * NOTE: uses var(--brand-teal) from your main stylesheet.
 * If not in a :root block, replace with var(--brand-teal, #0d9488).
 */

/* ============================================================
   PAGE HEADER
   ============================================================ */

.editor-page { padding-top: 24px; padding-bottom: 60px; }

.editor-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.editor-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 4px 0;
    letter-spacing: -0.5px;
}

.editor-subtitle { font-size: 15px; color: #666; margin: 0; }

.upgrade-nudge { font-size: 14px; color: var(--brand-teal); text-decoration: none; white-space: nowrap; }
.upgrade-nudge:hover { text-decoration: underline; }

.tier-pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    background: #f0fdf4;
    color: #166534;
    border-radius: 999px;
    border: 1px solid #bbf7d0;
}

/* ============================================================
   3-COLUMN LAYOUT
   ============================================================ */

.editor-container {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.editor-col { display: flex; flex-direction: column; gap: 10px; }

.editor-left  { width: 210px; flex-shrink: 0; }
.editor-right { width: 200px; flex-shrink: 0; }
.editor-center { flex: 1; min-width: 0; }

/* ============================================================
   PANELS
   ============================================================ */

.editor-panel {
    background: white;
    border-radius: 12px;
    border: 1px solid #e0ddd9;
    padding: 14px 16px;
}

.panel-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #999;
    margin: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 12px;
    user-select: none;
    gap: 8px;
}

.panel-header:hover .panel-label { color: #666; }

.panel-toggle {
    font-size: 11px;
    color: #bbb;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    line-height: 1;
    width: auto;
    margin: 0;
}

.editor-panel.is-collapsed .panel-toggle { transform: rotate(-90deg); }

.panel-body {
    overflow: hidden;
    transition: max-height 0.22s ease, opacity 0.18s ease;
    max-height: 600px;
    opacity: 1;
}

.editor-panel.is-collapsed .panel-body {
    max-height: 0;
    opacity: 0;
}

.panel-hint {
    font-size: 12px;
    color: #aaa;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

/* ============================================================
   IMAGE / CANVAS AREA
   ============================================================ */

.editor-canvas-wrap {
    position: relative;
    background: white;
    border-radius: 12px;
    border: 1px solid #e0ddd9;
    min-height: 220px;
    max-height: 52vh;
    display: flex;
    align-items: stretch;
    /* overflow: visible so rotated images and crop handles don't get clipped */
}

/* Drop zone */
.editor-drop-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    cursor: pointer;
    border: 2px dashed #ddd;
    border-radius: 11px;
    transition: border-color 0.2s ease;
    text-align: center;
    width: 100%;
}

.editor-drop-zone:hover,
.editor-drop-zone.drag-over { border-color: var(--brand-teal); background: #f9fffe; }

.drop-label { font-size: 16px; color: #555; margin: 0; }
.drop-hint  { font-size: 13px; color: #aaa; margin: 0; }

/* Image element */
#pe-editor-area {
    width: 100%;
    max-height: 52vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Viewport handles zoom/pan — sits between editor-area and the img */
#pe-img-viewport {
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    transition: transform 0.08s ease;
    width: 100%;
    height: 100%;
}

#pe-preview-img {
    max-width: 100%;
    max-height: 52vh;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    transition: filter 0.1s ease;
    user-select: none;
    -webkit-user-drag: none;
}

/* Loading overlay */
.editor-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    color: #555;
    border-radius: 12px;
    z-index: 10;
}

.spinner {
    width: 18px; height: 18px;
    border: 2px solid #e0ddd9;
    border-top-color: var(--brand-teal);
    border-radius: 50%;
    flex-shrink: 0;
    animation: pe-spin 0.7s linear infinite;
}

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

/* ============================================================
   BUTTONS
   ============================================================ */

.editor-btn {
    width: auto;
    flex: 1;
    padding: 8px 10px;
    margin: 0;
    font-size: 13px;
    background: #f7f5f2;
    color: #222;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.3;
}

.editor-btn:hover     { background: #edeae6; border-color: #ccc; }
.editor-btn:disabled  { opacity: 0.45; cursor: not-allowed; }

.btn-row { display: flex; gap: 8px; margin-bottom: 12px; }

.reset-btn { width: 100%; margin-top: 10px; font-size: 12px; color: #888; }
.reset-btn:hover { color: #333; }

/* Download button */
.download-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    margin: 10px 0 0 0;
    font-size: 15px;
    font-weight: 600;
    background: #222;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s;
    text-align: center;
}

.download-btn:hover    { opacity: 0.88; }
.download-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* New image */
.new-image-btn {
    width: auto; margin: 0; padding: 6px 0;
    background: none; border: none;
    font-size: 13px; color: #888; cursor: pointer; text-align: center; display: block;
}
.new-image-btn:hover { color: #333; }

.editor-action-btns {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0 16px;
    padding: 4px 2px 0;
}

.clear-edits-btn {
    width: auto; margin: 0; padding: 6px 0;
    background: none; border: none;
    font-size: 13px; color: #c0392b; cursor: pointer; text-align: center; display: block;
}
.clear-edits-btn:hover { color: #922b21; }

/* ============================================================
   CROP PANEL
   ============================================================ */

.crop-activate-btn { width: 100%; text-align: center; margin-bottom: 8px; }

.crop-hint-text { font-size: 12px; color: #aaa; margin: 0; text-align: center; }

.aspect-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.aspect-btn {
    width: auto; margin: 0;
    padding: 7px 4px;
    font-size: 12px;
    background: #f7f5f2; color: #444;
    border: 1px solid #ddd; border-radius: 6px;
    cursor: pointer; text-align: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.aspect-btn:hover { background: #edeae6; }
.aspect-btn.active { background: var(--brand-teal); border-color: var(--brand-teal); color: white; }

.crop-action-row { display: flex; gap: 6px; margin-top: 8px; }

.crop-apply-btn  { background: #222; color: white; border-color: #222; }
.crop-apply-btn:hover { background: #444; border-color: #444; color: white; }

.crop-cancel-btn { color: #666; }

#pe-crop-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    z-index: 10;
    cursor: crosshair;
    overflow: hidden;
}

/* ============================================================
   SLIDERS
   ============================================================ */

.slider-row { margin-bottom: 14px; position: relative; }
.slider-row:last-of-type { margin-bottom: 0; }

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
}

.slider-val { font-size: 12px; color: #888; min-width: 28px; text-align: right; }

input[type='range'].editor-range {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 4px; padding: 0; margin: 0;
    background: #e0ddd9; border: none; border-radius: 2px;
    outline: none; cursor: pointer; box-sizing: border-box;
}

input[type='range'].editor-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--brand-teal); cursor: pointer; border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

input[type='range'].editor-range::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--brand-teal); cursor: pointer; border: none;
}

input[type='range'].editor-range:disabled { opacity: 0.35; cursor: not-allowed; }

/* ============================================================
   EXPORT
   ============================================================ */

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #444;
    padding: 6px 0 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type='checkbox'] {
    width: 15px;
    height: 15px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--brand-teal);
}

.format-select {
    width: 100%; padding: 8px 10px; margin: 0 0 10px 0;
    font-size: 14px; background: #f7f5f2; color: #222;
    border: 1px solid #ddd; border-radius: 8px;
    cursor: pointer; box-sizing: border-box;
}

/* ============================================================
   LOCKED FEATURE — greyed slider + lock icon with tooltip
   ============================================================ */

.slider-row.feature-locked input[type='range'].editor-range {
    opacity: 0.35;
    cursor: not-allowed;
}

.lock-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    cursor: help;
    position: relative;
}

.lock-icon svg {
    width: 13px; height: 13px;
    opacity: 0.4;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.lock-icon:hover svg { opacity: 0.7; }

.lock-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 100;
    line-height: 1.4;
    pointer-events: none;
}

.lock-tooltip a {
    color: #7dd3c8;
    text-decoration: underline;
    pointer-events: all;
}

.lock-tooltip::after {
    content: '';
    position: absolute;
    top: 100%; left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #222;
}

.lock-icon:hover .lock-tooltip { display: block; }

/* ============================================================
   ZOOM TOOLBAR
   ============================================================ */

.zoom-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e0ddd9;
    border-radius: 8px;
    margin-top: 8px;
}

.zoom-btn {
    width: auto;
    margin: 0;
    padding: 2px 10px;
    font-size: 18px;
    line-height: 1.2;
    background: #f7f5f2;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    color: #333;
    font-weight: 400;
    flex-shrink: 0;
}

.zoom-btn:hover { background: #edeae6; }

.zoom-val {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    min-width: 42px;
    text-align: center;
}

.zoom-divider {
    width: 1px;
    height: 16px;
    background: #ddd;
    flex-shrink: 0;
}

.zoom-reset-btn {
    width: auto;
    margin: 0;
    padding: 4px 10px;
    font-size: 12px;
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    color: #666;
    flex-shrink: 0;
}

.zoom-reset-btn:hover { color: #333; border-color: #bbb; }

.zoom-hint {
    font-size: 12px;
    color: #bbb;
    margin-left: auto;
}

/* ============================================================
   VIGNETTE OVERLAY
   ============================================================ */

/* pe-img-inner sizes to the image. overflow:visible lets rotated content
   and crop handles extend beyond the layout box without clipping. */

#pe-img-inner {
    position: relative;
    display: inline-flex;
    line-height: 0;
    flex-shrink: 0;
    max-width: 100%;
    overflow: visible;
}

#pe-vignette-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

/* ============================================================
   AUTO BUTTON + ADJUSTMENT LABEL ROW
   ============================================================ */

.adj-auto-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.auto-btn {
    width: auto;
    margin: 0;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    cursor: pointer;
    line-height: 1.6;
    flex-shrink: 0;
    transition: background 0.15s;
}

.auto-btn:hover { background: #dcfce7; }

/* ============================================================
   CUSTOM CROP OVERLAY
   ============================================================ */

#pe-crop-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    cursor: crosshair;
}

#pe-crop-box {
    position: absolute;
    border: 1.5px solid white;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.42);
    cursor: move;
    box-sizing: border-box;
    max-width: 100%;
    max-height: 100%;
}

/* Corner + edge handles */
.crop-handle {
    position: absolute;
    width: 11px;
    height: 11px;
    background: white;
    border: 1px solid rgba(0,0,0,0.4);
    box-sizing: border-box;
}

.crop-handle[data-handle="nw"] { top:0; left:0; cursor:nw-resize; }
.crop-handle[data-handle="n"]  { top:0; left:50%; transform:translateX(-50%); cursor:n-resize; }
.crop-handle[data-handle="ne"] { top:0; right:0; cursor:ne-resize; }
.crop-handle[data-handle="e"]  { top:50%; right:0; transform:translateY(-50%); cursor:e-resize; }
.crop-handle[data-handle="se"] { bottom:0; right:0; cursor:se-resize; }
.crop-handle[data-handle="s"]  { bottom:0; left:50%; transform:translateX(-50%); cursor:s-resize; }
.crop-handle[data-handle="sw"] { bottom:0; left:0; cursor:sw-resize; }
.crop-handle[data-handle="w"]  { top:50%; left:0; transform:translateY(-50%); cursor:w-resize; }

/* Rule-of-thirds grid lines */
.crop-grid-line {
    position: absolute;
    background: rgba(255,255,255,0.25);
    pointer-events: none;
}
.crop-grid-line.v1 { left:33.33%; top:0; bottom:0; width:1px; }
.crop-grid-line.v2 { left:66.66%; top:0; bottom:0; width:1px; }
.crop-grid-line.h1 { top:33.33%; left:0; right:0; height:1px; }
.crop-grid-line.h2 { top:66.66%; left:0; right:0; height:1px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 700px) {
    .editor-container { flex-direction: column; }
    .editor-left, .editor-right { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .editor-panel { flex: 1; min-width: 180px; }
    .editor-canvas-wrap { min-height: 280px; }
}

/* ============================================================
   photo-editor.css — ADDITIONS
   Append to the end of your existing photo-editor.css
   ============================================================ */

/* Tighter panel spacing */
.editor-panel { padding: 10px 12px; }
.slider-row   { margin-bottom: 10px; }
.slider-row:last-of-type { margin-bottom: 0; }
.panel-header { margin-bottom: 8px; }
.btn-row      { margin-bottom: 8px; }

/* Adjust / Filters tabs */
.pe-panel-tabs {
    display: flex;
    margin: 0 -12px 12px;
    background: #f7f5f2;
    border-bottom: 1px solid #e0ddd9;
    border-radius: 0;
    overflow: hidden;
}
.pe-panel-tab {
    flex: 1;
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #aaa;
    cursor: pointer;
    margin: 0;
    width: auto;
    transition: background .15s, color .15s, border-color .15s;
    text-align: center;
}
.pe-panel-tab:hover { background: #edeae6; color: #555; }
.pe-panel-tab.active {
    background: white;
    color: #1E566C;
    border-bottom-color: #1E566C;
}

/* Filter preset grid */
.pe-filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}
.pe-filter-btn {
    padding: 8px 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    background: #f7f5f2;
    border: 1px solid #e0ddd9;
    border-radius: 6px;
    cursor: pointer;
    color: #555;
    text-align: center;
    margin: 0;
    width: auto;
    transition: background .12s, border-color .12s, color .12s;
}
.pe-filter-btn:hover  { background: #edeae6; border-color: #ccc; }
.pe-filter-btn.active { background: #1E566C; border-color: #1E566C; color: white; }

