/* Adobe AI — Photo Enhancement Studio */
/* Professional dark creative workspace */

:root {
  --bg: #0b0d10;
  --panel: #14181f;
  --panel-border: #232a33;
  --canvas-bg: #0a0a0a;
  --text: #e8eaed;
  --text-muted: #94a0ad;
  --accent: #6a9eff;
  --accent-hover: #85b4ff;
  --success: #4ade80;
  --danger: #ff5f5f;
  --warning: #fbbf24;
  --slider: #3b4552;
  --slider-thumb: #ffffff;
  --rail: rgba(255,255,255,0.06);
  --shadow: 0 20px 40px -10px rgba(0,0,0,0.6);
  --radius: 6px;
  --transition: 0.15s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }

/* ---------- App Shell ---------- */
.app {
  display: grid;
  grid-template-rows: 48px 1fr;
  grid-template-columns: 1fr;
  height: 100vh;
  max-height: 100vh;
}

.topbar {
  background: #0f1218;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #6a9eff, #8b5cf6);
  display: grid; place-items: center;
  color: #0b0d10;
  font-weight: 700; font-size: 14px;
}
.brand-text { font-weight: 700; font-size: 15px; letter-spacing: -0.5px; }
.brand-text .sub {
  font-weight: 400; font-size: 10px; color: var(--text-muted);
  margin-left: 6px; opacity: 0.8;
}

.topbar-actions { display: flex; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; padding: 0 14px;
  border-radius: var(--radius);
  font-size: 12.5px; font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #0b0d10; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid var(--panel-border);
}
.btn-outline:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); }
.btn-danger {
  background: rgba(255,95,95,0.15);
  color: var(--danger);
  border: 1px solid rgba(255,95,95,0.35);
}
.btn-danger:hover { background: rgba(255,95,95,0.25); }
.btn-icon, .icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  color: var(--text-muted);
  display: grid; place-items: center;
  font-size: 15px;
}
.icon-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.btn.full { width: 100%; }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Workspace ---------- */
.workspace {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.panel {
  width: 340px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.panel-left { order: 1; }
.panel-right { order: 3; }

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--panel-border);
}
.panel-header h2 {
  font-size: 13px; font-weight: 600; letter-spacing: -0.3px;
  display: flex; align-items: center; gap: 6px;
}
.panel-header h3 { font-size: 12.5px; font-weight: 600; }
.pill {
  padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600;
  background: rgba(106,158,255,0.12); color: var(--accent);
  border: 1px solid rgba(106,158,255,0.25);
}
.status-pill { background: rgba(255,255,255,0.05); color: var(--text-muted); border-color: var(--panel-border); }

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

/* ---------- Upload Zone ---------- */
.upload-zone {
  padding: 26px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.drop-inner {
  border: 2px dashed var(--panel-border);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer;
}
.drop-inner:hover { border-color: var(--accent); color: var(--text); background: rgba(106,158,255,0.04); }
.drop-inner.drag-over { border-color: var(--accent); background: rgba(106,158,255,0.12); color: var(--text); }
.drop-icon { font-size: 34px; margin-bottom: 8px; opacity: 0.6; }
.drop-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.drop-sub { font-size: 12.5px; margin-bottom: 6px; }
.drop-sub .drop-browse { color: var(--accent); text-decoration: underline; font-weight: 600; }
.drop-sub .drop-browse:hover { text-decoration: none; }
.drop-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.drop-preview {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  overflow: hidden;
  background: #0d0f14;
  position: relative;
  aspect-ratio: 1;
  display: grid; place-items: center;
}
.drop-preview img { max-width: 100%; max-height: 100%; display: block; }
.drop-actions {
  position: absolute; bottom: 10px; right: 10px; display: flex; gap: 6px;
}

/* ---------- Analysis Card ---------- */
.analysis-card {
  margin: 0 20px 20px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  overflow: hidden;
  background: #0f1218;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--panel-border);
  background: #0c0e13;
}
.card-header h3 { font-size: 12px; font-weight: 600; letter-spacing: -0.2px; }
.badge {
  font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 10px;
  background: var(--success); color: #0b0d10;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 14px 16px;
}
.metric {
  background: #0b0d10;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px;
}
.metric .m-label {
  font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 4px; display: block;
}
.metric .m-value {
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text);
}
.metric .m-value.warn { color: var(--warning); }
.metric .m-value.bad { color: var(--danger); }
.metric .m-value.good { color: var(--success); }

