/**
 * ZSky Editor — UI Shell Styles
 * Desktop fullscreen image editor overlay
 * (c) ZSky LLC — All rights reserved
 */

/* ================================================================
   Main Overlay
   ================================================================ */

.zse-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.zse-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ================================================================
   Close Button (top left)
   ================================================================ */

.zse-close {
  position: absolute;
  top: 14px;
  left: 14px;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  cursor: pointer;
  padding: 6px 10px;
  line-height: 1;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.zse-close:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.zse-close svg { pointer-events: none; }

/* ================================================================
   Tool Tabs (top center)
   ================================================================ */

.zse-tabs {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px;
  border-radius: 8px;
  z-index: 2;
}

.zse-tab {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  background: none;
  border: none;
  white-space: nowrap;
}

.zse-tab:hover {
  color: rgba(255, 255, 255, 0.6);
}

.zse-tab.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ================================================================
   Toolbar (top right)
   ================================================================ */

.zse-toolbar {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  z-index: 2;
}

.zse-toolbar button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  font-size: 11px;
  font-family: inherit;
}

.zse-toolbar button:hover {
  color: rgba(255, 255, 255, 0.6);
}

.zse-toolbar .zse-save-btn {
  color: #38bdf8;
}

.zse-toolbar .zse-save-btn:hover {
  color: #7dd3fc;
}

/* ================================================================
   Presets Column (left)
   ================================================================ */

.zse-presets {
  position: absolute;
  left: 16px;
  top: 56px;
  bottom: 50px;
  width: 72px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  z-index: 1;
}

.zse-presets::-webkit-scrollbar {
  display: none;
}

.zse-preset {
  width: 72px;
  cursor: pointer;
  margin-bottom: 6px;
  position: relative;
}

.zse-preset img {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
}

.zse-preset.active img {
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
}

.zse-preset-label {
  font-size: 8px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  margin-top: 2px;
}

.zse-preset-save {
  width: 72px;
  height: 36px;
  border-radius: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  background: none;
}

.zse-preset-save:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.4);
}

/* ================================================================
   Canvas Area (center)
   ================================================================ */

.zse-canvas-wrap {
  position: absolute;
  left: 100px;
  right: 224px;
  top: 48px;
  bottom: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#zseCanvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

/* ================================================================
   Nav Arrows
   ================================================================ */

.zse-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 28px;
  color: rgba(255, 255, 255, 0.12);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 2;
  transition: color 0.2s;
}

.zse-nav:hover {
  color: rgba(255, 255, 255, 0.3);
}

.zse-nav-prev {
  left: 100px;
}

.zse-nav-next {
  right: 224px;
}

/* Hidden state for nav arrows (Task 13) */
.zse-nav[style*="display: none"] {
  pointer-events: none;
}

/* ================================================================
   Right Panel
   ================================================================ */

.zse-panel {
  position: absolute;
  right: 16px;
  top: 56px;
  bottom: 50px;
  width: 196px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  z-index: 1;
}

.zse-panel::-webkit-scrollbar {
  display: none;
}

.zse-panel-section {
  display: none;
}

.zse-panel-section.active {
  display: block;
  transition: opacity 0.15s ease, transform 0.15s ease;
  opacity: 1;
  transform: translateX(0);
}

/* Tab switch slide animation (Task 13) */
.zse-panel-section.exiting {
  display: block;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.zse-panel-section.entering {
  opacity: 0;
  transform: translateX(-20px);
}

.zse-group-label {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.zse-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.04);
  margin: 6px 0;
}

/* ================================================================
   Slider Rows
   ================================================================ */

.zse-slider-row {
  padding: 7px 0;
}

.zse-slider-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.zse-slider-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}

.zse-slider-value {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.2);
  transition: color 0.2s;
}

.zse-slider-value.active {
  color: rgba(56, 189, 248, 0.5);
}

/* ── Range Input Base ── */

input[type="range"].zse-range {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 1px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  margin: 0;
  padding: 0;
}

/* ── WebKit Thumb ── */

.zse-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}

.zse-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.zse-range:active::-webkit-slider-thumb {
  transform: scale(1.3);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* ── Firefox Thumb & Track ── */

.zse-range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.15);
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.2s;
}

