/* Analytics - User-facing Charts Gallery & Viewer Styles */

/* ==================== SECTION HEADER ==================== */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.section-subtitle {
  font-size: 13px;
  color: #64748b;
  margin: 4px 0 0 0;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.filter-group {
  display: flex;
  gap: 8px;
}

.filter-group select {
  padding: 7px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  color: #334155;
  background: #f8fafc;
  cursor: pointer;
  font-family: inherit;
}

.filter-group select:focus {
  outline: none;
  border-color: #E84E0F;
}

/* ==================== CHARTS GRID ==================== */

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.chart-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.25s;
  cursor: pointer;
}

.chart-card:hover {
  border-color: #E84E0F;
  box-shadow: 0 8px 30px rgba(232, 78, 15, 0.12);
  transform: translateY(-3px);
}

.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #f1f5f9;
}

.chart-card-ticker {
  font-size: 18px;
  font-weight: 800;
  color: #E84E0F;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.5px;
}

.chart-card-tf {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  background: #e2e8f0;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chart-card-body {
  padding: 16px 18px;
}

.chart-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 8px;
  line-height: 1.35;
}

.chart-card-desc {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chart-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #94a3b8;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.chart-card-stats {
  display: flex;
  gap: 14px;
}

.chart-card-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chart-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.chart-tag {
  padding: 3px 8px;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: 6px;
  font-size: 11px;
  color: #475569;
  font-weight: 500;
}

