/* OT Terminal — Watchlist Panel (compact redesign)
 * One-line-per-symbol rows: symbol + small name on the left, price +
 * change % right-aligned and never clipped. Row tools (reorder,
 * favourite, remove) appear in place of the company name on hover /
 * keyboard focus (and on the selected row on touch devices), so they
 * stay available without taking permanent space. */

.ot-watchlist {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--ot-bg-panel);
  border-right: 1px solid var(--ot-border-subtle);
  overflow: hidden;
  min-width: 0;
}

.ot-watchlist__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 6px 0 10px;
  flex: 0 0 auto;
}

.ot-watchlist__title {
  font-size: var(--ot-fs-xs);
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--ot-text-secondary);
}

.ot-terminal .ot-watchlist__head .ot-icon-btn {
  width: 24px;
  height: 24px;
}
.ot-watchlist__head .ot-icon-btn svg {
  width: 14px;
  height: 14px;
}

.ot-watchlist__tabs {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 4px;
  border-bottom: 1px solid var(--ot-border-subtle);
  flex: 0 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.ot-watchlist__tabs::-webkit-scrollbar {
  display: none;
}

.ot-watchlist__tab {
  padding: 6px 7px 5px;
  font-size: var(--ot-fs-xs);
  font-weight: 600;
  color: var(--ot-text-tertiary);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--ot-transition-fast);
}

.ot-watchlist__tab:hover {
  color: var(--ot-text-primary);
}

.ot-watchlist__tab.is-active {
  color: var(--ot-gold-bright);
  border-bottom-color: var(--ot-gold);
}

/* List management row (Rename / reorder list / Delete) */
.ot-terminal .ot-watchlist__list-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  border-bottom: 1px solid var(--ot-border-subtle);
}
.ot-terminal .ot-watchlist__list-actions .ot-link-btn {
  font-size: 10.5px;
  padding: 2px 6px;
}
.ot-terminal .ot-watchlist__list-actions [data-ot-delete-list] {
  margin-left: auto;
}

/* Column header */
.ot-watchlist__colhead {
  display: flex;
  justify-content: space-between;
  padding: 4px 10px 3px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ot-text-tertiary);
  border-bottom: 1px solid var(--ot-border-subtle);
  flex: 0 0 auto;
}

.ot-watchlist__list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 2px 0;
}

.ot-watchlist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  height: 36px;
  padding: 0 10px;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background var(--ot-transition-fast);
}

.ot-watchlist-row:hover {
  background: var(--ot-bg-panel-raised);
}

.ot-watchlist-row.is-selected {
  background: var(--ot-gold-wash);
  border-left-color: var(--ot-gold);
}

.ot-watchlist-row__id {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
}

