/* Ubuntu Web — Text Editor styles. All selectors scoped under .app-texteditor. */

/* ---------- headerbar ---------- */

.app-texteditor .te-headleft { display: flex; align-items: center; gap: 6px; }
.app-texteditor .te-headright { display: flex; align-items: center; gap: 6px; }

.app-texteditor .te-open-btn {
  gap: 4px;
  padding: 5px 12px;
  font-size: 13px;
}
.app-texteditor .te-open-btn svg { opacity: 0.7; }

.app-texteditor .te-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  overflow: hidden;
}
.app-texteditor .te-tname {
  font-weight: 700;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.app-texteditor .te-save-btn {
  display: none;
  padding: 5px 14px;
  font-size: 13px;
}
.app-texteditor .te-save-btn.show { display: inline-flex; }

/* ---------- error banner ---------- */

.app-texteditor .te-banner {
  display: none;
  flex: none;
  padding: 8px 14px;
  font-size: 12.8px;
  background: rgba(192, 28, 40, 0.12);
  color: #a51d2a;
  border-bottom: 1px solid rgba(192, 28, 40, 0.25);
}
:root[data-scheme="dark"] .app-texteditor .te-banner {
  background: rgba(255, 123, 99, 0.12);
  color: #ff7b63;
  border-bottom-color: rgba(255, 123, 99, 0.3);
}
.app-texteditor .te-banner.show { display: block; }

/* ---------- editor body ---------- */

.app-texteditor .te-body {
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--view-bg);
  position: relative;
}
.app-texteditor .te-gutter {
  flex: none;
  width: 46px;
  padding: 10px 8px 10px 0;
  overflow: hidden;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--fg-faint);
  background: var(--win-bg2);
  border-right: 1px solid var(--border);
  white-space: pre;
  user-select: none;
}
.app-texteditor .te-text {
  flex: 1;
  min-width: 0;
  resize: none;
  border: none;
  outline: none;
  background: var(--view-bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.45;
  padding: 10px 14px;
  white-space: pre-wrap;
  tab-size: 4;
}
.app-texteditor .te-text[wrap="off"] { white-space: pre; }

/* ---------- status overlay ---------- */

.app-texteditor .te-status {
  position: absolute;
  right: 14px;
  bottom: 10px;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  font-size: 11.5px;
  color: var(--fg-dim);
  pointer-events: none;
  z-index: 3;
}

/* ---------- file chooser modal (scrim carries .app-texteditor) ---------- */

.app-texteditor .te-chooser {
  width: 460px;
  display: flex;
  flex-direction: column;
  text-align: left;
}
.app-texteditor .te-chooser-path {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 6px;
}
.app-texteditor .te-chooser-cwd {
  font-size: 12.8px;
  color: var(--fg-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-texteditor .te-chooser-list {
  height: 240px;
  overflow-y: auto;
  margin: 4px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--view-bg);
  display: flex;
  flex-direction: column;
  padding: 4px;
}
.app-texteditor .te-chooser-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--fg);
  text-align: left;
  flex: none;
}
.app-texteditor .te-chooser-row:hover { background: var(--hover); }
.app-texteditor .te-chooser-row.selected {
  background: rgba(var(--accent-rgb), 0.18);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.45);
}
.app-texteditor .te-chooser-icon { display: inline-flex; color: var(--fg-dim); flex: none; }
.app-texteditor .te-chooser-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-texteditor .te-chooser-empty {
  margin: auto;
  font-size: 13px;
  color: var(--fg-faint);
}
.app-texteditor .te-chooser-namerow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 2px;
  font-size: 13px;
}
.app-texteditor .te-chooser-namerow .entry { flex: 1; min-width: 0; padding: 6px 10px; }
.app-texteditor .te-chooser-error {
  display: none;
  padding: 6px 16px 10px;
  font-size: 12.5px;
  color: #c01c28;
}
:root[data-scheme="dark"] .app-texteditor .te-chooser-error { color: #ff7b63; }
.app-texteditor .te-chooser-error.show { display: block; }
.app-texteditor .te-chooser .dialog-buttons { margin-top: 8px; }
