/* chart.css - Light Chart Panel Styles (modular rewrite).
 *
 * Scope: overlay, panel chrome, header rows 1/2, kebab menu, dynamic panels
 * container, condition builder (tv-*).
 *
 * NOT in this file (see dedicated modules, per CLAUDE.md CSS modularity rule):
 *   - chart.indicators.menu.css : + Indicator modal, chips, params editor.
 *   - chart.volume_profile.css  : Canvas overlay.
 *   - chart.mtf.css             : MTF reference row.
 */

/* -- Overlay -- */
#chartOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

/* -- Panel -- */
#chartPanel {
  background: #0f0f1a;
  border: 1px solid #2a2a4a;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 1200px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
  overflow: hidden;
}
@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0 }
  to   { transform: translateY(0);    opacity: 1 }
}

/* -- Header: 2 rows -- */
#chartHeader {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #1e1e35;
  flex-shrink: 0;
}

.chart-header-row1 {
  display: flex;
  align-items: center;
  padding: 10px 16px 8px;
  gap: 10px;
  border-bottom: 1px solid #161628;
}

.chart-header-row2 {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  gap: 8px;
}

/* -- Symbol info -- */
.chart-symbol-info {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.chart-symbol-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: #e8e8ff;
  letter-spacing: 0.04em;
}
.chart-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: #a0a0c0;
}
.chart-change {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
}
.chart-change.positive { background: rgba(38,166,154,0.15); color: #26a69a; }
.chart-change.negative { background: rgba(239,83,80,0.15);  color: #ef5350; }
.chart-change.neutral  { background: rgba(150,150,180,0.1); color: #9090b0; }

.chart-indicator-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: #666;
  padding: 1px 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid #1e1e35;
  border-radius: 4px;
}

/* -- Row 1 right-side controls -- */
.chart-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.chart-tf-select {
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  color: #c0c0ff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
  height: 28px;
}
.chart-tf-select:hover  { border-color: #4a4a7a; }
.chart-tf-select:focus  { border-color: #5a5a9a; }
.chart-tf-select option { background: #0f0f1a; color: #c0c0ff; }

.chart-tf-label {
  font-size: 0.72rem;
  color: #8888aa;
  margin-right: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn-chart-close,
.btn-chart-kebab {
  background: #1e1e35;
  border: 1px solid #3a3a5a;
  color: #888;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-chart-kebab:hover { background: #252545; color: #c0c0ff; border-color: #5a5a9a; }
.btn-chart-close:hover { background: #2a1a1a; color: #ef5350; border-color: #ef5350; }

.btn-chart-paper {
  background: rgba(38, 166, 154, 0.18);
  border: 1px solid rgba(38, 166, 154, 0.55);
  color: #2de1cd;
  padding: 4px 10px;
  height: 28px;
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-chart-paper:hover {
  background: rgba(38, 166, 154, 0.32);
  color: #8ff3e3;
}

/* -- Kebab menu (hosts Export / Fibonacci / Fullscreen) -- */
.chart-kebab-wrap {
  position: relative;
  display: inline-flex;
}
.chart-kebab-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #10112a;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  min-width: 180px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  z-index: 1100;
  padding: 4px 0;
}
.chart-kebab-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #c4c4df;
  padding: 7px 14px;
  font-size: 0.78rem;
  cursor: pointer;
}
.chart-kebab-menu button.active {
  color: #8ff3e3;
}
.chart-kebab-menu button:hover {
  background: rgba(120, 130, 180, 0.14);
  color: #fff;
}
.chart-kebab-sep {
  height: 1px;
  background: rgba(120, 130, 180, 0.2);
  margin: 4px 0;
}

/* -- Main price container + dynamic panels host -- */
#chartContainer {
  flex: 1;
  min-height: 200px;
  position: relative;
  overflow: hidden;
}

#chartPanelsContainer {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chart-panel-dynamic {
  height: 120px;
  position: relative;
  border-top: 1px solid #1a1a2e;
  flex-shrink: 0;
}

/* -- Loading / Error -- */
.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #555;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}
.chart-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid #2a2a4a;
  border-top-color: #5a5a9a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

.chart-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #ef5350;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

/* -- Fullscreen -- */
.chart-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  max-width: 100% !important;
  height: 100vh !important;
  border-radius: 0 !important;
  z-index: 1001;
}

/* -- Condition Builder (tv-*) used elsewhere in the app -- */
.cb-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  color: #555;
  font-size: 0.82rem;
  font-style: italic;
}
.cb-empty-icon { font-size: 1rem; opacity: 0.4; }

.tv-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 4px;
  border-bottom: 1px solid #1a1a2e;
}

.tv-indicator-select,
.tv-operator-select,
.tv-period-select {
  background: #131320;
  border: 1px solid #2a2a4a;
  color: #a0a0c0;
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 0.75rem;
  cursor: pointer;
  outline: none;
}

.tv-period-input,
.tv-value-input {
  background: #131320;
  border: 1px solid #2a2a4a;
  color: #c0c0ff;
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 0.75rem;
  width: 68px;
  outline: none;
  font-family: 'JetBrains Mono', monospace;
}

.tv-val-sep { color: #555; font-size: 0.75rem; }

.tv-remove-btn {
  background: transparent;
  border: 1px solid #2a2a4a;
  color: #555;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  flex-shrink: 0;
}
.tv-remove-btn:hover { background: rgba(239,83,80,0.1); color: #ef5350; border-color: #ef5350; }

.cb-add-btn {
  margin-top: 8px;
  background: transparent;
  border: 1px dashed #2a2a4a;
  color: #555;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}
.cb-add-btn:hover { border-color: #5a5a9a; color: #9090d0; }
