/* =========================================================================
   TOP GAINERS & TOP LOSERS STYLES
   ========================================================================= */

/* Header Area */
.tgl-header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.tgl-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--text-primary);
}

.tgl-text-green { color: #22c55e; }
.tgl-text-red { color: #ef4444; }

.tgl-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.tgl-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.tgl-breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
}

.tgl-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tgl-last-updated {
  font-size: 11px;
  color: var(--text-muted);
}

.tgl-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tgl-btn {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #cbd5e1;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tgl-btn:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
  color: #fff;
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3), inset 0 0 10px rgba(99, 102, 241, 0.1);
}


.tgl-alert-gainers-btn {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(21, 128, 61, 0.05));
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.1);
}
.tgl-alert-gainers-btn:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(21, 128, 61, 0.15));
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.6);
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.3), inset 0 0 10px rgba(34, 197, 94, 0.1);
}
.tgl-alert-gainers-btn.active {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.25), rgba(21, 128, 61, 0.2));
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.8);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.4), inset 0 0 12px rgba(34, 197, 94, 0.2);
}
.tgl-alert-gainers-btn.active i {
  font-weight: 900;
  animation: ring 0.5s ease-in-out;
}

.tgl-alert-losers-btn {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(185, 28, 28, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
}
.tgl-alert-losers-btn:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(185, 28, 28, 0.15));
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3), inset 0 0 10px rgba(239, 68, 68, 0.1);
}
.tgl-alert-losers-btn.active {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(185, 28, 28, 0.2));
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.8);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4), inset 0 0 12px rgba(239, 68, 68, 0.2);
}
.tgl-alert-losers-btn.active i {
  font-weight: 900;
  animation: ring 0.5s ease-in-out;
}


@keyframes ring {
  0% { transform: rotate(0); }
  20% { transform: rotate(15deg); }
  40% { transform: rotate(-10deg); }
  60% { transform: rotate(5deg); }
  80% { transform: rotate(-5deg); }
  100% { transform: rotate(0); }
}

/* Tabs */
.tgl-tabs-container {
  display: flex;
  width: 100%;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.tgl-tab {
  flex: 1; /* 50% width each */
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tgl-tab:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
}

.tgl-tab.active[data-target="gainers"] {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(21, 128, 61, 0.1));
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.15), inset 0 0 10px rgba(34, 197, 94, 0.05);
  text-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.tgl-tab.active[data-target="losers"] {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(185, 28, 28, 0.1));
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.15), inset 0 0 10px rgba(239, 68, 68, 0.05);
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* Controls Bar */
.tgl-controls-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-surface);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.tgl-timeframe {
  display: flex;
  background: var(--bg-default);
  border-radius: 4px;
  padding: 2px;
  border: 1px solid var(--border-subtle);
}

.tgl-tf-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.tgl-tf-btn.active {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.tgl-dropdowns {
  display: flex;
  gap: 12px;
}

.tgl-dropdown-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-default);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0 12px;
  height: 30px;
}

.tgl-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  appearance: none;
  cursor: pointer;
  padding-right: 16px;
  /* Basic down arrow for native select */
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 8px auto;
}
.tgl-select option { background: var(--bg-surface); }

.tgl-search-box {
  display: flex;
  align-items: center;
  background: var(--bg-default);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0 12px;
  height: 30px;
  width: 250px;
}

.tgl-search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  flex-grow: 1;
}

.tgl-search-box i {
  color: var(--text-muted);
  font-size: 12px;
}


/* Dual Tables Grid */
.tgl-tables-grid {
  display: block;
  margin-bottom: 24px;
}

.tgl-table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  display: none; /* hidden by default */
}

.tgl-table-wrapper.active {
  display: block; /* show active */
}

/* Add colored borders to differentiate Gainers vs Losers */
.tgl-gainers-wrapper { border-top: 2px solid rgba(34, 197, 94, 0.3); }
.tgl-losers-wrapper { border-top: 2px solid rgba(239, 68, 68, 0.3); }

.tgl-table {
  width: 100%;
  border-collapse: collapse;
}

.tgl-table th {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.tgl-table td {
  padding: 12px 8px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}

.tgl-table tr:last-child td {
  border-bottom: none;
}

.tgl-table tr:hover td {
  background-color: var(--bg-hover);
}

.tgl-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-default);
  margin-right: 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-primary);
  vertical-align: middle;
}

.tgl-symbol-col {
  display: flex;
  align-items: center;
}

.tgl-symbol-name { font-weight: 600; }
.tgl-company-name { font-size: 10px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }

/* Colors for specific table variants */
.tgl-gainers-wrapper .tgl-price-col { font-weight: 500; font-family: 'JetBrains Mono', monospace; }
.tgl-gainers-wrapper .tgl-change-col { color: #22c55e; font-family: 'JetBrains Mono', monospace; }

.tgl-losers-wrapper .tgl-price-col { font-weight: 500; font-family: 'JetBrains Mono', monospace; }
.tgl-losers-wrapper .tgl-change-col { color: #ef4444; font-family: 'JetBrains Mono', monospace; }


/* Bottom Dashboard */
.tgl-bottom-dashboard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.tgl-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
}

.tgl-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.tgl-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tgl-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}

.tgl-list-val {
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.tgl-list-val.positive { color: #22c55e; }
.tgl-list-val.negative { color: #ef4444; }

.tgl-mini-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tgl-mini-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-default);
}
.tgl-mini-bar.positive { background: #22c55e; }
.tgl-mini-bar.negative { background: #ef4444; }


/* AI TOUCH TABLE HEADER */
.ai-table-header {
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.8), rgba(99, 102, 241, 0.1));
  border-bottom: 2px solid rgba(99, 102, 241, 0.3);
}

.ai-table-header th {
  color: #cbd5e1 !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 12px 16px !important;
}

.ai-table-header th:nth-child(3) { /* LTP column */
  color: #e2e8f0 !important;
  text-shadow: 0 0 8px rgba(255,255,255,0.2);
}



/* Backtest Page Styles */
.tgl-backtest-btn {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.tgl-backtest-btn:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.15));
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3), inset 0 0 10px rgba(16, 185, 129, 0.1);
}

.ai-date-picker {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #e2e8f0;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  margin: 0 12px;
}
.ai-date-picker:focus {
  border-color: #818cf8;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}
.ai-date-picker::-webkit-calendar-picker-indicator {
  filter: invert(1) hue-rotate(240deg) brightness(1.5);
  cursor: pointer;
}

.tgl-run-backtest-btn {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border: none;
  color: #fff;
  padding: 8px 20px;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}
.tgl-run-backtest-btn:hover {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}


.vs-alert-btn {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.1), rgba(202, 138, 4, 0.05));
  border: 1px solid rgba(234, 179, 8, 0.3);
  color: #fde047;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.1);
}
.vs-alert-btn:hover {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(202, 138, 4, 0.15));
  color: #fef08a;
  border-color: rgba(234, 179, 8, 0.6);
  box-shadow: 0 0 15px rgba(234, 179, 8, 0.3), inset 0 0 10px rgba(234, 179, 8, 0.1);
}
.vs-alert-btn.active {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.25), rgba(202, 138, 4, 0.2));
  color: #fef08a;
  border-color: rgba(234, 179, 8, 0.8);
  box-shadow: 0 0 20px rgba(234, 179, 8, 0.4), inset 0 0 12px rgba(234, 179, 8, 0.2);
}
.vs-alert-btn.active i {
  font-weight: 900;
  animation: ring 0.5s ease-in-out;
}