/* Action bar on hover */
.chart-card-action {
  padding: 12px 18px;
  background: linear-gradient(135deg, #E84E0F 0%, #f97316 100%);
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s;
}

.chart-card:hover .chart-card-action {
  opacity: 1;
  max-height: 60px;
  padding: 12px 18px;
}

/* Loading placeholder */
.loading-placeholder {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: #94a3b8;
}

.spinner-md {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #E84E0F;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty state */
.empty-charts {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  text-align: center;
}

.empty-charts svg {
  opacity: 0.3;
  margin-bottom: 16px;
}

.empty-charts p {
  color: #94a3b8;
  margin: 4px 0;
}

.empty-charts .hint {
  font-size: 13px;
  color: #cbd5e1;
}

/* ==================== CHART VIEW ==================== */

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  margin-bottom: 8px;
  transition: all 0.15s;
}

.btn-back:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.view-ticker {
  font-size: 20px;
  font-weight: 800;
  color: #E84E0F;
  font-family: 'JetBrains Mono', monospace;
}

.view-tf {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  background: #e2e8f0;
  padding: 4px 12px;
  border-radius: 20px;
}

.view-realtime-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #22c55e;
  background: rgba(34,197,94,0.1);
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.live-dot-pulse {
  width: 8px; height: 8px;
  background: #22c55e;
  border-radius: 50%;
  animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.view-live-price {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  padding: 4px 14px;
  border-radius: 20px;
}
.view-live-price .live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
  animation: livePulse 1.5s infinite;
}
.view-live-price.up { color: #22c55e; background: rgba(34,197,94,0.08); }
.view-live-price.up .live-dot { background: #22c55e; }
.view-live-price.down { color: #ef4444; background: rgba(239,68,68,0.08); }
.view-live-price.down .live-dot { background: #ef4444; }
.view-live-price small { font-size: 11px; font-weight: 600; opacity: 0.8; }

/* Chart + Watchlist Row */
.view-chart-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

/* Client Watchlist */
.client-watchlist {
  width: 200px;
  min-width: 200px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cwl-header {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  background: #fafbfc;
}
.cwl-header h4 { margin: 0; font-size: 13px; font-weight: 700; color: #1e293b; }
.cwl-list {
  flex: 1;
  overflow-y: auto;
  max-height: 520px;
}
.cwl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #f8fafc;
  cursor: pointer;
  transition: background .1s;
}
.cwl-item:hover { background: #f8fafc; }
.cwl-item.active { background: #fff7ed; border-left: 3px solid #f97316; }
.cwl-ticker { font-size: 13px; font-weight: 700; color: #1e293b; }
.cwl-tf { font-size: 10px; color: #94a3b8; }
.cwl-price { font-size: 12px; font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.cwl-price.up { color: #22c55e; }
.cwl-price.down { color: #ef4444; }
.cwl-empty { padding: 20px 14px; text-align: center; color: #94a3b8; font-size: 12px; }

/* Chart Display */
.view-chart-wrapper {
  flex: 1;
  min-width: 0;
  position: relative;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  background: #131722;
  margin-bottom: 20px;
}

.view-chart-container {
  width: 100%;
  height: 520px;
  background: #131722;
}

.view-drawing-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* Description Panel */
.view-description-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  margin-bottom: 16px;
  overflow: hidden;
}

.desc-header {
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.desc-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.desc-body {
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.7;
  color: #334155;
  white-space: pre-wrap;
}

/* Lines Info Panel */
.view-lines-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  margin-bottom: 16px;
  overflow: hidden;
}

.view-lines-panel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.view-lines-panel .panel-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.lines-count {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.view-lines-list {
  padding: 12px 18px;
}

.view-line-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

.view-line-item:last-child {
  border-bottom: none;
}

.line-type-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.line-type-name {
  font-weight: 600;
  color: #0f172a;
  min-width: 80px;
}

.line-label-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.line-detail {
  color: #64748b;
  font-size: 12px;
}

/* Meta */
.view-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  flex-wrap: wrap;
  gap: 8px;
}

.view-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.view-date {
  font-size: 12px;
  color: #94a3b8;
}

/* ==================== TRADE INFO (Hypothesis, TP/SL) ==================== */

.view-trade-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.view-trade-label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 10px;
}

.view-hypothesis-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 6px;
}

.view-hypo-name {
  font-weight: 600;
  font-size: 13px;
  color: #334155;
}

.view-hypo-prices {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #475569;
}

.view-tpsl {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.view-tp, .view-sl {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.view-tp {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #16a34a;
}

.view-sl {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #dc2626;
}

.view-tp b, .view-sl b {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  margin-left: 6px;
}

/* ==================== DISCLAIMER ==================== */

.view-disclaimer {
  padding: 10px 14px;
  background: linear-gradient(135deg, #fef3c7 0%, #fff7ed 100%);
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #92400e;
  text-align: center;
  margin-bottom: 12px;
}

.chart-card-disclaimer {
  padding: 6px 10px;
  font-size: 10px;
  color: #92400e;
  background: #fffbeb;
  text-align: center;
  border-top: 1px solid #fde68a;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .section-header {
    flex-direction: column;
  }
  
  .view-chart-container {
    height: 350px;
  }
  
  .view-tpsl {
    flex-direction: column;
  }
}

/* ==================== CHART CARD ACTIONS (Watch + Open) ==================== */

.chart-card-actions {
  display: flex; gap: 8px; padding: 10px 18px;
  border-top: 1px solid #f1f5f9;
}
.chart-card-open-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; background: linear-gradient(135deg, #E84E0F 0%, #f97316 100%);
  color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.chart-card-open-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232,78,15,0.3); }
.watch-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 14px; background: #f1f5f9; color: #64748b;
  border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.watch-btn:hover { border-color: #f97316; color: #f97316; background: #fff7ed; }
.watch-btn.active { background: #f97316; color: #fff; border-color: #f97316; }
.watch-btn.active:hover { background: #ea6c0a; }

/* ==================== NOTIFICATIONS ==================== */

.notif-badge {
  position: absolute; top: 4px; right: 4px;
  background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
.nav-item { position: relative; }

.notifications-list { display: flex; flex-direction: column; gap: 8px; }
.notif-item {
  display: flex; gap: 12px; padding: 14px 18px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  cursor: pointer; transition: all 0.15s;
}
.notif-item:hover { border-color: #f97316; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.notif-item.unread { border-left: 3px solid #f97316; background: #fffbf5; }
.notif-item.read { opacity: 0.7; }
.notif-icon { font-size: 20px; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-msg { font-size: 14px; font-weight: 500; color: #1e293b; margin-bottom: 4px; }
.notif-meta { display: flex; gap: 12px; font-size: 12px; color: #94a3b8; }
.notif-ticker { font-weight: 600; color: #f97316; }
.notif-price { font-family: 'JetBrains Mono', monospace; }
.empty-state-small { padding: 40px 20px; text-align: center; color: #94a3b8; font-size: 14px; }
