/* ===== RESET GERAL ===== */
* {
  margin-top: 0px;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #0d1117;
  font-family: 'Segoe UI', sans-serif;
  color: #ffffff;
  min-height: 100vh;
}
/* ===== NAVBAR FIXA ===== */
.navbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background-color: #1c1c1c;
  padding: 0.5rem 1rem;
  border-bottom: 2px solid #f1c40f;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 1000;
}

.welcome-bar {
  position: fixed;
  top: 60px;                  /* mesma altura da navbar */
  left: 0;
  right: 0;
  height: 40px;               /* define altura da barra */
  background-color: #0d1117;  /* fundo */
  color: #ffb300;             /* texto */
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;               /* abaixo da navbar, mas acima do conteúdo */
}

.welcome-bar * {
  margin: 0;
  padding: 0;
}

.navbar-left img {
  height: 40px;
}

.navbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #f1c40f;
  font-weight: bold;
  text-align: center;
  font-size: 1rem;
}

.navbar-center small {
  font-size: 0.85rem;
  color: white;
  font-weight: normal;
}

.navbar-right {
  margin-left: auto;
}

/* ===== LOGIN & REGISTO ===== */

h2 {
  color: #FFC107;
  margin-bottom: 20px;
}

input, select, textarea {
  width: 100%;
  padding: 12px;
  margin: 8px 0 16px 0;
  border: none;
  border-radius: 6px;
  background-color: #374151;
  color: #fff;
}

input::placeholder {
  color: #9CA3AF;
}

button {
  width: 100%;
  padding: 12px;
  background-color: #FFC107;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  color: #000;
  cursor: pointer;
  transition: background 0.3s ease;
}

button:hover {
  background-color: #e0ac00;
}

a {
  color: #FFC107;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== CONTAINER APÓS LOGIN ===== */
.app-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 40px;
  padding: 40px 20px;
  max-width: 1200px;
  margin: 100px auto 0;
}

.form-box,
.tabela-box {
  background-color: #1f2937;
  padding: 30px;
  border-left: 4px solid #FFC107;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(0,0,0,0.3);
}

/* FORMULÁRIO */
.form-box {
  flex: 1;
  min-width: 300px;
  max-width: 400px;
  margin: 0 auto;
  margin-bottom: 40px;
}

/* TABELA */
.tabela-box {
  flex: 2;
  min-width: 1200px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: #1e1e1e;
  border-radius: 10px;
  overflow: hidden;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #333;
}

th {
  background-color: #2a2a2a;
  color: #f1c40f;
}

tr:hover {
  background-color: #2f2f2f;
}

button.faturar {
  padding: 4px 8px;
  background-color: #f1c40f;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

button.faturar[disabled] {
  background-color: #777;
  cursor: not-allowed;
}
/* LOGO */
.logo {
  max-width: 120px;
  margin: 0 auto 20px;
  display: block;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal {
  display: none; /* escondido por defeito */
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);

  /* centralizar */
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #1c1c1c;
  color: white;
  padding: 20px;
  border-radius: 12px;
  width: 400px;
}
.modal-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}

.modal-buttons button {
  flex: 1;
  margin: 0 5px;
}

.modal-content label {
  display: block;
  margin-top: 10px;
  font-weight: bold;
  color: #ffffff; /* 🔹 texto claro no fundo escuro */
}

.modal-actions {
  display: flex;
  justify-content: space-between; /* 🔹 botões lado a lado */
  margin-top: 20px;
}

.modal-actions button {
  flex: 1;
  margin: 0 5px;
}

button.btn-sm {
  width: auto;
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 4px;
  margin: 6px;
  cursor: pointer;
  border: none;
}

.btn-edit {
  background-color: #ffc107;
  color: #000;
}

.btn-delete {
  background-color: #dc3545;
  color: #fff;
}

/* ===== PÁGINA RECUPERAR PASSWORD ===== */
#recoverSection {
  width: 100%;
  max-width: 400px;
  background-color: #1f2937;
  padding: 40px 30px;
  border-left: 4px solid #FFC107;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(0,0,0,0.3);
  margin: 120px auto;   /* centraliza com espaço do topo */
  text-align: center;
}

#recoverSection h2 {
  color: #FFC107;
  margin-bottom: 20px;
}

#recoverSection input {
  width: 100%;
  padding: 12px;
  margin: 8px 0 16px 0;
  border: none;
  border-radius: 6px;
  background-color: #374151;
  color: #fff;
}

#recoverSection input::placeholder {
  color: #9CA3AF;
}

#recoverSection button {
  width: 100%;
  padding: 12px;
  background-color: #FFC107;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  color: #000;
  cursor: pointer;
  transition: background 0.3s ease;
}

#recoverSection button:hover {
  background-color: #e0ac00;
}

