/* style.css – layout for 2 vertical panels, dark (default) / light themes */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Ubuntu', 'Segoe UI', system-ui, sans-serif;
  background: var(--body-bg);
  color: var(--text);
}

/* ── CSS custom properties: dark (default) ────────────────────── */
:root {
  --body-bg:        #1a1a2e;
  --text:           #e0e0e0;
  --panel-bg:       #16162a;
  --panel-header-bg:#1f1f3a;
  --panel-border:   #3a3a5c;
  --canvas-bg:      #16162a;
  --detail-bg:      #1e1e36;
  --frozen-bg:      #1a1a32;
  --row-hdr-bg:     #15152a;
  --hdr-bg:         #252550;
  --hdr-text:       #bbb;
  --corner-text:    #888;
  --axis-bg:        #1a1a3a;
  --axis-text:      #777;
  --frozen-div:     rgba(255,255,255,0.12);
  --select-fill:    #252550;
  --select-text:    #ccc;
  --select-border:  #3a3a5c;
}

/* ── Light theme ──────────────────────────────────────────────── */
body.light {
  --body-bg:        #f0f0f5;
  --text:           #222;
  --panel-bg:       #ffffff;
  --panel-header-bg:#e8e8f0;
  --panel-border:   #ccc;
  --canvas-bg:      #f8f8ff;
  --detail-bg:      #f5f5fa;
  --frozen-bg:      #ececf5;
  --row-hdr-bg:     #e2e2f0;
  --hdr-bg:         #dcdcf0;
  --hdr-text:       #333;
  --corner-text:    #666;
  --axis-bg:        #e8e8f5;
  --axis-text:      #555;
  --frozen-div:     rgba(0,0,0,0.10);
  --select-fill:    #d8d8f0;
  --select-text:    #333;
  --select-border:  #aaa;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* ===== TOP PANEL: Heatmap Viewfinder ===== */
#viewfinder-panel {
  flex: 0 0 45%;
  display: flex;
  flex-direction: column;
  border-bottom: 3px solid var(--panel-border);
  background: var(--panel-bg);
  position: relative;
  min-height: 120px;
}

#viewfinder-grid {
  flex: 1;
  overflow: hidden;
  position: relative;
}
#viewfinder-grid canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ===== BOTTOM PANEL: Detail View ===== */
#detail-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--body-bg);
  min-height: 120px;
}

#detail-panel .panel-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  padding: 3px 8px;
  background: var(--panel-header-bg);
  border-bottom: 1px solid var(--panel-border);
  font-size: 12px;
  color: var(--text);
  flex-shrink: 0;
  gap: 8px;
}

#detail-panel .panel-header .theme-toggle {
  cursor: pointer;
  font-size: 17px;
  user-select: none;
  flex-shrink: 0;
  line-height: 1;
  padding: 0 4px;
}
#detail-panel .panel-header .theme-toggle:hover {
  transform: scale(1.15);
}

#detail-panel .panel-header .mode-toggle {
  cursor: pointer;
  font-size: 17px;
  user-select: none;
  flex-shrink: 0;
  padding: 0 4px;
  line-height: 1;
}
#detail-panel .panel-header .mode-toggle:hover {
  transform: scale(1.15);
}

#detail-panel .panel-header .copy-btn {
  cursor: pointer;
  font-size: 17px;
  user-select: none;
  flex-shrink: 0;
  padding: 0 4px;
  line-height: 1;
}
#detail-panel .panel-header .copy-btn:hover {
  transform: scale(1.15);
}

#detail-panel .panel-header select {
  margin: 0;
  padding: 1px 6px;
  font-size: 11px;
  font-family: 'Ubuntu', sans-serif;
  background: var(--select-fill);
  color: var(--select-text);
  border: 1px solid var(--select-border);
  border-radius: 3px;
  cursor: pointer;
}

#detail-panel .panel-header .header-spacer {
  flex: 1;
  min-width: 4px;
}

#detail-panel .panel-header .file-select {
  min-width: 70px;
}

#detail-panel .panel-header .l1-select {
  min-width: 45px;
}
#detail-panel .panel-header .idx-select {
  min-width: 60px;
}



#detail-grid {
  flex: 1;
  overflow: hidden;
  position: relative;
}
#detail-grid canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ===== Resizer handle ===== */
#resizer {
  flex: 0 0 6px;
  background: var(--panel-border);
  cursor: row-resize;
  transition: background 0.15s;
}
#resizer:hover {
  background: #6a6aff;
}

/* ===== Loading overlay ===== */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 22, 42, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s;
}
#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--panel-border);
  border-top: 3px solid #6a6aff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  color: var(--text);
  font-size: 13px;
}

/* ===== Error banner ===== */
#error-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 20px;
  background: #a03030;
  color: #fff;
  font-size: 13px;
  z-index: 9998;
  text-align: center;
}
