/* sidebar.css - Light Theme Watchlist & TradingView Rightmost Bar */
.watchlist-container {
  display: flex;
  flex-direction: row;
  gap: var(--panel-gap);
  height: 100%;
  width: 100%;
  direction: ltr; /* Keeps main watchlist on the left and vertical icons strip on the extreme right */
}

.watchlist-main-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-panel);
  border-radius: var(--panel-radius);
  overflow: hidden;
  direction: rtl; /* Arabic RTL content inside the watchlist */
}

.watchlist-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  user-select: none;
}

.watchlist-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.watchlist-title-group:hover {
  background: var(--bg-hover);
}

.watchlist-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.watchlist-title-chevron {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
}

.watchlist-title-group.open .watchlist-title-chevron {
  transform: rotate(180deg);
}

.watchlist-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.watchlist-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.watchlist-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Watchlist Switcher Dropdown Menu matching Image Reference */
.watchlist-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 10px;
  width: 250px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  z-index: 99999;
  padding: 4px 0;
  direction: rtl;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
}

.watchlist-dropdown-menu.hidden {
  display: none !important;
}

/* The ... button sits on the left, so this menu opens from there */
.watchlist-options-menu {
  right: auto;
  left: 10px;
  width: 210px;
}

.wl-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}

.wl-option-row:hover {
  background: var(--bg-hover);
}

.wl-option-row input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--text-primary);
  cursor: pointer;
}

.wl-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s ease;
  height: 32px;
  box-sizing: border-box;
}

.wl-menu-item:hover {
  background: var(--bg-hover);
}

.wl-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wl-item-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.wl-item-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.wl-item-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.wl-item-shortcut {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, monospace;
}

.wl-menu-sep {
  height: 1px;
  background: var(--bg-pressed);
  margin: 4px 0;
}

.wl-section-label {
  padding: 6px 14px 2px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
}

.wl-recent-lists {
  display: flex;
  flex-direction: column;
  padding: 2px 0;
  max-height: 220px;
  overflow-y: auto;
}

.wl-recent-lists::-webkit-scrollbar {
  width: 4px;
}
.wl-recent-lists::-webkit-scrollbar-thumb {
  background: var(--bg-pressed);
  border-radius: 2px;
}

.wl-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s ease;
  height: 32px;
  box-sizing: border-box;
}

.wl-recent-item:hover {
  background: var(--bg-hover);
}

.wl-recent-item.active {
  background: var(--bg-inverse);
  color: var(--text-inverse);
  border-radius: 4px;
  margin: 1px 6px;
  padding: 6px 10px;
}

.wl-recent-item.active .wl-recent-name {
  color: var(--text-inverse);
  font-weight: 700;
}

.wl-recent-item.active .wl-recent-star {
  color: var(--text-inverse);
}

.wl-recent-name {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wl-recent-star {
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

.wl-recent-star:hover {
  transform: scale(1.25);
}

.wl-recent-star:not(.pinned) {
  opacity: 0.35;
}

.wl-recent-star.pinned,
.wl-recent-item.active .wl-recent-star.pinned {
  color: var(--gold-accent);
}

/* No pinned lists, no strip */
.watchlist-filter-strip:empty {
  display: none;
}

/* Circular Filter Badges Strip matching Reference Image */
.watchlist-filter-strip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
  direction: rtl;
}

.watchlist-filter-strip::-webkit-scrollbar {
  display: none;
}

.filter-badge-btn {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-panel);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
}

.filter-badge-btn:hover {
  border-color: var(--text-secondary);
  background: var(--bg-hover);
}

.filter-badge-btn.active {
  background: var(--bg-inverse);
  color: var(--text-inverse);
  border-color: var(--text-primary);
}

/* Table Header matching Reference Image */
.watchlist-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
}

.col-symbol {
  flex: 2.2;
  display: flex;
  align-items: center;
  gap: 4px;
  text-align: right;
}

.col-sort-tab {
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4px solid var(--text-secondary);
  display: inline-block;
}

.col-last {
  flex: 1.2;
  text-align: left;
}

.col-chg {
  flex: 1;
  text-align: left;
}

.col-chg-pct {
  flex: 1.2;
  text-align: left;
}

.watchlist-items-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-panel);
}

/* Section Header Divider (e.g., SECTION 1) */
.watchlist-section-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: var(--bg-hover);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
}

.watchlist-section-divider:hover {
  background: var(--bg-hover);
}

.section-chevron {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
}

.watchlist-section-divider.collapsed .section-chevron {
  transform: rotate(-90deg);
}

/* Item Row matching Reference Image */
.watchlist-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.12s ease;
  font-size: 12px;
  position: relative;
  height: 38px;
  box-sizing: border-box;
}

.watchlist-item-row:hover {
  background: var(--bg-hover);
}