#recoverSection a {
  display: inline-block;
  margin-top: 20px;
  color: #FFC107;
  text-decoration: none;
}

#recoverSection a:hover {
  text-decoration: underline;
}
/* ===== AJUSTES RESPONSIVOS CORRIGIDOS ===== */

  input, select, textarea, button {
    font-size: 16px;
    padding: 14px;
  }

  button {
    font-size: 16px;
  }

  /* Container depois do login */
  .app-container {
    flex-direction: column;
    gap: 20px;
    padding: 20px 10px;
    margin-top: 80px; /* mais espaço abaixo da navbar */
  }

  /* 🔹 TABELA: mais larga com scroll lateral */
  .tabela-box {
    min-width: 100%;
    overflow-x: auto;
  }

  table {
    min-width: 700px;   /* 🔹 força largura maior */
    font-size: 14px;
  }

  th, td {
    padding: 10px;
  }

  /* 🔹 Navbar mais compacta no mobile */
  .navbar {
    flex-direction: row;   /* mantém linha única */
    height: 50px;
    padding: 5px 10px;
  }

  .navbar-left img {
    height: 30px; /* logo menor */
  }

  .navbar-center {
    font-size: 0.9rem; /* título menor */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .navbar-center small {
    display: none; /* 🔹 esconde o "powered by" em telas pequenas */
  }

  .navbar-right button {
    padding: 4px 10px;
    font-size: 14px;
  }

/* Ajuste global para compensar a navbar fixa */
body {
  padding-top: 65px; /* altura da navbar (60px) + 5px extra */
}

/* Ajuste para mobile: navbar mais pequena */
@media (max-width: 768px) {
  body {
    padding-top: 55px; /* navbar ~50px */
  }
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 10px; /* espaço entre os botões */
}

.lang-dropdown {
  position: relative;
  display: inline-block;
}

.lang-menu {
  display: none;
  position: absolute;
  background: #1f2937;
  border: 1px solid #f1c40f;
  border-radius: 6px;
  top: 100%;
  left: 0;
  min-width: 100px;
  z-index: 2000;
}

.lang-menu div {
  padding: 8px 12px;
  cursor: pointer;
  color: #fff;
}

.lang-menu div:hover {
  background: #f1c40f;
  color: #000;
}

.lang-menu.show {
  display: block;
}

.lang-dropdown.open .lang-menu {
  display: block;
}

.lang-btn, 
#btnLogout{
  min-width: 90px;
  height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  border: 2px solid #f1c40f;
  background: transparent;
  color: #f1c40f;
}

/* 🔹 Botão de idioma (transparente) */
.lang-btn {
  background-color: transparent;
  border: 2px solid #ffc107;
  color: #ffc107;
}

/* 🔹 Botão de sair (amarelo) */
#btnLogout {
  background-color: #ffc107;
  border: none;
  color: #000;
}

/* 🔹 Hover para o botão Sair */
#btnLogout:hover {
  background-color: #e0ac00; /* amarelo mais escuro */
  color: #000;               /* mantém o texto preto */
  transform: scale(1.05);    /* ligeiro zoom */
  transition: all 0.2s ease-in-out;
}

/* 🔹 Hover para o botão de idioma também (para consistência) */
.lang-btn:hover {
  background-color: rgba(255, 193, 7, 0.1); /* leve fundo amarelo */
  border-color: #e0ac00;
  transform: scale(1.05);
  transition: all 0.2s ease-in-out;
}

.lang-btn img {
  width: 18px;
  height: 12px;
  margin-right: 6px; /* espaço entre bandeira e texto */
}

.lang-btn .label {
  flex: 1; /* ocupa espaço no meio */
  text-align: center; /* centraliza iniciais */
}

.lang-btn .arrow {
  margin-left: auto; /* 🔹 seta vai encostada à direita */
  font-size: 12px;
}

/* ===== FOOTER ===== */
/* FOOTER FIXO NO FUNDO */
footer {
  height: 60px; /* ajusta à tua altura real */
  display: flex;
  justify-content: center;
  align-items: center;
  background: #202a37;
  color: #aaa;
  font-size: 14px;
}

.footer-text {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  color: #ccc;
}

.footer-lang {
  margin-right: 20px;
}

/* ===== LANGUAGE SWITCHER ===== */
.lang-switcher {
  position: relative;
  display: inline-block;
}

.lang-btn {
  background: transparent;
  border: 1px solid #444;
  color: #ccc;
  padding: 4px 12px;
  font-size: 0.9rem;
  border-radius: 4px;
  cursor: pointer;
}

.lang-btn:hover {
  border-color: #666;
  color: #fff;
}

.lang-menu {
  position: absolute;
  right: 0;
  bottom: 120%;   /* 🔹 abre sempre para cima */
  top: auto;      /* 🔹 garante que nunca abre para baixo */
  background: #1e1e1e;
  border: 1px solid #444;
  border-radius: 4px;
  display: none;
  min-width: 120px;
  z-index: 100;
}

