/* ================================================================
   SLICE STUDIO — DARK PANEL THEME (YukiPixels style)
   Font: Consolas monospace. Background: medium-dark grays.
   ================================================================ */

:root {
  --bg:        #252525;
  --panel:     #2a2a2a;
  --panel-2:   #2d2d2d;
  --panel-3:   #353535;
  --border:    #3a3a3a;
  --border-2:  #464646;
  --text:      #d4d4d4;
  --text-dim:  #909090;
  --text-faint:#585858;

  --c-cyan:    #00FFFF;
  --c-magenta: #dc00FF;
  --c-blue:    #3264fa;
  --c-orange:  #FF5500;
  --c-yellow:  #FFD200;

  --accent:     var(--c-cyan);
  --accent-dim: rgba(0,255,255,0.09);
  --danger:     #FF3355;

  --font: 'Consolas', 'Lucida Console', 'Courier New', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  user-select: none;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border-2);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  border-bottom: 1px solid var(--border-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px 11px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--c-cyan);
  border-bottom: 1px dashed var(--border);
}
.brand-dot {
  width: 8px;
  height: 8px;
  background: var(--c-cyan);
  flex-shrink: 0;
}

.upload-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  color: var(--c-cyan);
  border: none;
  font-family: var(--font);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
  cursor: pointer;
}
.upload-btn:hover { background: var(--accent-dim); }
.hidden-input { display: none; }

.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--c-magenta);
  border-bottom: 1px dashed var(--border);
}

.file-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 8px;
}
.file-list::-webkit-scrollbar { width: 5px; }
.file-list::-webkit-scrollbar-thumb { background: var(--panel-3); }
.file-list::-webkit-scrollbar-track { background: transparent; }

.file-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border-left: 3px solid transparent;
  cursor: pointer;
}
.file-item:hover { background: var(--panel-2); }
.file-item.active {
  background: var(--accent-dim);
  border-left-color: var(--c-cyan);
}
.file-item.active .file-name { color: var(--c-cyan); }

.file-swatch {
  width: 7px;
  height: 7px;
  background: var(--panel-3);
  flex-shrink: 0;
}
.file-item.active .file-swatch { background: var(--c-cyan); }

.file-info { flex: 1; min-width: 0; }
.file-name {
  display: block;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta {
  display: block;
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 2px;
}

.file-remove {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
}
.file-remove:hover {
  background: rgba(255,51,85,0.15);
  border-color: rgba(255,51,85,0.35);
  color: var(--danger);
}

.empty-files {
  padding: 20px 14px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.7;
}

/* ============================================================
   WORKSPACE
   ============================================================ */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ============================================================
   TOOLBAR — panel-section groups
   ============================================================ */
.toolbar {
  display: flex;
  align-items: stretch;
  background: var(--panel);
  border-bottom: 1px solid var(--border-2);
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  height: 62px;
}
.toolbar::-webkit-scrollbar { height: 3px; }
.toolbar::-webkit-scrollbar-thumb { background: var(--panel-3); }

.panel-section {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-section--flex {
  flex: 1;
  min-width: 0;
}
.sidebar-footer {
  border-top: 1px dashed var(--border);
  padding: 12px 14px;
  flex-shrink: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  border-bottom: 1px dashed var(--border);
  flex-shrink: 0;
  white-space: nowrap;
}
.section-header.c-cyan    { color: var(--c-cyan); }
.section-header.c-magenta { color: var(--c-magenta); }
.section-header.c-blue    { color: var(--c-blue); }
.section-header.c-orange  { color: var(--c-orange); }
.section-header.c-yellow  { color: var(--c-yellow); }
.section-header.c-faint   { color: var(--text-faint); }

.section-body {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  flex: 1;
  overflow: hidden;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--panel-2);
  color: var(--text-dim);
  border: 1px solid var(--border-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  background: var(--panel-3);
  color: var(--text);
  border-color: #555;
}
.btn:active:not(:disabled) { background: #1e1e1e; }
.btn:disabled { opacity: .35; cursor: not-allowed; }

.btn-icon { font-size: 13px; line-height: 1; font-weight: 400; }

.btn-export {
  width: 100%;
  justify-content: center;
  background: transparent;
  color: var(--c-cyan);
  border-color: var(--c-cyan);
  padding: 9px 16px;
  font-size: 12px;
}
.btn-export:hover:not(:disabled) {
  background: var(--accent-dim);
  color: var(--c-cyan);
  border-color: var(--c-cyan);
}
.btn-export.loading { cursor: wait; }
.btn-export.loading .btn-icon { animation: spin .9s steps(8) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn.toggled {
  color: var(--c-cyan);
  border-color: var(--c-cyan);
  background: var(--accent-dim);
}

/* ============================================================
   INPUTS
   ============================================================ */
.zoom-readout {
  min-width: 46px;
  text-align: center;
  font-family: var(--font);
  font-size: 12px;
  color: var(--c-blue);
  padding: 0 4px;
}

.split-input {
  width: 44px;
  padding: 5px 4px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  text-align: center;
}
.split-input:focus { outline: none; border-color: var(--c-cyan); }
.split-input:disabled { opacity: .35; cursor: not-allowed; }
.split-input::-webkit-outer-spin-button,
.split-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.dim-sep { font-size: 12px; color: var(--text-faint); }

.hint {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.4;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hint kbd {
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  padding: 1px 5px;
  font-family: var(--font);
  font-size: 10px;
  color: var(--text-dim);
}

/* ============================================================
   CANVAS STAGE
   ============================================================ */
.stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

#canvas { position: absolute; inset: 0; display: block; }
#canvas.cursor-grab     { cursor: grab; }
#canvas.cursor-grabbing { cursor: grabbing; }
#canvas.cursor-ew       { cursor: ew-resize; }
#canvas.cursor-ns       { cursor: ns-resize; }

.guide-tooltip {
  position: absolute;
  pointer-events: none;
  background: #1a1a1a;
  border: 1px solid var(--c-cyan);
  color: var(--c-cyan);
  font-family: var(--font);
  font-size: 11px;
  padding: 5px 9px;
  white-space: nowrap;
  z-index: 20;
  transform: translate(0, -50%);
}
.guide-tooltip.hidden { display: none; }

.status-bar {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  background: #1a1a1a;
  border: 1px solid var(--border-2);
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-dim);
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}
.status-bar.hidden { display: none; }
.status-sep { color: var(--text-faint); }
#statusPosition { color: var(--c-cyan); min-width: 90px; display: inline-block; }

.stage.drag-over::after {
  content: 'DROP IMAGES TO UPLOAD';
  position: absolute;
  inset: 16px;
  border: 1px dashed var(--c-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--c-cyan);
  background: rgba(0,255,255,0.04);
  pointer-events: none;
  z-index: 30;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-faint);
  pointer-events: none;
  text-align: center;
}
.empty-state.hidden { display: none; }
.empty-state .big {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--text-dim);
}
.empty-state .small { font-size: 12px; max-width: 320px; line-height: 1.7; }
