/* ---------------------------
   RESET BÁSICO
--------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Orbitron', sans-serif;
}

body {
  background-color: #0d0d0d;
  color: #fff;
  line-height: 1.6;
}

/* ---------- CABEÇALHO ---------- */
.header{
  position:relative;          /* cria contexto para o nav absoluto */
  display:flex;
  justify-content:center;     /* centraliza o conteúdo restante (logo) */
  align-items:center;
  padding:10px;
  background:linear-gradient(45deg,#0ff,#00f);
  border-bottom:4px solid #00ffcc;
}

/* Logo + título continuam lado a lado */
.logo-container{
  display:flex;
  align-items:center;
  gap:10px;
}

/* Navegação fixa no canto direito */
.top-nav{
  position:absolute;
  right:20px;
  top:50%;
  transform:translateY(-50%); /* centraliza verticalmente no header */
  display:flex;
  gap:10px;
}

/* ajustes já existentes */
.logo{height:40px;}
.header-title{font-size:1.2rem;text-transform:uppercase;}


/* NAV */
.top-nav {
  display: flex;
  gap: 10px;
  margin-right: 20px;
}

.top-nav a {
  text-decoration: none;
  background-color: #00ffcc;
  color: #000;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: bold;
  transition: background-color 0.3s, color 0.3s;
}

.top-nav a:hover {
  background-color: #fff;
  color: #00ffcc;
}

/* ---------------------------
   CONTAINER PRINCIPAL
--------------------------- */
.container {
  width: 100%;
}

.main-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  width: 90%;
  max-width: 1200px;
  margin: auto;
  padding: 20px;
  gap: 20px;
}

/* DIV que empilha Ordens e Logs */
.tables-container {
  display: flex;
  flex-direction: column;
  flex: 2; /* ocupa mais espaço que o controls-section */
  gap: 20px;
}

/* ---------------------------
   SEÇÃO DE ORDENS ABERTAS
--------------------------- */
/* Ajuste da Seção Ordens Abertas */
.orders-section {
  background: #111;
  padding: 10px; /* Aumentado para dar espaço interno confortável */
  border-radius: 10px;
  border: 2px solid #303030;
  margin-bottom: 10px;
  width: 100%;
  overflow-x: auto; /* Scroll horizontal caso necessário */
}

/* Tabela de Ordens Abertas */
.orders-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px; /* reduz o espaçamento entre linhas */
  table-layout: auto;
  margin-top: 10px; /* reduzido para melhor encaixe */
}

/* Cabeçalhos e células com fontes reduzidas e padding ajustado */
.orders-table th,
.orders-table td {
  padding: 6px; /* reduz padding para encaixar melhor */
  font-size: 0.75rem; /* reduz fonte para melhor encaixe */
  text-align: center;
  white-space: nowrap;
}

/* Ajustes no cabeçalho para melhor visualização */
.orders-table th {
  background: #222;
  color: #00ffcc;
  border-bottom: 2px solid #00ffcc;
  font-weight: bold;
  text-transform: uppercase;
}

/* Ajuste responsivo específico para telas menores */
@media (max-width: 767px) {
  .orders-table th,
  .orders-table td {
    font-size: 0.65rem; /* ainda menor para celulares */
    padding: 4px; 
  }
}

/* ---------------------------
   SEÇÃO DE LOGS
--------------------------- */
/* Ajuste para permitir scroll horizontal na seção de logs */
.logs-section {
  background: #111;
  padding: 20px;
  border-radius: 10px;
  border: 2px solid #303030;
  margin-bottom: 10px; /* se quiser alinhar com a .orders-section */
  width: 100%;
  overflow-x: auto; /* habilita scroll horizontal */
}

/* Ajustes na tabela de logs */
.logs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  table-layout: auto;
  margin-top: 15px;
  white-space: nowrap; /* evita quebra de linha e força rolagem horizontal */
}