.lang-menu.show { display: block; }

.lang-menu div {
  padding: 6px 10px;
  cursor: pointer;
  color: #ccc;
}

.lang-menu div:hover {
  background: #333;
  color: #fff;
}
/* LOGIN */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(89vh - 0px); /* ocupa viewport menos a altura do footer */
  padding: 120px 20px;
  box-sizing: border-box;
  background: #0d1117; /* fundo mais uniforme */
}

.login-container form {
  background: #202a37;
  border-radius: 14px;
  padding: 30px 25px;
  text-align: center;
  width: 100%;
  max-width: 380px;
  margin: auto;
  box-sizing: border-box;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
}

/* Logo */
.login-container img {
  max-width: 120px;
  margin-bottom: 20px;
}

/* Inputs */
.login-container input {
  width: 100%;
  margin: 10px 0;
  padding: 12px 14px;
  font-size: 15px;
  border-radius: 8px;
  border: 1px solid #2f353d;
  background: #1b222d;
  color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-container input:focus {
  border-color: #ffb300;
  box-shadow: 0 0 0 3px rgba(255,179,0,0.2);
  outline: none;
}

/* Botão */
.login-container button {
  width: 100%;
  margin-top: 12px;
  padding: 13px;
  font-size: 15px;
  font-weight: bold;
  border-radius: 8px;
  border: none;
  background: #ffb300;
  color: #000;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.login-container button:hover {
  background: #e09d00;
}

.login-container button:active {
  transform: scale(0.98);
}

/* Link recuperar password */
.login-container a {
  display: inline-block;
  margin-top: 14px;
  font-size: 14px;
  color: #ffb300;
  text-decoration: none;
  transition: color 0.2s;
}

.login-container a:hover {
  color: #ffd65c;
  text-decoration: underline;
}

/* RESPONSIVO */
@media (max-width: 768px) {
  .login-container form {
    max-width: 320px;
    padding: 22px 18px;
  }

  .login-container img {
    max-width: 90px;
    margin-bottom: 15px;
  }

  .login-container input,
  .login-container button {
    font-size: 14px;
    padding: 11px;
  }
}
/* 🔹 Ações na tabela → botões lado a lado */
td button {
  display: inline-block;
  margin-right: 5px;
  margin-bottom: 0; /* para não ficarem em lista */
  vertical-align: middle;
}

/* 💰 Faturar → Verde */
.btn-faturar {
  background-color: #28a745;
  color: #fff;
}
.btn-faturar:hover {
  background-color: #218838;
}

/* ↩️ Desvalidar → Cinza */
.btn-desvalidar {
  background-color: #6c757d;
  color: #fff;
}
.btn-desvalidar:hover {
  background-color: #5a6268;
}

/* 📦 Arquivar → Vermelho */
.btn-arquivar {
  background-color: #dc3545;
  color: #fff;
}
.btn-arquivar:hover {
  background-color: #c82333;
}
/* editar*/
.motorista-form {
  margin-bottom: 20px;
}

.form-linha {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.form-linha input {
  flex: 1;
  min-width: 200px;
}

.botoes-linha {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
}

#btnAdicionarMotorista,
#btnCancelarEdicao {
  flex: 1;
  width: auto !important;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.3s ease;
}

#btnAdicionarMotorista {
  background-color: #ffc107;
  color: #000;
}

#btnAdicionarMotorista:hover {
  background-color: #e0ac00;
}

#btnCancelarEdicao {
  background-color: #ff9800;
  color: #000;
}

#btnCancelarEdicao:hover {
  background-color: #e68900;
}
/* por defeito, o botão fica escondido */
#btnCancelarEdicao {
  display: none !important;
}

/* só aparece quando o JS o ativa */
.botoes-linha #btnCancelarEdicao.show {
  display: inline-block !important;
  background-color: #ff9800;
  color: #000;
  border: none;
  font-weight: bold;
  border-radius: 6px;
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.botoes-linha #btnCancelarEdicao.show:hover {
  background-color: #e68900;
}
/* ===== CORREÇÃO: impedir scroll de fundo e centralizar modal ===== */

/* 🔹 Quando o modal está aberto, o fundo deixa de poder fazer scroll */
body.modal-open {
  overflow: hidden;
}

/* 🔹 Modal de edição — ocupa o ecrã todo e centra o conteúdo */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
}

/* 🔹 Conteúdo do modal — permite scroll interno se for grande */
.modal-content {
  background: #1c1c1c;
  color: white;
  padding: 25px;
  border-radius: 12px;
  width: 90%;
  max-width: 420px;
  max-height: 90vh; /* impede que ultrapasse o ecrã */
  overflow-y: auto; /* permite scroll dentro do modal */
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}