/* Estilos para o Monitor de Estratégias */
:root {
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --dark-color: #343a40;
  --light-color: #f8f9fa;
  --primary-color: #2962ff;
  --secondary-color: #6c757d;
}

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-title h1 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--primary-color);
}

.last-update {
  font-size: 0.9rem;
  color: var(--secondary-color);
}

/* Painel de controle */
.control-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.control-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.symbol-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

.api-connection {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Modal para configuração da API */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
}

.modal-content {
  background-color: #fefefe;
  margin: 10% auto;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  width: 500px;
  max-width: 90%;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--primary-color);
}

.close-modal {
  color: #aaa;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
}

.modal-body {
  margin-bottom: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #eee;
  padding-top: 15px;
}

.api-form .form-group {
  margin-bottom: 15px;
}

.form-info {
  background-color: #f8f9fa;
  padding: 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-top: 10px;
}

.form-info p {
  margin: 5px 0;
  color: #666;
}

/* Layout de grid para as estratégias */
.dashboard-grid {
  margin-bottom: 30px;
}

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

/* Cards de estratégia */
.strategy-card {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
  transition: all 0.3s ease;
  padding: 15px;
}

.strategy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.strategy-header h2 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--primary-color);
}

.strategy-controls {
  display: flex;
  gap: 5px;
}

/* Métricas da estratégia */
.strategy-metrics {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 6px;
}

.metric {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.metric-label {
  font-size: 0.8rem;
  color: #777;
  margin-bottom: 3px;
}

.metric-value {
  font-size: 1rem;
  font-weight: 500;
}

.goal-reached {
  color: #4caf50;
  font-weight: bold;
  position: relative;
}

.goal-reached::after {
  content: " 🎯";
}

.strategy-card.active-operation {
  border: 2px solid #4caf50;
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.operation-status {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: #e74c3c;
  color: white;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  display: none;
  animation: pulse 2s infinite;
}

.strategy-card.active-operation .operation-status {
  display: block;
}

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

/* Indicadores */
.strategy-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.indicator {
  flex: 1;
  min-width: calc(25% - 10px);
  padding: 8px;
  background-color: rgba(41, 98, 255, 0.05);
  border-radius: 6px;
  text-align: center;
}

.indicator-label {
  font-size: 0.75rem;
  color: #777;
  display: block;
}

.indicator-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
}

/* Gráficos */
.strategy-chart {
  height: 250px;
  margin-bottom: 15px;
  background-color: #f8f9fa;
  border-radius: 6px;
  padding: 10px;
}

/* Configuração da estratégia */
.strategy-config {
  margin-bottom: 15px;
  background-color: #f8f9fa;
  border-radius: 6px;
  padding: 15px;
  display: none; /* Inicialmente oculto */
}

.config-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.85rem;
  font-weight: 500;
}

.update-config {
  grid-column: span 2;
}

/* Logs da estratégia */
.strategy-logs {
  border: 1px solid #eee;
  border-radius: 6px;
  overflow: hidden;
}

.logs-header {
  background-color: #f5f5f5;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logs-header h3 {
  margin: 0;
  font-size: 1rem;
}

.logs-container {
  max-height: 150px;
  overflow-y: auto;
  padding: 10px;
  font-size: 0.85rem;
  background-color: #fcfcfc;
}

.log-entry {
  padding: 4px 0;
  border-bottom: 1px solid #f0f0f0;
  color: #555;
}

.log-entry.log-buy {
  color: var(--success-color);
}

.log-entry.log-sell {
  color: var(--danger-color);
}

.log-entry.log-exit {
  color: var(--info-color);
}

.log-entry.log-warning {
  color: var(--warning-color);
}

/* Painéis de dados de mercado */
.market-data-panel {
  margin-bottom: 30px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}

.panel-header {
  padding: 15px;
  background-color: #f8f9fa;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--primary-color);
}

.panel-content {
  padding: 15px;
}

