/* css/editor.css — laptop editor. Dark slate + one amber accent. No framework. */

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: #0b0f14;
  color: #e6edf3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  height: 100%;
  min-height: 0;
}

/* ------------------------------------------------------------- sidebar */

.sidebar {
  width: 268px;
  flex: 0 0 268px;
  display: flex;
  flex-direction: column;
  background: #0e141b;
  border-right: 1px solid #1c2632;
  min-height: 0;
}

.sidebar-head {
  padding: 18px 16px 12px;
  border-bottom: 1px solid #1c2632;
}

.logo {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9fb0c0;
  display: flex;
  align-items: center;
}

.logo-mark {
  width: 0;
  height: 0;
  margin-right: 9px;
  border-left: 10px solid #f0b429;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.script-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.script-item {
  display: flex;
  align-items: center;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: #c4d0dc;
  margin-bottom: 2px;
}

.script-item:hover { background: #151d27; }

.script-item.is-open {
  background: #17222e;
  color: #ffffff;
  box-shadow: inset 2px 0 0 #f0b429;
}

.script-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.script-date {
  font-size: 11px;
  color: #6d8296;
  margin-top: 2px;
  display: block;
}

.on-air {
  flex: 0 0 auto;
  margin-left: 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  padding: 2px 6px;
  border-radius: 4px;
  background: #7f1d1d;
  color: #fecaca;
}

.btn-delete {
  flex: 0 0 auto;
  margin-left: 6px;
  width: 24px;
  height: 24px;
  line-height: 1;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5d7387;
  cursor: pointer;
  font-size: 15px;
}

.btn-delete:hover { background: #2a1417; color: #f87171; }

.mode-badge {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid #1c2632;
  background: #1a1508;
  color: #f5d98a;
  font-size: 12px;
  line-height: 1.45;
}

.mode-badge code {
  background: #2a2210;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}

.mode-badge a { color: #f0b429; }

/* ---------------------------------------------------------------- main */

.main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid #1c2632;
  gap: 20px;
}

.title-input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #ffffff;
  font-size: 20px;
  font-weight: 600;
  padding: 7px 10px;
  font-family: inherit;
}

.title-input:hover:enabled { border-color: #1c2632; }
.title-input:focus { outline: none; border-color: #f0b429; background: #0e141b; }
.title-input:disabled { color: #4a5c6e; }

.status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 12px;
  color: #8496a8;
  white-space: nowrap;
}

.status-item { display: flex; align-items: center; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 7px;
  background: #6b7280;
}

.dot-connected  { background: #34d399; }
.dot-connecting { background: #f0b429; }
.dot-offline    { background: #f87171; }
.dot-local      { background: #60a5fa; }

.presence-offline   { color: #7b8794; }
.presence-idle      { color: #60a5fa; }
.presence-ready     { color: #34d399; }
.presence-prompting { color: #f0b429; }

/* --------------------------------------------------------- editor pane */

.editor-pane {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 18px 24px 22px;
  min-height: 0;
}

.content-input {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  resize: none;
  background: #0e141b;
  border: 1px solid #1c2632;
  border-radius: 12px;
  color: #e6edf3;
  padding: 20px 22px;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.6;
}

.content-input:focus {
  outline: none;
  border-color: #2c3d4f;
  background: #101820;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px 0;
  font-size: 12px;
  color: #7b8fa1;
}

.meta-sep { color: #3c4a58; }

.live-hint {
  margin-left: 14px;
  color: #f0b429;
  font-size: 12px;
}

.save-status {
  margin-left: auto;
  color: #6f8497;
  min-height: 1em;
}

.action-bar {
  padding-top: 16px;
}

/* -------------------------------------------------------------- buttons */

.btn {
  font-family: inherit;
  font-size: 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 10px 16px;
}

.btn-block { display: block; width: 100%; }

.btn-ghost {
  background: #16202b;
  border-color: #24313f;
  color: #cfdae5;
}

.btn-ghost:hover { background: #1c2836; color: #ffffff; }

.btn-send {
  background: #f0b429;
  color: #17202a;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 26px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.btn-send:hover { background: #ffc63d; }
.btn-send:disabled { background: #35404b; color: #7f8b97; cursor: default; }
.btn-send.is-sent { background: #34d399; }

.shortcut { display: inline-flex; gap: 3px; opacity: 0.65; }

kbd {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  padding: 1px 5px;
  background: rgba(0, 0, 0, 0.10);
}

/* ---------------------------------------------------------- empty state */

.empty-state {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #6d8296;
}

.empty-title {
  font-size: 17px;
  margin: 0 0 18px;
}

[hidden] { display: none !important; }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #1d2732;
  border: 1px solid #2f3d4c;
  color: #e6edf3;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 50;
  max-width: 80%;
}

.toast.is-error { border-color: #7f1d1d; color: #fca5a5; }

/* ----------------------------------------------------------- narrow screens

   The editor is the laptop side, but it should not fall apart in a narrow
   window — or on a phone, which is where an Orralis link tends to get opened
   first. The header row was the break: .status never shrinks, so it pushed
   ~140px off the right edge, and more once the sign-out control joined it.
   These rules live at the end of the file on purpose — same specificity as
   the base rules above, so source order is what decides. */

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 12px 16px;
  }

  .title-input {
    flex: 1 1 100%;
    font-size: 18px;
  }

  .status {
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 8px 14px;
  }

  .editor-pane { padding: 14px 16px 18px; }
}

/* Phone width: the fixed 268px sidebar left the script barely a column wide. */
@media (max-width: 640px) {
  .sidebar {
    width: 148px;
    flex: 0 0 148px;
  }

  .sidebar-head { padding: 14px 10px 10px; }
  .script-list { padding: 6px; }
  .mode-badge { padding: 10px 12px; }

  /* No Ctrl key on a phone, and the hint was the last thing pushing the Send
     button past the right edge. */
  .shortcut { display: none; }

  .action-bar .btn-send {
    width: 100%;
    justify-content: center;
  }
}
