/* toolbar.css - Light Theme Left Drawing Tools & Floating Favorites Bar */
.drawing-toolbar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 3px;
  height: 100%;
  background: transparent;
}

.tool-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 36px;
}

.tool-slot .tool-btn {
  width: 32px;
  height: 32px;
  margin-right: 8px;
}

.tool-chevron {
  position: absolute;
  right: 0px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s ease;
  z-index: 2;
}

.tool-slot:hover .tool-chevron {
  color: var(--text-primary);
}

.tool-chevron:hover {
  background: var(--bg-pressed);
  color: var(--text-primary);
}

.tool-chevron svg {
  width: 5px;
  height: 8px;
  pointer-events: none;
}

/* Drawing Tools Flyout Submenu */
.tool-flyout-menu {
  position: fixed;
  left: 62px;
  width: 255px;
  max-height: 480px;
  overflow-y: auto;
  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: 6px 0;
  direction: rtl;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
}

.tool-flyout-menu::-webkit-scrollbar {
  width: 5px;
}
.tool-flyout-menu::-webkit-scrollbar-track {
  background: transparent;
}
.tool-flyout-menu::-webkit-scrollbar-thumb {
  background: var(--bg-pressed);
  border-radius: 3px;
}

.flyout-sep {
  height: 1px;
  background: var(--bg-pressed);
  margin: 6px 0;
}

.tool-flyout-menu.hidden {
  display: none !important;
}

.flyout-cat-header {
  padding: 8px 12px 4px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.flyout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background 0.12s ease;
}

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

.flyout-item.selected {
  background: var(--bg-hover);
  color: #2962ff;
  font-weight: 700;
}

.flyout-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.flyout-item-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  display: block;
}

.flyout-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flyout-item-shortcut {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: monospace;
}

.flyout-star {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 14px;
  color: #d1d4dc;
  border-radius: 3px;
  transition: transform 0.15s ease, color 0.15s ease;
  cursor: pointer;
}

.flyout-star.starred {
  color: var(--text-primary);
}

.flyout-item:hover .flyout-star:not(.starred) {
  color: var(--text-secondary);
}

.flyout-star:hover {
  transform: scale(1.2);
}

.tool-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.tool-btn svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

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

.tool-btn.active {
  background: var(--accent-blue-subtle);
  color: var(--accent-blue);
  box-shadow: inset 0 0 0 1px var(--accent-blue);
}

.toolbar-sep {
  width: 28px;
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* Tool Tooltip */
.tool-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 54px;
  background: var(--bg-inverse);
  color: var(--text-inverse);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-4px);
  transition: all 0.15s ease;
  z-index: 10000;
}

.tool-btn:hover::after {
  opacity: 1;
  transform: translateX(0);
}

.tool-btn.magnet-active {
  color: #00bcd4;
  background: rgba(0, 188, 212, 0.12);
  box-shadow: inset 0 0 0 1px #00bcd4;
}

.tool-btn.fav-star-btn {
  color: var(--text-secondary);
}

.tool-btn.fav-star-btn.active {
  color: #f5a623;
  background: rgba(245, 166, 35, 0.12);
  box-shadow: inset 0 0 0 1px #f5a623;
}

/* ============================================================
   Floating Favorites Toolbar (شريط الأدوات المفضلة العائم)
   Matches TradingView Pro's floating toolbar design in Light Mode
   ============================================================ */
.floating-favorites-bar {
  position: absolute;
  top: 44px;
  left: 120px;
  width: max-content;
  min-height: 38px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 3px 10px 3px 4px;
  gap: 2px;
  z-index: 85;
  user-select: none;
  transition: box-shadow 0.2s ease, opacity 0.2s ease;
  direction: ltr; /* Tools flow left-to-right */
}

.floating-favorites-bar.is-dragging {
  cursor: grabbing !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.floating-favorites-bar.hidden {
  display: none !important;
}

.fav-drag-handle {
  width: 14px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: var(--text-muted);
  padding: 0 2px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.fav-drag-handle:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.fav-drag-handle:active {
  cursor: grabbing;
}

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

.fav-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

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

.fav-btn.active {
  background: rgba(41, 98, 255, 0.14);
  color: #2962ff;
  box-shadow: inset 0 0 0 1px rgba(41, 98, 255, 0.5);
}

.fav-btn.magnet-active {
  color: #00bcd4 !important;
  background: rgba(0, 188, 212, 0.15) !important;
  box-shadow: inset 0 0 0 1px #00bcd4;
}

.fav-sep {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 3px;
}

.fav-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 7px 7px 0;
  cursor: ew-resize;
}

.fav-resize-handle::after {
  content: '';
  width: 2px;
  height: 14px;
  border-radius: 1px;
  background: var(--border-color);
}

.fav-resize-handle:hover {
  background: var(--accent-blue-subtle);
}

.fav-resize-handle:hover::after {
  background: var(--accent-blue);
}

/* The close button only restores a bar that was narrowed by hand */
.fav-close-btn {
  display: none;
}

.floating-favorites-bar.is-resized .fav-close-btn {
  display: flex;
}

.fav-close-btn {
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  margin-left: 2px;
  transition: all 0.15s ease;
}

.fav-close-btn:hover {
  background: var(--bearish-red-bg);
  color: #f23645;
}

/* Tooltip for floating bar */
.fav-btn[data-tooltip]::after,
.fav-drag-handle[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-inverse);
  color: var(--text-inverse);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 10000;
}

.fav-btn:hover::after,
.fav-drag-handle:hover::after {
  opacity: 1;
}
