/* Crypto Funding Rate Arbitrage Tool Styles */

:root {
  --primary-color: #2563eb;
  --secondary-color: #7c3aed;
  --success-color: #16a34a;
  --warning-color: #d97706;
  --error-color: #dc2626;
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --bitget-color: #00d4ff;
  --mexc-color: #ff6b35;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--spacing-md);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
  padding: var(--spacing-xl) 0;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--spacing-sm);
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Navigation Styles */
.navigation {
  margin: 20px 0;
  text-align: center;
  border-bottom: 2px solid #2c3e50;
  padding-bottom: 15px;
}

.nav-link {
  display: inline-block;
  padding: 10px 20px;
  margin: 0 10px;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  text-decoration: none;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.nav-link:hover {
  background: linear-gradient(135deg, #2980b9, #3498db);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.nav-link.active {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  border-color: #c0392b;
}

/* Tool Container */
.tool-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

/* Input Section */
.input-section {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.exchange-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.exchange-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  transition: all 0.3s ease;
}

.exchange-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.card-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.exchange-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.exchange-badge.bitget {
  background: rgba(0, 212, 255, 0.1);
  color: var(--bitget-color);
  border: 1px solid var(--bitget-color);
}

.exchange-badge.mexc {
  background: rgba(255, 107, 53, 0.1);
  color: var(--mexc-color);
  border: 1px solid var(--mexc-color);
}

.exchange-badge.bitunix {
  background: #8b5cf6;
  color: white;
}

/* Exchange-specific styling */
.exchange-badge.binance {
  background: #f0b90b;
  color: white;
}

.exchange-badge.bybit {
  background: #f7931a;
  color: white;
}

.exchange-badge.okx {
  background: #0085ff;
  color: white;
}

/* Input Group */
.input-group {
  margin-bottom: var(--spacing-md);
}

.input-group label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: all 0.3s ease;
  background: var(--bg-secondary);
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-hint {
  display: block;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* Symbol input validation styling */
.input-hint.error {
  color: var(--error-color);
  font-weight: 500;
}

.input-hint.success {
  color: var(--success-color);
  font-weight: 500;
}

/* Controls */
.controls {
  display: flex;
  align-items: end;
  gap: var(--spacing-lg);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
}

.controls .input-group {
  flex: 1;
  margin-bottom: 0;
}

.compare-btn {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--border-radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-width: 200px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.compare-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.clear-cache-btn {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
  padding: 12px 20px;
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  height: 48px;
}

.clear-cache-btn:hover {
  border-color: var(--warning-color);
  color: var(--warning-color);
}

/* Status Section */
.status-section {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.status-card {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.loading {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-color);
}

.status-badge.success {
  background: rgba(22, 163, 74, 0.1);
  color: var(--success-color);
}

.status-badge.error {
  background: rgba(220, 38, 38, 0.1);
  color: var(--error-color);
}

/* Results Section */
.results-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

/* Chart Section */
.chart-section {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.chart-header h3 {
  font-size: 1.5rem;
  font-weight: 600;
}

.chart-legend {
  display: flex;
  gap: var(--spacing-lg);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-weight: 500;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-color.bitget {
  background: var(--bitget-color);
}

.legend-color.mexc {
  background: var(--mexc-color);
}

.chart-container {
  position: relative;
  height: 400px;
  width: 100%;
}

/* Summary Section */
.summary-section {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
}

.summary-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  text-align: center;
  transition: all 0.3s ease;
}

.summary-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.summary-card h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Short strategy summary cards */
.summary-card.short-strategy {
  border-left: 4px solid var(--warning-color);
}

.summary-card.short-strategy h4 {
  color: var(--warning-color);
}

/* Color coding for short strategy values */
.summary-value.positive {
  color: var(--success-color);
  font-weight: 700;
}

.summary-value.negative {
  color: var(--error-color);
  font-weight: 700;
}

.summary-value.neutral {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Enhanced tooltip for summary values */
.summary-value[title] {
  cursor: help;
  position: relative;
}

.summary-value[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  margin-bottom: 5px;
}

.summary-value[title]:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
}

/* Action Summary Cards */
.summary-card.action-summary {
  border: 2px solid var(--border-color);
  transition: all 0.3s ease;
}

.summary-card.action-summary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.summary-action {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  padding: 8px 12px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s ease;
}

.summary-action.buy {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: 2px solid #059669;
}

.summary-action.sell {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: 2px solid #dc2626;
}

.summary-action.hold {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  color: white;
  border: 2px solid #4b5563;
}

.summary-action.caution {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border: 2px solid #d97706;
  animation: pulse 2s infinite;
}

.summary-action-details {
  font-size: 0.75rem;
  margin-top: 4px;
  opacity: 0.9;
  font-weight: 400;
  letter-spacing: 0.5px;
}

/* Profit Summary Cards */
.summary-card.profit-summary {
  border: 2px solid #fbbf24;
  background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
  position: relative;
  overflow: hidden;
}

.summary-card.profit-summary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f59e0b, #d97706, #92400e);
}

.summary-card.profit-summary h4 {
  color: #92400e;
  font-weight: 700;
}

.profit-value {
  font-size: 2rem !important;
  font-weight: 800 !important;
  text-align: center;
  margin: 8px 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.profit-value.high-profit {
  color: #059669 !important;
  animation: profit-glow 2s ease-in-out infinite alternate;
}

.profit-value.medium-profit {
  color: #0891b2 !important;
}

.profit-value.low-profit {
  color: #7c3aed !important;
}

.profit-value.no-profit {
  color: #6b7280 !important;
}

.profit-value.high-loss {
  color: #dc2626 !important;
  font-weight: 700;
  animation: loss-glow 2s ease-in-out infinite alternate;
}

.profit-value.medium-loss {
  color: #ef4444 !important;
  font-weight: 600;
}

.profit-value.low-loss {
  color: #f87171 !important;
}

@keyframes profit-glow {
  from {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
  }
  to {
    text-shadow: 0 0 10px rgba(5, 150, 105, 0.6), 1px 1px 2px rgba(0, 0, 0, 0.1);
  }
}

@keyframes loss-glow {
  from {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
  }
  to {
    text-shadow: 0 0 10px rgba(220, 38, 38, 0.6), 1px 1px 2px rgba(0, 0, 0, 0.1);
  }
}

.profit-strategy {
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  margin: 4px 0;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.8);
  color: #374151;
}

.profit-strategy.bitget-sell {
  border-left: 3px solid #00d4ff;
}

.profit-strategy.mexc-sell {
  border-left: 3px solid #ff6b35;
}

.profit-strategy.mixed-sell {
  border-left: 3px solid #6366f1;
}

.profit-note {
  font-size: 0.75rem;
  text-align: center;
  color: #6b7280;
  margin-top: 6px;
  font-style: italic;
  line-height: 1.3;
}

/* Table Section */
.table-section {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.table-header h3 {
  font-size: 1.5rem;
  font-weight: 600;
}

.export-btn {
  background: var(--success-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.export-btn:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-secondary);
}

.data-table th {
  background: var(--bg-primary);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
  font-size: 0.875rem;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.data-table tbody tr:hover {
  background: var(--bg-primary);
}

.arbitrage-yes {
  background: rgba(22, 163, 74, 0.1);
  color: var(--success-color);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.75rem;
}

.arbitrage-no {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

/* Error Section */
.error-section {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  border: 2px solid var(--error-color);
}

.error-card {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.error-header h3 {
  color: var(--error-color);
  font-size: 1.25rem;
  font-weight: 600;
}

.error-content {
  color: var(--text-primary);
  background: rgba(220, 38, 38, 0.05);
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--error-color);
}

/* Monitoring Section */
.monitoring-section {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--spacing-lg);
}

.monitoring-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.monitoring-header h3 {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
}

.monitoring-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.refresh-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.refresh-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.auto-refresh label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.auto-refresh input[type="checkbox"] {
  margin: 0;
}

/* Monitoring Table */
.monitoring-table-container {
  overflow-x: auto;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  margin-bottom: var(--spacing-lg);
}

.monitoring-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.monitoring-table th {
  background: var(--bg-primary);
  padding: 1rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
}

.monitoring-table td {
  padding: 1rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.monitoring-table tbody tr:hover {
  background: var(--bg-primary);
}

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

/* Monitoring Table Cells */
.exchange-cell {
  font-weight: 600;
}

.rate-cell {
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
  text-align: right;
  font-weight: 600;
}

.rate-cell.positive {
  color: var(--success-color);
}

.rate-cell.negative {
  color: var(--error-color);
}

.time-cell {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.status-cell {
  text-align: center;
}

.status-indicator {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-indicator.online {
  background: #dcfce7;
  color: var(--success-color);
}

.status-indicator.offline {
  background: #fecaca;
  color: var(--error-color);
}

.status-indicator.warning {
  background: #fed7aa;
  color: var(--warning-color);
}

.trend-cell {
  text-align: center;
}

.trend-indicator {
  font-size: 1.2rem;
  font-weight: 600;
}

.trend-indicator.up {
  color: var(--success-color);
}

.trend-indicator.down {
  color: var(--error-color);
}

.trend-indicator.neutral {
  color: var(--text-secondary);
}

/* Arbitrage Alerts */
.arbitrage-alerts {
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
}

.alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.alert-header h4 {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
}

.alert-threshold {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.alert-threshold label {
  color: var(--text-secondary);
}

.alert-threshold select {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: white;
  font-size: 0.875rem;
}

.alert-list {
  min-height: 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: white;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--warning-color);
  box-shadow: var(--shadow-sm);
}

.alert-item.high-priority {
  border-left-color: var(--error-color);
  background: #fef2f2;
}

.alert-item.medium-priority {
  border-left-color: var(--warning-color);
  background: #fffbeb;
}

.alert-info {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.alert-details {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.alert-value {
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
  font-weight: 600;
  font-size: 0.875rem;
}

.alert-value.positive {
  color: var(--success-color);
}

.alert-value.negative {
  color: var(--error-color);
}

.no-alerts {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 1rem;
}

/* Action Cell Styles */
.action-cell {
  text-align: center;
  font-weight: 600;
}

.action-indicator {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
  min-width: 60px;
}

.action-indicator.buy {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.action-indicator.sell {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.action-indicator.hold {
  background: rgba(156, 163, 175, 0.1);
  color: #6b7280;
  border: 1px solid rgba(156, 163, 175, 0.3);
}

.action-indicator.high-volatility {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.action-tooltip {
  position: relative;
  cursor: help;
}

.action-tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 1000;
  margin-bottom: 5px;
}

.action-tooltip:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1f2937;
  z-index: 1000;
}

/* Table Actions */
.table-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
}

.action-indicator.small {
  padding: 2px 6px;
  font-size: 0.65rem;
  min-width: auto;
  border-radius: 8px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.action-indicator.small:hover {
  transform: scale(1.05);
  transition: transform 0.1s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: var(--spacing-sm);
  }
  
  .header h1 {
    font-size: 2rem;
  }
  
  .exchange-cards {
    grid-template-columns: 1fr;
  }
  
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-md);
  }
  
  .chart-legend {
    align-self: flex-start;
  }
  
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .table-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-md);
  }
  
  .data-table {
    font-size: 0.75rem;
  }
  
  .data-table th,
  .data-table td {
    padding: 8px 12px;
  }
}

@media (max-width: 480px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }
  
  .data-table th,
  .data-table td {
    padding: 6px 8px;
  }
}

/* Funding History Specific Styles */
.history-input-card {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.input-row {
  display: flex;
  gap: var(--spacing-lg);
  align-items: end;
  flex-wrap: wrap;
}

.input-row .input-group {
  flex: 1;
  min-width: 200px;
}

.feature-badge {
  background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Statistics Grid */
.statistics-section {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.stats-header {
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--border-color);
}

.stats-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.stat-item label {
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-value {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.1rem;
}

/* Chart Controls */
.chart-controls {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
}

.chart-toggle-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chart-toggle-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

/* Table Controls */
.table-controls {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
}

.table-controls select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg-secondary);
  font-size: 0.9rem;
}

/* Enhanced Summary Cards for History */
.summary-note {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-style: italic;
}

.summary-value.positive {
  color: var(--success-color);
}

.summary-value.negative {
  color: var(--error-color);
}

/* Table Row Styling */
.data-table tbody tr td.positive {
  color: var(--success-color);
  font-weight: 600;
}

.data-table tbody tr td.negative {
  color: var(--error-color);
  font-weight: 600;
}

/* Responsive Design for History Page */
@media (max-width: 768px) {
  .input-row {
    flex-direction: column;
  }
  
  .input-row .input-group {
    min-width: 100%;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .chart-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .table-controls {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Enhanced profit indicators */
.profit-value.positive::before {
  content: "💚 ";
}

.profit-value.negative::before {
  content: "💔 ";
}

/* Loading states for history */
.btn-loader {
  animation: spin 1s linear infinite;
}

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

/* Enhanced exchange badges */
.exchange-badge.bitget {
  background: var(--bitget-color);
  color: white;
}

.exchange-badge.mexc {
  background: var(--mexc-color);
  color: white;
}

/* Development options styling */
.dev-options {
  border-top: 1px solid var(--border-color);
  padding-top: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.dev-options label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.dev-options input[type="checkbox"] {
  width: auto;
  margin: 0;
}
