/* ──────────────────────────────────────────────────────────
   sidebar.css  —  TradingView benzeri Drawing Tools Sidebar
────────────────────────────────────────────────────────── */

/* ── Wrapper ─────────────────────────────────────────────── */
#sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 52px;
  z-index: 10;
}

.sidebar__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 52px;
  height: 100%;
  background: var(--bg-secondary, #000000);
  border-right: 1px solid var(--border-primary, #2a2e39);
  padding: 4px 0;
  overflow: hidden;
  gap: 1px;
}

/* ── Buton ───────────────────────────────────────────────── */
.sidebar__btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  border-radius: 6px;
  cursor: default;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}

/* SVG fill="none" iken de tüm alan tıklanabilir olsun */
.sidebar__btn svg,
.sidebar__btn svg * {
  pointer-events: none;  /* olayı butona bırak, SVG parçaları değil */
}

.sidebar__btn:hover {
  background: var(--bg-hover, #2a2e39);
  color: var(--text-primary);
}

.sidebar__btn.active {
  color: var(--accent-blue, #00f3ff);
  background: var(--accent-blue-bg, rgba(0, 243, 255, 0.1));
}

/* ── Grup butonu (flyout'lu) ─────────────────────────────── */
.sidebar__btn--group {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: default;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
  color: var(--text-primary);
}

.sidebar__btn--group:hover {
  background: var(--bg-hover, #2a2e39);
  color: var(--text-primary);
}

.sidebar__btn--group.active {
  color: var(--accent-blue, #00f3ff);
  background: var(--accent-blue-bg, rgba(0, 243, 255, 0.1));
}

.sidebar__btn--group.flyout-open {
  background: var(--bg-hover, #2a2e39);
  color: var(--text-primary, #d1d4dc);
}

.sidebar__btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.sidebar__btn-arrow {
  display: none;
  position: absolute;
  top: 50%;
  right: 2px;
  transform: translateY(-50%);
  color: var(--text-muted, #787b86);
  opacity: 0.7;
  line-height: 1;
}

.sidebar__btn--group:hover .sidebar__btn-arrow,
.sidebar__btn--group.flyout-open .sidebar__btn-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Spacer & separator ──────────────────────────────────── */
.sidebar__spacer {
  flex: 1;
  min-height: 4px;
}

.sidebar__separator {
  width: 24px;
  height: 1px;
  background: var(--border, #2a2e39);
  margin: 3px 0;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   FLYOUT PANELİ
══════════════════════════════════════════════════════ */
.sidebar__flyout {
  position: fixed;
  z-index: 1000;
  background: var(--bg-secondary, #000000);
  border: 1px solid var(--border-primary, #2a2e39);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
  min-width: 220px;
  max-width: 300px;
  /* Viewport dışı taşma engeli */
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar__flyout-header {
  padding: 10px 14px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #d1d4dc);
  border-bottom: 1px solid var(--border-primary, #2a2e39);
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

/* scroll artık flyout'un kendisinde — bu div sadece padding sağlar */
.sidebar__flyout-scroll {
  padding: 4px 0;
}

.sidebar__flyout-heading {
  padding: 6px 14px 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted, #50535e);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.sidebar__flyout-divider {
  height: 1px;
  background: var(--border-primary, #2a2e39);
  margin: 4px 0;
}

.sidebar__flyout-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #787b86);
  border-radius: 0;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: background 0.1s, color 0.1s;
}

.sidebar__flyout-item:hover {
  background: var(--bg-hover, #2a2e39);
  color: var(--text-primary, #d1d4dc);
}

.sidebar__flyout-item.active {
  color: var(--accent-blue, #00f3ff);
}

.sidebar__flyout-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.85;
}

.sidebar__flyout-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__flyout-shortcut {
  font-size: 11px;
  color: var(--text-muted, #787b86);
  font-family: monospace;
  margin-left: 4px;
  flex-shrink: 0;
}

.sidebar__flyout-star {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 4px;
  color: var(--text-muted, #787b86);
  opacity: 0;
  transition: opacity 0.1s;
  cursor: pointer;
  border-radius: 3px;
  padding: 2px;
}

.sidebar__flyout-item:hover .sidebar__flyout-star,
.sidebar__flyout-star.filled {
  opacity: 1;
}

.sidebar__flyout-star:hover {
  background: var(--bg-hover, #363a45);
}

/* ══════════════════════════════════════════════════════
   FAVORİLER ÇUBUĞU
══════════════════════════════════════════════════════ */
.favorites-bar {
  position: fixed;
  left: 52px;
  bottom: 0;
  height: 40px;
  display: none;           /* JS toggle eder */
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 0 8px;
  background: var(--bg-secondary, #161a25);
  border-top: 1px solid var(--border-primary, #2a2e39);
  border-right: 1px solid var(--border-primary, #2a2e39);
  z-index: 100;
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 200px;
  max-width: calc(100vw - 52px - 300px);
}

/* scrollbar gerekmiyor, zaten draggable */

.favorites-bar__item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
}

.favorites-bar__item:hover {
  background: var(--bg-hover, #2a2e39);
  color: var(--text-primary, #d1d4dc);
}

.favorites-bar__item.active {
  color: var(--accent, #2962ff);
  background: rgba(41, 98, 255, 0.12);
}

.favorites-bar__item[draggable="true"] {
  cursor: grab;
}

.favorites-bar__item[draggable="true"]:active {
  cursor: grabbing;
}