.zse-range::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.zse-range:active::-moz-range-thumb {
  transform: scale(1.3);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.zse-range::-moz-range-track {
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 1px;
  border: none;
}

/* ── Colored Gradient Tracks ── */

.zse-range.zse-temp {
  background: linear-gradient(90deg, #4a8aff, rgba(255, 255, 255, 0.06) 50%, #ffa64a);
}

.zse-range.zse-tint {
  background: linear-gradient(90deg, #4aff4a, rgba(255, 255, 255, 0.06) 50%, #ff4aff);
}

.zse-range.zse-temp::-moz-range-track {
  background: linear-gradient(90deg, #4a8aff, rgba(255, 255, 255, 0.06) 50%, #ffa64a);
}

.zse-range.zse-tint::-moz-range-track {
  background: linear-gradient(90deg, #4aff4a, rgba(255, 255, 255, 0.06) 50%, #ff4aff);
}

/* ================================================================
   Action Bar (bottom center)
   ================================================================ */

.zse-actions {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  z-index: 2;
}

.zse-actions button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-family: inherit;
  padding: 4px;
}

.zse-actions button:hover {
  color: rgba(255, 255, 255, 0.6);
}

.zse-actions .zse-delete:hover {
  color: rgba(255, 80, 80, 0.6);
}

/* ================================================================
   Track fill indicator (Task 3)
   ================================================================ */

.zse-slider-row {
  position: relative;
}

.zse-slider-row .zse-track-fill {
  position: absolute;
  left: 50%;
  bottom: 5px;
  height: 2px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 1px;
  transform: translateY(-50%);
  pointer-events: none;
  transition: width 0.05s ease;
}

/* Value counter smooth transition */
.zse-slider-value {
  font-variant-numeric: tabular-nums;
}

/* ================================================================
   Preset Thumbnails (Task 4)
   ================================================================ */

.zse-preset {
  transition: transform 0.15s ease;
}

.zse-preset:hover {
  transform: scale(1.04);
}

.zse-preset.active img {
  border: 1.5px solid rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
  animation: zse-preset-glow 0.3s ease;
}

@keyframes zse-preset-glow {
  0% { box-shadow: 0 0 0 rgba(56, 189, 248, 0); }
  50% { box-shadow: 0 0 14px rgba(56, 189, 248, 0.5); }
  100% { box-shadow: 0 0 10px rgba(56, 189, 248, 0.3); }
}

.zse-preset-label.active {
  color: rgba(255, 255, 255, 0.8);
}

/* ================================================================
   Crop Overlay (Task 5)
   ================================================================ */

.zse-crop-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: crosshair;
}

.zse-crop-dim {
  position: absolute;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.zse-crop-box {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-sizing: border-box;
}

.zse-crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: auto;
}

.zse-crop-handle::before,
.zse-crop-handle::after {
  content: '';
  position: absolute;
  background: #fff;
}

.zse-crop-handle-tl::before { top: 0; left: 0; width: 12px; height: 2px; }
.zse-crop-handle-tl::after  { top: 0; left: 0; width: 2px; height: 12px; }

.zse-crop-handle-tr::before { top: 0; right: 0; width: 12px; height: 2px; }
.zse-crop-handle-tr::after  { top: 0; right: 0; width: 2px; height: 12px; }

.zse-crop-handle-bl::before { bottom: 0; left: 0; width: 12px; height: 2px; }
.zse-crop-handle-bl::after  { bottom: 0; left: 0; width: 2px; height: 12px; }

.zse-crop-handle-br::before { bottom: 0; right: 0; width: 12px; height: 2px; }
.zse-crop-handle-br::after  { bottom: 0; right: 0; width: 2px; height: 12px; }

.zse-crop-handle-tl { top: -6px; left: -6px; cursor: nw-resize; }
.zse-crop-handle-tr { top: -6px; right: -6px; cursor: ne-resize; }
.zse-crop-handle-bl { bottom: -6px; left: -6px; cursor: sw-resize; }
.zse-crop-handle-br { bottom: -6px; right: -6px; cursor: se-resize; }

.zse-crop-grid line {
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 1;
}

/* Crop panel aspect ratio buttons */
.zse-aspect-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.zse-aspect-btn {
  flex: 1 1 calc(33.33% - 4px);
  padding: 5px 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: border-color 0.2s, color 0.2s;
}

.zse-aspect-btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
}

.zse-aspect-btn.active {
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

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

.zse-crop-action-btn {
  flex: 1;
  padding: 5px 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s, color 0.2s;
}

.zse-crop-action-btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
}

.zse-apply-crop-btn {
  width: 100%;
  padding: 7px 0;
  border-radius: 6px;
  border: none;
  background: #38bdf8;
  color: #000;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.zse-apply-crop-btn:hover {
  background: #7dd3fc;
}

/* ================================================================
   HSL Sub-tabs (Task 6)
   ================================================================ */

.zse-hsl-subtabs {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.04);
  padding: 2px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.zse-hsl-subtab {
  flex: 1;
  padding: 4px 0;
  border-radius: 4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  background: none;
  border: none;
  text-align: center;
  font-family: inherit;
  transition: background 0.2s, color 0.2s;
}

.zse-hsl-subtab:hover {
  color: rgba(255, 255, 255, 0.55);
}

.zse-hsl-subtab.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.zse-hsl-group {
  display: none;
}

.zse-hsl-group.active {
  display: block;
}

.zse-color-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

/* ================================================================
   Effects Panel (Task 7)
   ================================================================ */

.zse-color-wheel-wrap {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  align-items: flex-start;
}

.zse-color-wheel-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.zse-color-wheel-item span {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.3);
}

.zse-color-wheel {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.zse-color-wheel-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ================================================================
   Tone Curve (Task 8)
   ================================================================ */

.zse-curve-channels {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.04);
  padding: 2px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.zse-curve-ch-btn {
  flex: 1;
  padding: 4px 0;
  border-radius: 4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  background: none;
  border: none;
  text-align: center;
  font-family: inherit;
  transition: background 0.2s, color 0.2s;
}

.zse-curve-ch-btn:hover {
  color: rgba(255, 255, 255, 0.55);
}

.zse-curve-ch-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.zse-curve-svg-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.zse-curve-svg {
  display: block;
  cursor: crosshair;
}

.zse-curve-svg .grid-line {
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 1;
}

.zse-curve-svg .baseline {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.zse-curve-svg .curve-path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 1.5;
}

.zse-curve-svg .histogram-path {
  fill: rgba(255, 255, 255, 0.03);
  stroke: none;
}

.zse-curve-svg .curve-point {
  fill: #fff;
  stroke: none;
  cursor: grab;
  filter: drop-shadow(0 0 3px rgba(255,255,255,0.3));
}

.zse-curve-svg .curve-point:hover {
  fill: #38bdf8;
  filter: drop-shadow(0 0 5px rgba(56,189,248,0.5));
}

.zse-curve-reset-btn {
  display: block;
  width: 100%;
  padding: 5px 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  background: none;
  color: rgba(255, 255, 255, 0.3);
  font-size: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s, border-color 0.2s;
}

.zse-curve-reset-btn:hover {
  color: rgba(255, 255, 255, 0.5);
  border-color: rgba(255, 255, 255, 0.12);
}

/* ================================================================
   Prompt (bottom left)
   ================================================================ */

.zse-prompt {
  position: absolute;
  bottom: 14px;
  left: 100px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.15);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 2;
}

/* ================================================================
   Task 9: Undo/Redo Button States + Before/After
   ================================================================ */

.zse-toolbar button:disabled {
  cursor: default;
}

.zse-toolbar button:disabled:hover {
  color: inherit;
}

.zse-ba-btn {
  user-select: none;
  -webkit-user-select: none;
}

/* ================================================================
   Task 10: Share Popup
   ================================================================ */

.zse-share-popup {
  background: rgba(20, 20, 20, 0.95);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10001;
  min-width: 180px;
  animation: zse-popup-in 0.15s ease;
}

@keyframes zse-popup-in {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.zse-share-icons {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 4px 0;
}

.zse-share-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.zse-share-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.zse-share-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 8px 0;
}

.zse-share-copy-row {
  display: flex;
  justify-content: center;
}

.zse-share-copy-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.zse-share-copy-btn:hover {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.06);
}

/* Redo spinner */
.zse-redo-action.zse-spinning {
  animation: zse-spin 1s linear infinite;
}

@keyframes zse-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ================================================================
   Task 11: Save Flash
   ================================================================ */

.zse-save-flash {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  pointer-events: none;
  z-index: 10;
  transition: background 0.15s ease;
  border-radius: 4px;
}

.zse-save-flash.active {
  background: rgba(255, 255, 255, 0.2);
  animation: zse-flash-out 0.4s ease forwards;
}

@keyframes zse-flash-out {
  0%   { background: rgba(255, 255, 255, 0.25); }
  100% { background: rgba(255, 255, 255, 0); }
}