.logs-table th,
.logs-table td {
  border: none;
  padding: 10px;
  text-align: center;
  white-space: nowrap;
  font-size: 0.9rem;
}

.logs-table th {
  background: #222;
  color: #00ffcc;
  font-weight: bold;
  text-transform: uppercase;
  border-bottom: 2px solid #303030;
}

/* ---------------------------
   SEÇÃO DE CONTROLES
--------------------------- */
.controls-section {
  flex: 1;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.account-status,
.settings,
.process-mode,
.manual-order,
.api-settings,
.bot-controls {
  background: #1a1a1a;
  padding: 15px;
  border-radius: 12px;
  border: 2px solid #303030;
  text-align: left;
  box-shadow: 0 0 10px rgba(0, 255, 204, 0.1);
}

.status-list {
  list-style: none;
  padding: 0;
}

.status-list li {
  margin: 5px 0;
}

/* Inputs */
input, select {
  width: 100%;
  padding: 10px;
  border: none;
  background: #1a1a1a;
  color: #00ffcc;
  border-bottom: 2px solid #00ffcc;
  border-radius: 8px;
}

/* Grid Configurações */
.grid-settings {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  text-align: left;
}

/* Botões */
.btn {
  margin-top: 10px;
  padding: 10px 20px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 8px;
  background: #00ffcc;
  color: #000;
  font-weight: bold;
}

.btn:hover {
  background: #fff;
  color: #00ffcc;
}

/* Botões Start/Stop */
.start-btn {
  background: #0f0;
  width: 100%;
}
.start-btn:hover {
  background: #fff;
  color: #0f0;
}
.stop-btn {
  background: #f00;
  width: 100%;
}
.stop-btn:hover {
  background: #fff;
  color: #f00;
}

/* Mensagens */
.message-box {
  background: #0084ff;
  color: white;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  font-weight: bold;
}

/* Rodapé */
.footer {
  padding: 10px;
  background: #111;
  margin-top: 20px;
  font-size: 0.9rem;
  text-align: center;
}

/* RadioGroup */
.radio-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Ordem Manual */
.manual-order {
  margin-top: 20px;
}
.grid-manual-order {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* ---------------------------
   RESPONSIVIDADE (TELAS MENORES)
--------------------------- */
@media (max-width: 767px) {
  /* Header empilha logo e nav */
  .header {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .top-nav {
    margin-right: 0;
    justify-content: center;
  }
  
  /* main-container empilha .tables-container e .controls-section */
  .main-container {
    flex-direction: column;
    align-items: center;
  }
  
  /* Tabelas ocupam 100% */
  .tables-container {
    width: 100%;
  }
  
  .orders-section,
  .logs-section {
    width: 100%;
  }
  
  .controls-section {
    width: 100%;
    min-width: auto;
  }

  /* Reduz ainda mais a fonte e padding das células em telas pequenas */
  .orders-table th, .orders-table td,
  .logs-table th, .logs-table td {
    font-size: 0.8rem;
    padding: 6px;
  }
}

/* ---------------------------
   ESTILOS PARA LOGIN E REGISTER (RESPONSIVO)
--------------------------- */
.login-container, .register-container {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-wrapper, .register-wrapper {
  display: flex;
  background: #1a1a1a;
  border-radius: 10px;
  overflow: hidden;
  max-width: 900px;
  width: 100%;
  box-shadow: 0 0 10px rgba(0, 255, 204, 0.2);
}

.login-image, .register-image {
  flex: 1;
  background: url('/static/trade-image.jpg') no-repeat center center;
  background-size: cover;
  display: none;
}

.login-form-container, .register-form-container {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-form-container h2,
.register-form-container h2 {
  margin-bottom: 20px;
  text-align: center;
}

.login-form, .register-form {
  display: flex;
  flex-direction: column;
}

.login-form label,
.register-form label {
  margin-bottom: 5px;
}

.login-form input,
.register-form input {
  margin-bottom: 15px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #333;
  color: #fff;
}

@media (min-width: 768px) {
  .login-image, .register-image {
    display: block;
  }
}

@media (max-width: 767px) {
  .login-wrapper, .register-wrapper {
    flex-direction: column;
  }
}

/* Container geral do login */
.login-container, .register-container {
  min-height: 100vh;
  display: flex;
  justify-content: center; /* centraliza horizontalmente */
  align-items: center; /* centraliza verticalmente */
  padding: 20px;
  position: relative; /* importante para sobrepor elementos */
  background: url('/static/trade-image.jpg') no-repeat center center;
  background-size: cover;
}

/* Remove o wrapper de imagem que estava atrapalhando */
.login-image, .register-image {
  display: none; /* esconde completamente, pois vamos usar imagem de fundo */
}

/* Formulário de Login centralizado */
.login-wrapper, .register-wrapper {
  width: 100%;
  max-width: 400px; /* ajuste a largura conforme desejado */
  background: rgba(26, 26, 26, 0.8); /* fundo semi-transparente opcional */
  border-radius: 10px;
  padding: 40px;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px); /* efeito de vidro fosco, opcional */
}

.login-form-container, .register-form-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
}

/* Estilo para inputs do formulário */
.login-form input,
.register-form input {
  padding: 10px;
  margin-bottom: 15px;
  border-radius: 8px;
  background: #333;
  color: #fff;
  border: none;
}

/* Transição suave para botões */
.btn {
  transition: transform 0.1s ease, background-color 0.1s ease;
}

/* Efeito hover (já existente, mas aqui reforçamos para o botão manual) */
.btn:hover {
  background: #fff;
  color: #00ffcc;
}

/* Estado pressionado: aplica transformação e cor diferente */
.btn.pressed {
  transform: translateY(4px);
  background-color: #ccc; /* Ajuste a cor conforme sua preferência */
  color: #000;
}

/* ------------------------------------------------------------------ */
/*  ADICIONE ISSO NO FINAL do arquivo  ------------------------------- */
/*  (depois de TODO o restante, inclusive do bloco "ESTILOS PARA ..." )*/
@media (max-width: 767px) {

  /* mostra o banner no mobile */
  .login-image,
  .register-image {
    display: block !important;   /* sobrescreve os 2 "display:none" */
    width: 100%;
    height: 180px;               /* ajuste a altura como preferir   */
  }

  /* garante que a imagem se ajuste bem */
  .login-image img,
  .register-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* já existe, mas reforço para empilhar imagem + formulário */
  .login-wrapper,
  .register-wrapper {
    flex-direction: column;
  }
}

/* ------------------------------------------------------------------
   Ajuste do cabeçalho no mobile
------------------------------------------------------------------ */
@media (max-width: 768px) {

  /* 1) Header vira coluna (já existia), só reforçamos espaçamentos  */
  .header {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px;
  }

  /* 2) Logo + título centralizados                                  */
  .logo-container { justify-content: center; }

  /* 3) Menu passa a ficar logo abaixo do título, ocupando toda a
        largura disponível — volta ao fluxo normal (static).        */
  .top-nav {
    position: static;          /* 🔑 tira do absolute */
    transform: none;           /* remove translateY   */
    margin: 8px 0 0;           /* topo = 8px, base = 0 */
    width: 100%;
    justify-content: center;   /* centraliza os botões */
    gap: 10px;                 /* espaço entre eles   */
    flex-wrap: wrap;           /* quebra se não couber */
  }

  /* 4) Cada botão ocupa espaço flexível, evitando quebra feia       */
  .top-nav a {
    flex: 1 1 90px;            /* min 90 px, cresce até caber */
    text-align: center;
  }
}

.bot-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  background: #9ca3af; /* unknown */
  box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.status-dot.on  { background: #16a34a; } /* verde */
.status-dot.off { background: #dc2626; } /* vermelho */
.status-dot.unknown { background: #9ca3af; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
