/* Skemi Native Web IDE (Phase 5) — Desktop 3-pane + Mobile tabbed responsive */
.ide-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  min-height: 540px;
  background: var(--bg-primary, #0b0f1a);
  color: var(--text-primary, #f1f5f9);
  overflow: hidden;
}

body.light-mode .ide-shell,
body:not(.dark-mode):not(.galaxy-mode) .ide-shell {
  background: #f8fafc;
  color: #0f172a;
}

.ide-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.55);
  flex-wrap: wrap;
}

body.light-mode .ide-toolbar,
body:not(.dark-mode):not(.galaxy-mode) .ide-toolbar {
  background: #ffffff;
}

.ide-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ide-select,
.ide-input {
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.1);
  color: inherit;
  padding: 7px 10px;
  font-size: 0.84rem;
  font-family: inherit;
}

.ide-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.12);
  color: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ide-btn:hover {
  background: rgba(148, 163, 184, 0.22);
}

.ide-btn.run {
  border-color: transparent;
  background: var(--sk-btn-primary-bg, #111318);
  color: var(--sk-btn-primary-ink, #ffffff);
}

.ide-btn.verify {
  border-color: var(--sk-line-strong, rgba(148, 163, 184, 0.35));
  background: var(--sk-surface, var(--bg-secondary));
  color: var(--sk-ink, var(--text-primary));
}

.ide-btn.mira {
  border-color: transparent;
  background: var(--sk-accent, #2563eb);
  color: #ffffff;
}

.ide-btn.danger {
  border-color: rgba(239, 68, 68, 0.45);
  color: #ef4444;
}

.ide-mobile-tabs {
  display: none;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.ide-mobile-tab {
  flex: 1;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: transparent;
  color: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.ide-mobile-tab.active {
  background: var(--sk-btn-primary-bg, #111318);
  border-color: var(--sk-btn-primary-bg, #111318);
  color: var(--sk-btn-primary-ink, #ffffff);
}

.ide-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 330px;
  overflow: hidden;
}

.ide-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.ide-pane:last-child {
  border-right: 0;
}

.ide-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  opacity: 0.85;
}

.ide-file-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ide-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.84rem;
  border: 1px solid transparent;
}

.ide-file-item:hover {
  background: var(--sk-surface-2, rgba(148, 163, 184, 0.12));
}

.ide-file-item.active {
  background: var(--sk-accent-soft, rgba(37, 99, 235, 0.1));
  border-color: var(--sk-accent-ring, rgba(37, 99, 235, 0.28));
  color: var(--sk-accent, #2563eb);
  font-weight: 600;
}

.ide-file-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 1px 5px;
  margin-right: 6px;
  border-radius: 5px;
  font-family: var(--font-mono, monospace);
  font-size: 0.66rem;
  font-weight: 700;
  background: var(--sk-surface-2, rgba(148, 163, 184, 0.16));
  color: var(--sk-ink-2, inherit);
}

.ide-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ide-file-del {
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 5px;
}

.ide-file-del:hover {
  opacity: 1;
  color: #f87171;
}

/* Center: Editor + Output Split */
.ide-editor-wrap {
  flex: 1.25;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.ide-editor-textarea {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  outline: none;
  resize: none;
  padding: 14px;
  background: transparent;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.55;
  tab-size: 4;
}

.ide-output-wrap {
  flex: 0.85;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ide-output-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.ide-out-tab {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.72;
}

.ide-out-tab.active {
  background: rgba(99, 102, 241, 0.22);
  opacity: 1;
}

.ide-console {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.ide-preview-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #ffffff;
}

.ide-test-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 0.82rem;
}

.ide-test-row.pass {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.1);
}

.ide-test-row.fail {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.1);
}

/* Mira Assistant Pane */
.ide-mira-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ide-mira-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.ide-mira-reply {
  padding: 11px;
  border-radius: 10px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  background: rgba(99, 102, 241, 0.1);
  font-size: 0.83rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.ide-banner {
  padding: 10px 14px;
  background: rgba(245, 158, 11, 0.14);
  border-bottom: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ide-banner[hidden] {
  display: none !important;
}

@media (max-width: 960px) {
  .ide-mobile-tabs {
    display: flex;
  }
  .ide-grid {
    grid-template-columns: 1fr;
  }
  .ide-pane {
    display: none;
    border-right: 0;
  }
  .ide-pane.mobile-active {
    display: flex;
  }
}
