/* ═══════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════
   TOOLBAR BRAND
═══════════════════════════════════════════════════ */
#_sd_toolbar-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  color: var(--accent);
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  padding: 2px;
  margin-right: auto;
  transition: opacity .12s;
}
#_sd_toolbar-brand:hover { opacity: .7; }
.toolbar-brand-text { display: none; }
.toolbar-brand-full { display: inline; font-size: 13px; font-weight: 600; }
.toolbar-brand-short { display: none; }
.toolbar-brand-tiny { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-ui);
  line-height: 1;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn:active { background: var(--bg-active); }
.btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-inv);
  box-shadow: 0 1px 3px rgba(37,99,235,.25);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-2);
}
.btn.ghost:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text);
}


/* ═══════════════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════════════ */
#_sd_main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════
   LEFT PANEL
═══════════════════════════════════════════════════ */
#_sd_left {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-input);
}

#_sd_left-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#_sd_left-toolbar::-webkit-scrollbar {
  display: none;
}

.toggle-group {
  display: flex;
  background: none;
  border: none;
  border-radius: var(--radius);
  overflow: hidden;
  padding: 2px;
  gap: 2px;
}
.toggle-group .btn {
  border: none;
  border-radius: calc(var(--radius) - 2px);
  box-shadow: none;
  background: transparent;
  padding: 6px 8px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toggle-group .btn.active {
  background: var(--bg-input);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.toggle-group .btn:hover:not(.active) {
  background: var(--bg-hover);
  border-color: transparent;
  color: var(--text);
}

#_sd_drop-hint {
  font-size: 11.5px;
  color: var(--text-2);
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 0;
  transition: color .12s, background .12s;
  flex-shrink: 0;
}
@media (hover: hover) {
  .toolbar-icon-btn:hover {
    color: var(--text-2);
    background: var(--bg-hover);
  }
}

#_sd_content-area {
  flex: 1;
  overflow: auto;
  position: relative;
  background-color: #FFFFFF;
  outline: none;
}
html[data-theme="dark"] #_sd_content-area {
  background-color: #2c2a26;
}

/* drag overlay */
#_sd_content-area.drag-over::after {
  content: 'Drop file to load';
  position: absolute;
  inset: 0;
  background: rgba(37,99,235,.06);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  pointer-events: none;
  z-index: 10;
  margin: 8px;
}

/* ═══════════════════════════════════════════════════
   RAW TEXTAREA
═══════════════════════════════════════════════════ */
#_sd_raw {
  display: none;
  width: 100%;
  height: 100%;
  padding: 40px 48px;
  background: var(--bg-input);
  color: var(--text);
  border: none;
  resize: none;
  font-family: 'JetBrains Mono', 'Fira Mono', monospace;
  font-size: 13px;
  line-height: 1.7;
  outline: none;
}

/* ═══════════════════════════════════════════════════
   DIVIDER (resize handle aesthetic)
═══════════════════════════════════════════════════ */
#_sd_divider {
  width: 0;
  background: var(--border);
  flex-shrink: 0;
  transition: width .32s cubic-bezier(.4,0,.2,1);
}
body.style-mode #_sd_divider,
body.export-mode #_sd_divider { width: 1px; }
