/* ======================= BASE ======================= */
body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #e0e0e0; /* cinza padrão */
  font-family: 'Segoe UI', Arial, sans-serif;
}

/* ======== LOGO ======== */
#logo-container {
  position: absolute;
  top: 0;
  width: 100vw;
  height: 102px;
  background: rgba(255,255,255,0.98);
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: calc(env(safe-area-inset-top, 0px) + 10px);
}

#logo-container img {
  max-height: 88px;
  margin: 0 auto;
  display: block;
  pointer-events: none;
  width: auto;
}

/* ======== STATUS ======== */
#status {
  position: absolute;
  top: 106px;
  width: 100vw;
  text-align: center;
  padding: 4px 2px;
  background: #e8eaf6;
  font-weight: 500;
  font-size: 17px;
  z-index: 1201;
  border-bottom: 1px solid #d0d3e3;
  border-radius: 0 0 10px 10px;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  line-height: 1.25;
  min-height: calc(1em * 1.25);
}

/* ======================= FABs ======================= */
.fab {
  position: absolute;
  z-index: 1000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.19);
  font-size: 30px;
  border: none;
  outline: none;
  transition: background 0.2s, opacity 0.2s, transform 0.08s;
  cursor: pointer;
  color: #fff;
  opacity: 0.92;
}

/* Posição lateral controlada pelo body */
.fabs-left  .fab { left:  calc(15px + env(safe-area-inset-left, 0px));  }
.fabs-right .fab { right: calc(15px + env(safe-area-inset-right, 0px)); }

/* Ordem vertical */
#fabConfig   { top: 200px; background: #7a7a7a; }
#fabAccess   { top: 270px; background: #226aff; }
#fabListar   { top: 340px; background: #10b981; }
#fabQRCode   { top: 410px; background: #f59e0b; }
#fabSync     { top: 480px; background: #8f8f8f; }

.fab:active { transform: translateY(1px); }
.fab[hidden] { display: none !important; }
.fab-disabled, .fab:disabled {
  opacity: 0.45 !important;
  cursor: default !important;
  pointer-events: none !important;
}

/* ======================= MODAIS ======================= */
.modal, .modal-backdrop {
  position: fixed; top:0; left:0; width:100vw; height:100vh;
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 2000;
}
.modal-backdrop { background: rgba(0,0,0,0.35); z-index: 2001; }
.modal { z-index: 2002; pointer-events: all; }

.modal-content,
form.modal-content {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.13);
  min-width: 320px;
  width: 98vw;
  max-width: 800px;
  padding: 0;                /* conteúdo organizado por header/body/footer; padding vai lá */
  text-align: left;
  position: relative;

  /* >>> chave para footer sempre visível <<< */
  display: flex;
  flex-direction: column;
  max-height: 90vh;          /* unico limite vertical, body rola */
}

.modal-header {
  position: sticky;
  top: 0;
  background: #fff;
  padding: 12px 14px;
  border-bottom: 1px solid #ddd;
  z-index: 11;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  text-align: left;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #999;
  cursor: pointer;
}

/* Modal de cadastro de usuário */
.wide-modal {
  max-width: 800px;
  width: 95vw;
}

/* Modal com rolagem (apenas no body) */
.scrollable-modal {
  display: flex;
  flex-direction: column;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 16px 18px;  /* padding reduzido no bottom; sem necessidade de "grande sobra" */
}

.modal-footer {
  /* footer fixo dentro do modal (sem sticky) */
  background: #fff;
  padding: 10px 14px;
  text-align: right;
  border-top: 1px solid #ddd;
  box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
  z-index: 10;
}

.wide-modal h4 {
  margin-top: 6px;
  margin-bottom: 8px;
  font-size: 16px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 4px;
}

/* Campos do form mais compactos */
.form-group {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 3px;
  font-weight: 500;
  font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
  padding: 2px 4px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.form-group input { height: 26px; }
.form-group textarea { min-height: 64px; resize: vertical; }

/* Dropdowns fechados - altura maior que inputs */
.form-group select { height: 26px; }

/* Opções (dropdown) mais confortáveis */
.form-group select option {
  font-size: 14px;
  padding: 6px 8px;
  line-height: 1.6;
}

/* Inline: label + campo na mesma linha (usado em Config) */
.form-group.inline {
  flex-direction: row;
  align-items: center;
}
.form-group.inline label {
  margin: 0 8px 0 0;
  width: auto;
}
.form-group.inline select {
  flex: 1;
}

.btn-save {
  margin-top: 5px;
  padding: 8px 14px;
  background: #226aff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}
.btn-save:hover {
  background: #1a55cc;
}

/* ======================= RODAPÉ (da página) ======================= */
#footer-app {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  box-sizing: border-box;

  display: flex;
  justify-content: center;
  align-items: center;

  text-align: center;
  font-size: 12px;
  line-height: 1.2;

  padding: 6px 10px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));

  background: #d6d6d6;
  border-top: 1px solid #bcbcbc;
  color: #333;
  z-index: 1500;

  white-space: normal;
  overflow-wrap: anywhere;
}

/* ======================= BUILDER ======================= */
.builder-root .section { margin-bottom: 18px; }
.builder-root .repeat-block {
  background: #f7f7f7;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}
.form-group .invalid, .form-group input.invalid, .form-group select.invalid, .form-group textarea.invalid {
  border-color: #e53935 !important;
  box-shadow: 0 0 0 2px rgba(229,57,53,0.15);
}
