/* ────────────────────────────────────────────────────────────────────────────
   styles.css — only the things Tailwind has no class for: the switch, the
   chips, the save-button animation, scrollbars. Everything else is utilities.
   ──────────────────────────────────────────────────────────────────────────── */

:root {
  /* The one button on the board that commits something. Ink, not a colour —
     it reads as the primary action without competing with the green switches,
     and the confirmation flash is what carries the colour. */
  --btn:        #17171C;
  --btn-hover:  #000000;
  --btn-sheen:  #3E3E4A;
  --green:      #22C55E;
  --green-dark: #15803D;
  --green-soft: #86EFAC;
  --red:        #F00038;
  --line:       #DADCE0;   /* frames, cards, menus */
  --line-input: #CDD1D6;   /* inputs — a touch stronger */
  --line-soft:  #E3E5E9;   /* thin separators */
  --sidebar:    #F8FAFD;   /* the console tint */
}

/* ── shell ───────────────────────────────────────────────────────────────── */

#sidebar { background: var(--sidebar); }

/* ── the apps (burger) menu ──────────────────────────────────────────────── */

.apps-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; margin-left: -6px;
  border-radius: 8px;
  transition: background .13s ease, color .13s ease;
}
.apps-btn:hover { background: rgba(0,0,0,.055); color: #111; }

.apps-menu {
  position: absolute; left: -4px; top: 34px;
  min-width: 150px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.10);
  padding: 4px; z-index: 50;
}
.apps-menu.hidden { display: none; }
.apps-item {
  display: block; padding: 8px 12px; border-radius: 8px;
  font-size: 14px; color: #3c4043; text-decoration: none;
  transition: background .12s ease, color .12s ease;
}
.apps-item:hover { background: #F1F3F4; color: #111; }

/* ── nav ─────────────────────────────────────────────────────────────────── */

.nav-item { transition: opacity .15s ease, color .15s ease; }
.nav-item:hover { opacity: .6; }
.nav-item.active { font-weight: 600; }
.nav-item:disabled { cursor: default; }

/* ── switch ───────────────────────────────────────────────────────────────
   Shaped like the one everybody already knows: the TRACK carries the colour,
   the knob is always white. Off reads as off at a glance; on is unmistakable.
   ────────────────────────────────────────────────────────────────────────── */

.sw {
  position: relative;
  width: 28px; height: 16px;
  border-radius: 999px;
  background: #E5E5EA;                 /* the off track */
  border: none;
  flex: 0 0 auto;
  cursor: pointer;
  transition: background .25s cubic-bezier(.4,0,.2,1);
  -webkit-tap-highlight-color: transparent;
}
.sw-knob {
  position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.22), 0 0 1px rgba(0,0,0,.12);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.sw:hover:not(:disabled) { filter: brightness(.97); }

.sw-on { background: var(--green); }
.sw-on .sw-knob { transform: translateX(12px); }

.sw-off-limits { opacity: .4; cursor: not-allowed; }
.sw-off-limits:hover { filter: none; }

/* ── tag chips ───────────────────────────────────────────────────────────── */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; color: #111; background: #fff;
  transition: border-color .15s ease, background .15s ease;
}
.chip-x {
  display: inline-flex; color: #9A9A9A;
  transition: opacity .15s ease, color .15s ease;
}
.chip-x:hover { color: var(--red); }
.chip-add { background: #F4F4F4; color: #444; cursor: pointer; }
.chip-add:hover { background: #E8EAED; }
.chip-input { outline: none; width: 130px; }
.chip-input:focus { border-color: #9A9A9A; }

/* ── save button ─────────────────────────────────────────────────────────── */

.save-btn {
  padding: 10px 24px;
  border-radius: 2px;
  font-size: 14px; font-weight: 500; letter-spacing: -0.01em; color: #fff;
  background: var(--btn);
  transition: background .18s ease, opacity .15s ease;
}
.save-btn:hover:not(:disabled) { background: var(--btn-hover); }

/* the check mark that confirms a save */
.save-btn-inner { display: inline-flex; align-items: center; gap: 7px; }
.save-check { animation: check-in .22s cubic-bezier(.4,0,.2,1); }
@keyframes check-in {
  from { opacity: 0; transform: scale(.6); }
  to   { opacity: 1; transform: scale(1); }
}
.save-btn:disabled { opacity: .45; cursor: not-allowed; }

/* left-to-right sweep while the request is in flight */
.save-btn-loading {
  background-image: linear-gradient(90deg,
    var(--btn) 0%, var(--btn-sheen) 45%, var(--btn) 90%);
  background-size: 250% 100%;
  animation: sweep 1.1s linear infinite;
  cursor: progress;
}
@keyframes sweep { from { background-position: 150% 0; } to { background-position: -100% 0; } }

.save-btn-ok  { background: var(--green-dark); animation: none; }
.save-btn-bad { background: var(--red);   animation: none; }

/* ── avatar picker ───────────────────────────────────────────────────────── */

.picker-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  width: 260px; max-height: 60vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--line);
  border-radius: 2px; box-shadow: 0 10px 30px rgba(0,0,0,.08);
  padding: 4px; z-index: 40;
}
.picker-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 2px;
  font-size: 14px; text-align: left; color: #111;
  transition: background .12s ease;
}
.picker-item:hover { background: #F6F6F6; }
.picker-item-active { background: #F2F2F2; font-weight: 500; }
.picker-sep { height: 1px; background: #E3E5E9; margin: 4px 8px; }

/* ── dropdown (the same menu as the avatar picker, reusable) ─────────────── */

.dd { position: relative; display: inline-block; min-width: 260px; max-width: 340px; width: 100%; }
.dd-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px;
  font-size: 14px; color: #111; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
  transition: border-color .15s ease;
}
.dd-btn:hover { border-color: #9AA0A6; }
.dd-open .dd-btn { border-color: #9AA0A6; }
.dd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-placeholder { color: #9AA0A6; }
.dd-caret { flex: 0 0 auto; color: #5F6368; transition: transform .2s ease; }
.dd-open .dd-caret { transform: rotate(180deg); }

.dd-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  max-height: 52vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--line);
  border-radius: 4px; box-shadow: 0 10px 30px rgba(0,0,0,.08);
  padding: 4px; z-index: 40;
}
.dd-menu.hidden { display: none; }
.dd-item {
  width: 100%;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 9px 12px; border-radius: 4px;
  font-size: 14px; color: #111; text-align: left;
  transition: background .12s ease;
}
.dd-item:hover { background: #F6F6F7; }
.dd-item-on { background: #F2F2F3; font-weight: 500; }
.dd-item-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-muted { color: #9AA0A6; }
.dd-item-hint {
  flex: 0 0 auto;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10.5px; letter-spacing: .03em; color: #9AA0A6;
}

/* A dropdown and the one action that goes with it, on the same line. */
.dd-row { display: flex; align-items: center; gap: 8px; max-width: 380px; }
.dd-row .dd { width: auto; flex: 1 1 auto; min-width: 0; }

/* "Make a new one" — a plus, nothing else. The dropdown beside it already
   says what kind of thing it makes. */
.dd-plus {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  color: #9AA0A6; text-decoration: none;
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
  transition: color .13s ease, border-color .13s ease;
}
.dd-plus:hover { color: #111; border-color: #9AA0A6; }

/* The chosen channel's actor, as the photo it is. Width is fixed, height
   follows the image, so nothing is cropped. */
.actor-photo {
  display: block;
  width: 120px; height: auto;
  border-radius: 4px;
  background: #F5F6F7;
}

/* ── collapsible section ─────────────────────────────────────────────────── */

.fold { border-top: 1px solid var(--line-soft); }
.fold:last-of-type { border-bottom: 1px solid var(--line-soft); }
.fold-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 2px;
  cursor: pointer; list-style: none;
  transition: opacity .13s ease;
}
.fold-head::-webkit-details-marker { display: none; }
.fold-head:hover { opacity: .65; }
.fold-caret {
  display: inline-flex; color: #9AA0A6;
  transition: transform .18s cubic-bezier(.4,0,.2,1);
}
.fold[open] .fold-caret { transform: rotate(90deg); }
.fold-title { flex: 1; font-size: 14px; color: #111; }
.fold-meta {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10.5px; letter-spacing: .04em; color: #9AA0A6;
}
.fold-body { padding: 2px 0 20px; }

/* ── states ──────────────────────────────────────────────────────────────── */

.mini-spinner {
  width: 14px; height: 14px;
  border: 2px solid #E0E0E0; border-top-color: #9B9B9B;
  border-radius: 50%; display: inline-block;
  animation: mini-spin .7s linear infinite;
}
@keyframes mini-spin { to { transform: rotate(360deg); } }

/* ── scrollbars ──────────────────────────────────────────────────────────── */

#main-panel::-webkit-scrollbar { display: none; }
#main-panel { scrollbar-width: none; -ms-overflow-style: none; }
textarea::-webkit-scrollbar { width: 6px; }
textarea::-webkit-scrollbar-thumb { background: #DADADA; border-radius: 3px; }

/* ── small screens ───────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  body { padding: 0 !important; }
  #app { border-radius: 0 !important; border: none !important; }
  #sidebar { width: 170px !important; min-width: 170px !important;
             padding-left: 16px !important; padding-right: 16px !important; }
  #main-panel, #topbar { padding-left: 16px !important; padding-right: 16px !important; }
}

/* Safety: the picker relies on .hidden, keep it working even if a utility
   class is ever renamed or Tailwind is swapped out. */
.picker-menu.hidden { display: none; }