.scene-info {
  padding: 10px 16px 14px;
  font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--panel-border);
}
.scene-info .scene-tag {
  display: inline-block; padding: 2px 8px; border-radius: 8px;
  background: rgba(255,255,255,0.06); color: var(--accent);
  border: 1px solid rgba(106,158,255,0.25); font-size: 10.5px; font-weight: 600;
  margin-right: 6px; margin-bottom: 4px;
}

.analysis-actions { padding: 14px 16px; border-top: 1px solid var(--panel-border); }

/* ---------- Viewport / Canvas ---------- */
.viewport {
  width: 100%; height: 100%;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(45deg, #111318 25%, #0c0e12 25%, #0c0e12 50%, #111318 50%, #111318 75%, #0c0e12 75%, #0c0e12 100%);
  background-size: 40px 40px;
}

.rulers { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.ruler-top { position: absolute; top: 0; left: 40px; right: 0; height: 24px; background: #0c0e12; border-bottom: 1px solid var(--panel-border); }
.ruler-left { position: absolute; top: 24px; left: 0; width: 40px; bottom: 0; background: #0c0e12; border-right: 1px solid var(--panel-border); }

.comparison-wrap {
  position: relative;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.before-pane, .after-pane {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.before-pane { z-index: 3; }
.after-pane { z-index: 4; clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%); }

.pane-label {
  position: absolute; top: 14px; left: 14px; z-index: 10;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: 4px;
  background: rgba(0,0,0,0.45); color: #fff;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.15);
  text-transform: uppercase;
}

canvas {
  max-width: 100%; max-height: 100%;
  display: block;
  filter: drop-shadow(0 10px 25px rgba(0,0,0,0.5));
}

.slider {
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 2px; background: rgba(255,255,255,0.25);
  z-index: 8; transform: translateX(-50%);
  cursor: ew-resize; user-select: none;
}
.slider-handle {
  position: absolute; left: 50%; top: 50%;
  width: 34px; height: 34px;
  transform: translate(-50%, -50%);
  background: #fff; border-radius: 50%;
  border: 2px solid var(--bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  cursor: ew-resize; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #0b0d10;
}
.slider-handle::after { content: '‹ ›'; letter-spacing: -2px; }

.view-controls {
  position: absolute; bottom: 18px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 15;
  background: rgba(15,18,24,0.85);
  padding: 4px 8px; border-radius: 20px;
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(6px);
}
.view-btn {
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 12px; color: var(--text-muted);
  display: grid; place-items: center;
}
.view-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.view-btn.active { background: var(--accent); color: #0b0d10; font-weight: 700; }

.canvas-hint {
  position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%);
  font-size: 13px; color: var(--text-muted);
  background: rgba(15,18,24,0.7); padding: 6px 14px;
  border-radius: 20px; border: 1px solid var(--panel-border);
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.zoom-lens {
  position: absolute;
  width: 160px; height: 160px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(0,0,0,0.2);
  pointer-events: none; z-index: 20;
  overflow: hidden;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.15), 0 8px 24px rgba(0,0,0,0.5);
  display: none;
}

/* ---------- Right Panel: Adjustments ---------- */
.adjustments-pane, .presets-pane {
  padding: 16px 20px 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.presets-pane { padding-top: 10px; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section h4 {
  font-size: 10.5px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px; padding-bottom: 4px;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 2px;
}
.section.compact h4 { border: none; margin-bottom: 6px; }

.ctrl-group { display: flex; flex-direction: column; gap: 10px; }
.ctrl {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.ctrl-label {
  font-size: 12px; font-weight: 500; min-width: 78px;
  color: var(--text);
}
.ctrl-value {
  font-size: 11.5px; font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums; color: var(--text-muted);
  min-width: 32px; text-align: right;
}
.ctrl input[type=range] {
  flex: 1; height: 4px; -webkit-appearance: none; appearance: none;
  background: var(--slider); border-radius: 2px;
  outline: none;
}
.ctrl input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  background: var(--slider-thumb); border-radius: 50%;
  cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.btn-reset {
  width: 22px; height: 22px; border-radius: 50%;
  color: var(--text-muted); font-size: 12px;
  display: grid; place-items: center; opacity: 0.5;
}
.btn-reset:hover { opacity: 1; color: var(--danger); background: rgba(255,95,95,0.15); }

.toggle-ctrl {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text); font-weight: 500;
}
.toggle-ctrl input { width: 16px; height: 16px; accent-color: var(--accent); }

.adjust-footer {
  display: flex; gap: 8px; margin-top: 4px;
  padding-top: 10px; border-top: 1px solid var(--panel-border);
}

/* ---------- Presets ---------- */
.presets-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 6px;
}
.preset-intensity-wrap {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text);
}
.preset-intensity-wrap label { font-weight: 600; min-width: 44px; }
.preset-intensity-wrap input { width: 80px; }
.preset-intensity-wrap span {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--accent); min-width: 34px; text-align: right;
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.preset-btn {
  height: 56px; border-radius: 8px;
  background: #0c0e12; border: 1px solid var(--panel-border);
  color: var(--text); font-size: 11.5px; font-weight: 600;
  display: flex; flex-direction: column; align-items: flex-start;
  justify-content: center; padding: 10px 12px;
  text-align: left; transition: all var(--transition);
  overflow: hidden; position: relative;
}
.preset-btn:hover {
  border-color: var(--accent); background: rgba(106,158,255,0.08);
  transform: translateY(-1px);
}
.preset-btn.active {
  background: var(--accent); color: #0b0d10; border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(106,158,255,0.35);
}
.preset-kicker {
  font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); margin-bottom: 2px;
}
.preset-name { font-size: 12.5px; font-weight: 700; }
.preset-dot {
  position: absolute; right: 8px; bottom: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted); opacity: 0.5;
}
.preset-btn.active .preset-dot { background: #0b0d10; opacity: 1; }

/* ---------- Export Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-content {
  position: relative; width: 440px; max-width: 90vw; max-height: 85vh;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 10px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--panel-border);
}
.modal-header h3 { font-size: 15px; font-weight: 700; }
.btn-close { width: 28px; height: 28px; border-radius: 6px;
  color: var(--text-muted); display: grid; place-items: center; font-size: 16px; line-height: 1; }
.btn-close:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 18px; }
.export-preview {
  width: 100%; height: 200px; background: #0a0a0a; border: 1px solid var(--panel-border);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.export-preview img { max-width: 100%; max-height: 100%; display: block; }
.export-options { display: flex; flex-direction: column; gap: 12px; }
.opt-group { display: flex; flex-direction: column; gap: 6px; }
.opt-group label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.seg { display: flex; gap: 4px; }
.seg-btn {
  flex: 1; height: 30px; border-radius: 6px;
  background: #0b0d10; border: 1px solid var(--panel-border);
  color: var(--text); font-size: 12px; font-weight: 600;
}
.seg-btn:hover { border-color: var(--accent); background: rgba(106,158,255,0.08); }
.seg-btn.active { background: var(--accent); color: #0b0d10; border-color: var(--accent); }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--panel-border);
  background: #0c0e12;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #0f1218; border: 1px solid var(--panel-border);
  color: var(--text); padding: 8px 14px; border-radius: 8px;
  font-size: 12.5px; z-index: 100;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.toast.show { opacity: 1; }

/* ---------- Utilities ---------- */
.mt { margin-top: 10px; }
.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .panel-left, .panel-right { width: 280px; }
  .workspace { display: block; height: auto; min-height: 100vh; }
  .panel { width: 100%; max-height: 42vh; border-right: none; border-bottom: 1px solid var(--panel-border); }
  .panel-left { order: 2; }
  .panel-right { order: 3; }
  .canvas-area { order: 1; min-height: 55vh; }
  .app { grid-template-rows: 48px 1fr 1fr; }
}
@media (max-width: 600px) {
  .topbar { padding: 0 14px; }
  .panel-header { padding: 12px 14px; }
  .metrics-grid { grid-template-columns: 1fr; }
  .presets-grid { grid-template-columns: 1fr; }
  .drop-inner { padding: 24px 16px; }
}
