/* topbar.css - Pixel-Perfect TradingView Light Theme Top Bar (Arabic RTL) */

#topbarArea {
  height: 42px;
  min-height: 42px;
  background: var(--bg-panel);
  z-index: 1000;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
  direction: rtl;
}

.topbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 8px;
  direction: rtl;
}

.topbar-section-right,
.topbar-section-middle,
.topbar-section-left {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
}

/* 1. Symbol Search Pill */
.topbar-symbol-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  height: 28px;
  padding: 0 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
  letter-spacing: 0.3px;
  transition: all 0.15s ease;
}

.topbar-symbol-pill:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

/* Chart Styles Visible Strip */
.chart-styles-strip {
  display: flex;
  align-items: center;
  gap: 2px;
}

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

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

.chart-style-btn.active {
  background: var(--bg-pressed);
  color: var(--text-primary);
}

/* 2. Generic Icon Button */
.topbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.topbar-icon-btn:hover {
  background: var(--bg-hover);
}

.theme-icon-sun {
  display: none;
}

[data-theme="dark"] .theme-icon-moon {
  display: none;
}

[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.topbar-icon-btn:active {
  background: var(--bg-pressed);
}

/* 3. Dividers */
.topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--bg-pressed);
  margin: 0 4px;
}

/* 4. Timeframes Container & Strip */
.timeframes-dropdown-container {
  position: relative;
  display: flex;
  align-items: center;
}

.fav-timeframes-strip {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tf-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0 6px;
  height: 26px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
  white-space: nowrap;
}

.tf-pill:hover {
  background: var(--bg-hover);
}

/* Active timeframe: Highlighted with soft rounded grayish badge, NO blue underline */
.tf-pill.active {
  background: var(--bg-pressed);
  color: var(--text-primary);
  font-weight: 700;
}

.timeframe-chevron-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-right: 2px;
  transition: background 0.15s ease, color 0.15s ease;
}

.timeframe-chevron-btn:hover,
.timeframe-chevron-btn.open {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Timeframe Dropdown Menu */
.timeframe-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: auto;
  width: 220px;
  max-height: 460px;
  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.12);
  z-index: 10005;
  padding: 4px 0;
  direction: rtl;
}

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

.timeframe-category {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

.timeframe-category:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.timeframe-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 4px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  user-select: none;
}

.timeframe-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;
}

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

.timeframe-item.selected {
  font-weight: 700;
  background: var(--bg-hover);
}

.timeframe-item .star-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 14px;
  color: #d1d4dc;
  border-radius: 3px;
  transition: color 0.12s ease;
}

.timeframe-item .star-btn.starred {
  color: var(--text-primary);
}

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

.timeframe-item .star-btn:hover {
  transform: scale(1.15);
}

/* 5. Dropdown Wrappers (Chart Style, Layout) */
.topbar-dropdown-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.topbar-icon-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 6px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s ease;
}

.topbar-icon-dropdown-btn:hover {
  background: var(--bg-hover);
}

.topbar-popover-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 10001;
  padding: 4px 0;
  direction: rtl;
}

.topbar-popover-menu.hidden {
  display: none !important;
}

.topbar-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s ease;
}

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

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

/* 6. Indicators Button */
.topbar-text-icon-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
  transition: background 0.15s ease;
}

.topbar-text-icon-btn:hover {
  background: var(--bg-hover);
}

.topbar-chevron-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
}

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

.fav-indicator-check {
  margin-inline-start: auto;
  color: var(--accent-blue);
  font-weight: 700;
}

.fav-indicators-empty {
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.topbar-text-icon-btn .fx-symbol {
  font-weight: 800;
  color: #2962ff;
  font-family: serif;
  font-size: 14px;
}

/* 7. Middle Section: Layout & Cloud Cluster */
.topbar-cloud-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.15s ease;
}

.topbar-cloud-cluster:hover {
  background: var(--bg-hover);
}

.topbar-cloud-cluster .layout-title {
  font-size: 13px;
  font-weight: 600;
}

.topbar-cloud-cluster .cloud-icon {
  color: #089981;
}

/* 8. Left Section (FAR LEFT edge in RTL) */
.topbar-publish-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  background: #2962ff;
  border: none;
  border-radius: 4px;
  color: #ffffff;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
  transition: background 0.15s ease;
}

.topbar-publish-btn:hover {
  background: #1e53e5;
}

.topbar-trade-btn {
  display: flex;
  align-items: center;
  background: transparent;
  border: none;
  color: #2962ff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 8px;
  height: 28px;
  border-radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
  transition: background 0.15s ease;
}

.topbar-trade-btn:hover {
  background: rgba(41, 98, 255, 0.08);
}

.topbar-sub-btn {
  display: flex;
  align-items: center;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 10px;
  height: 28px;
  border-radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
  transition: all 0.15s ease;
}

.topbar-sub-btn:hover {
  background: var(--bg-hover);
}

/* Far Left: Circular User Profile Avatar */
.topbar-user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-inverse);
  color: var(--text-inverse);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.topbar-user-avatar:hover {
  opacity: 0.85;
}