.ot-watchlist-row__line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.ot-watchlist-row__symbol {
  font-size: var(--ot-fs-sm);
  font-weight: 700;
  color: var(--ot-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ot-watchlist-row__star {
  flex: 0 0 auto;
  font-size: 9px;
  color: var(--ot-gold);
}

.ot-watchlist-row__name {
  font-size: 10px;
  color: var(--ot-text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ot-watchlist-row__quote {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}

.ot-watchlist-row__price {
  font-size: var(--ot-fs-sm);
  font-weight: 600;
  color: var(--ot-text-primary);
}

.ot-watchlist-row__change {
  font-size: 10.5px;
  font-weight: 600;
}

.ot-watchlist-row__change.ot-neutral {
  color: var(--ot-text-tertiary);
  font-weight: 500;
}

/* Row tools: hidden until hover/focus; replace the company-name line */
.ot-watchlist-row__actions {
  display: none;
  align-items: center;
  gap: 1px;
  height: 14px;
}

.ot-watchlist-row:hover .ot-watchlist-row__actions,
.ot-watchlist-row:focus-within .ot-watchlist-row__actions {
  display: flex;
}
.ot-watchlist-row:hover .ot-watchlist-row__name,
.ot-watchlist-row:focus-within .ot-watchlist-row__name {
  display: none;
}

@media (hover: none) {
  .ot-watchlist-row.is-selected .ot-watchlist-row__actions {
    display: flex;
  }
  .ot-watchlist-row.is-selected .ot-watchlist-row__name {
    display: none;
  }
  .ot-watchlist-row {
    height: 40px;
  }
  .ot-watchlist-row__actions {
    height: 18px;
  }
  .ot-terminal .ot-watchlist-row__actions button {
    width: 22px !important;
    height: 18px !important;
  }
}

.ot-terminal .ot-watchlist-row__actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 14px;
  padding: 0;
  font-size: 10px;
  line-height: 1;
  border-radius: 3px;
  color: var(--ot-text-tertiary);
  opacity: 1;
}
.ot-terminal .ot-watchlist-row__actions button:hover {
  color: var(--ot-text-primary);
  background: var(--ot-bg-input);
}
.ot-terminal .ot-watchlist-row__actions button:disabled {
  opacity: 0.3;
  cursor: default;
  background: none;
}
.ot-watchlist-row__actions svg {
  width: 10px;
  height: 10px;
}
.ot-terminal .ot-watchlist-row__actions .ot-watchlist-row__fav.is-favourited {
  color: var(--ot-gold);
}
.ot-terminal .ot-watchlist-row__actions [data-ot-remove-symbol]:hover {
  color: var(--ot-down);
}

.ot-watchlist__add {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  margin: 0;
  border-top: 1px solid var(--ot-border-subtle);
  color: var(--ot-text-secondary);
  font-size: var(--ot-fs-xs);
  font-weight: 600;
  transition: color var(--ot-transition-fast), background var(--ot-transition-fast);
}

.ot-watchlist__add:hover {
  color: var(--ot-gold-bright);
  background: var(--ot-bg-panel-raised);
}

.ot-watchlist__add svg {
  width: 12px;
  height: 12px;
}

.ot-terminal .ot-watchlist__inline-form {
  padding: 4px 8px;
  gap: 4px;
}
.ot-terminal .ot-watchlist__inline-form input,
.ot-terminal .ot-watchlist__inline-form select {
  flex: 1;
  min-width: 0;
  height: 26px;
  padding: 0 6px;
  font-size: var(--ot-fs-xs);
  border-radius: var(--ot-radius-sm);
  border: 1px solid var(--ot-border);
  background: var(--ot-bg-input);
  color: var(--ot-text-primary);
}
.ot-terminal .ot-watchlist__inline-form .ot-icon-btn {
  width: 24px;
  height: 24px;
}

/* ===== Collapse / expand ===== */
.ot-terminal .ot-shell-body {
  position: relative;
}

.ot-shell-body.ot-watchlist-collapsed .ot-watchlist {
  display: none;
}

.ot-watchlist-toggle {
  position: absolute;
  top: 50%;
  left: var(--ot-wl-track, var(--ot-watchlist-w));
  transform: translateY(-50%);
  z-index: 40;
  width: 14px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--ot-bg-panel);
  border: 1px solid var(--ot-border);
  border-left: none;
  border-radius: 0 var(--ot-radius-sm) var(--ot-radius-sm) 0;
  color: var(--ot-text-secondary);
  transition: left var(--ot-transition-base), color var(--ot-transition-fast);
}
.ot-terminal .ot-watchlist-toggle {
  cursor: pointer;
  border: 1px solid var(--ot-border);
  border-left: none;
  background: var(--ot-bg-panel);
}
.ot-watchlist-toggle:hover {
  color: var(--ot-gold-bright);
}
.ot-watchlist-toggle svg {
  width: 12px;
  height: 12px;
  transition: transform var(--ot-transition-base);
}
.ot-shell-body.ot-watchlist-collapsed .ot-watchlist-toggle svg {
  transform: rotate(180deg);
}

/* Mobile drawer: the drawer is position:fixed between header and footer
   (responsive.css); height:100% made it taller than that span and pushed
   "Add Symbol" below the screen. height:auto lets top/bottom define it,
   and the symbol list (flex 1, overflow-y auto) scrolls inside it. Also
   dim the chart behind the open drawer (the scrim is a sibling of
   .ot-shell, not a descendant). */
@media (max-width: 760px) {
  .ot-terminal .ot-watchlist {
    height: auto;
    max-height: calc(100dvh - var(--ot-header-h) - var(--ot-strip-h));
  }
  .ot-terminal .ot-watchlist__list {
    min-height: 0;
  }
  .ot-shell.ot-mobile-watchlist-open ~ .ot-mobile-scrim {
    display: block;
  }
}