.watchlist-item-row.selected {
  background: var(--bg-active);
}

.bookmark-ribbon {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  border-radius: 0 2px 2px 0;
}

.bookmark-ribbon.flag-red {
  background: #f23645;
}

/* Watchlists manager dialog (Shift + W) */
.wl-manager-dialog {
  position: relative;
  width: 520px;
  height: 520px;
  direction: rtl;
}

.wl-manager-search {
  padding: 12px 18px 6px;
}

.wl-manager-columns {
  display: flex;
  justify-content: space-between;
  padding: 10px 26px 6px 92px;
  font-size: 11px;
  color: var(--text-secondary);
}

.wl-manager-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
}

.wl-manager-empty {
  padding: 30px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.wl-manager-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}

.wl-manager-row:hover {
  background: var(--bg-hover);
}

.wl-manager-row.active {
  background: var(--bg-inverse);
  color: var(--text-inverse);
}

.wl-manager-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wl-manager-count {
  margin-inline-start: auto;
  width: 40px;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.wl-manager-actions {
  display: flex;
  gap: 2px;
  width: 58px;
  justify-content: flex-end;
}

.wl-manager-btn,
.wl-manager-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

/* Rename, copy and delete show on the open list and on hover */
.wl-manager-btn {
  visibility: hidden;
}

.wl-manager-row:hover .wl-manager-btn,
.wl-manager-row.active .wl-manager-btn {
  visibility: visible;
}

.wl-manager-btn:hover {
  background: rgba(127, 127, 127, 0.22);
}

.wl-manager-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.wl-manager-star {
  font-size: 14px;
  opacity: 0.3;
}

.wl-manager-star.pinned {
  opacity: 1;
  color: var(--gold-accent);
}

.wl-manager-rename {
  flex: 0 1 220px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--accent-blue);
  border-radius: 4px;
  background: var(--bg-panel);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.wl-manager-confirm {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
}

.wl-manager-confirm.hidden {
  display: none;
}

.wl-confirm-box {
  width: 360px;
  padding: 20px;
  border-radius: 10px;
  background: var(--bg-panel);
  box-shadow: var(--shadow-lg);
}

.wl-confirm-box h4 {
  margin-bottom: 10px;
  font-size: 15px;
  color: var(--text-primary);
}

.wl-confirm-box p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.wl-confirm-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.wl-confirm-actions button {
  padding: 6px 16px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-panel);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.wl-confirm-actions button.danger {
  background: #f23645;
  border-color: #f23645;
  color: #ffffff;
}

/* Row right click menu */
.wl-row-menu {
  min-width: 270px;
}

.wl-row-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 30px;
  padding: 0 12px;
}

.wl-flag-dots {
  display: flex;
  gap: 10px;
  padding: 4px 12px 8px;
}

.wl-flag-dot {
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--flag-color);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.wl-flag-dot:hover {
  transform: scale(1.2);
}

.wl-flag-dot.active {
  box-shadow: 0 0 0 2px var(--bg-panel), 0 0 0 4px var(--flag-color);
}

.wl-row-menu .tv-context-item.is-disabled {
  cursor: default;
  color: var(--text-secondary);
}

.wl-row-menu .tv-context-item.is-disabled:hover {
  background: transparent;
}

.symbol-cell {
  flex: 2.2;
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: right;
  overflow: hidden;
}

.company-logo-circle {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  user-select: none;
}

.symbol-ticker {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.symbol-ticker.is-name {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0;
}

.live-dot {
  color: #2962ff;
  font-size: 13px;
  line-height: 1;
  display: inline-block;
  margin-right: 2px;
}

.last-price-cell {
  flex: 1.2;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
}

.chg-cell {
  flex: 1;
  font-size: 11.5px;
  font-weight: 600;
  text-align: left;
}

.chg-pct-cell {
  flex: 1.2;
  font-size: 11.5px;
  font-weight: 600;
  text-align: left;
}

.val-up {
  color: #089981 !important;
}

.val-down {
  color: #f23645 !important;
}

.num-cell {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  padding: 1px 4px;
  border-radius: 3px;
  transition: background-color 0.15s ease, color 0.15s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
}

.num-cell.tick-flash-up {
  background-color: rgba(8, 153, 129, 0.25) !important;
  color: #089981 !important;
}

.num-cell.tick-flash-down {
  background-color: rgba(242, 54, 69, 0.25) !important;
  color: #f23645 !important;
}

/* TradingView Extreme-Right Vertical Icons Strip */
.tv-vertical-icons-strip {
  width: 42px;
  min-width: 42px;
  background: var(--bg-panel);
  border-radius: var(--panel-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 6px;
  z-index: 95;
}

.tv-strip-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tv-strip-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.tv-strip-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tv-strip-btn.active {
  color: var(--accent-blue);
  background: var(--accent-blue-subtle);
}