.market-charts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.chart-container {
  background-color: #f8f9fa;
  border-radius: 6px;
  padding: 10px;
}

.chart-container h3 {
  margin: 0 0 10px 0;
  font-size: 1rem;
  text-align: center;
}

/* Informações de mercado */
.market-info {
  display: flex;
  gap: 20px;
}

.price-card {
  flex: 1;
  text-align: center;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 6px;
}

.price-card h3 {
  margin: 0 0 10px 0;
  font-size: 1rem;
}

.price {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.price-change {
  font-size: 0.9rem;
  font-weight: 500;
}

.price-change.positive {
  color: var(--success-color);
}

.price-change.negative {
  color: var(--danger-color);
}

.market-indicators {
  flex: 2;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.indicator-item {
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.indicator-name {
  font-size: 0.9rem;
  color: #777;
}

.indicator-value {
  font-weight: 500;
}

/* Painel de alertas */
.alerts-panel {
  margin-bottom: 30px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}

.alerts-container {
  max-height: 200px;
  overflow-y: auto;
  padding: 10px 15px;
}

.alert-item {
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-item.info {
  background-color: rgba(23, 162, 184, 0.1);
  color: var(--info-color);
}

.alert-item.success {
  background-color: rgba(40, 167, 69, 0.1);
  color: var(--success-color);
}

.alert-item.warning {
  background-color: rgba(255, 193, 7, 0.1);
  color: var(--warning-color);
}

.alert-item.danger {
  background-color: rgba(220, 53, 69, 0.1);
  color: var(--danger-color);
}

.alert-time {
  font-size: 0.8rem;
  color: #777;
  white-space: nowrap;
}

/* Painel de posições */
.positions-panel {
  margin-bottom: 30px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}

.positions-table-wrapper {
  overflow-x: auto;
}

.positions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.positions-table th,
.positions-table td {
  padding: 12px 15px;
  text-align: left;
}

.positions-table thead {
  background-color: #f8f9fa;
}

.positions-table th {
  font-weight: 500;
  color: #555;
}

.positions-table tbody tr {
  border-bottom: 1px solid #eee;
}

.positions-table tbody tr:hover {
  background-color: rgba(41, 98, 255, 0.02);
}

/* Histórico de operações */
.trade-history-panel {
  margin-bottom: 30px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}

.panel-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.history-table-wrapper {
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.history-table th,
.history-table td {
  padding: 12px 15px;
  text-align: left;
}

.history-table thead {
  background-color: #f8f9fa;
}

.history-table th {
  font-weight: 500;
  color: #555;
}

.history-table tbody tr {
  border-bottom: 1px solid #eee;
}

.history-table tbody tr:hover {
  background-color: rgba(41, 98, 255, 0.02);
}

/* Status de posição */
.position-long {
  color: var(--success-color);
  font-weight: 500;
}

.position-short {
  color: var(--danger-color);
  font-weight: 500;
}

/* Notificações */
#notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.notification {
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  width: 300px;
  animation: slidein 0.3s ease-out;
}

.notification.info {
  background-color: var(--info-color);
  color: white;
}

.notification.success {
  background-color: var(--success-color);
  color: white;
}

.notification.warning {
  background-color: var(--warning-color);
  color: #333;
}

.notification.danger {
  background-color: var(--danger-color);
  color: white;
}

@keyframes slidein {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Botões e controles */
.toggle-active {
  background-color: #e9ecef;
}

.toggle-active.active {
  background-color: var(--success-color);
  color: white;
}

/* Responsividade */
@media (max-width: 1200px) {
  .grid-layout {
    grid-template-columns: 1fr;
  }
  
  .market-charts {
    grid-template-columns: 1fr;
  }
  
  .market-info {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .config-form {
    grid-template-columns: 1fr;
  }
  
  .update-config {
    grid-column: 1;
  }
  
  .control-panel {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  
  .control-buttons {
    flex-wrap: wrap;
  }
}