/* ==========================
   Botões individuais (existing)
   ========================== */

/* Botão redondo (Detalhes) */
.btn.toggle {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  margin-left: 6px;
}

.btn.toggle:hover {
  background: #f7f7f7;
  border-color: #aaa;
  transform: scale(1.05);
}

.btn.toggle.active {
  background: var(--inst-color, #8a623f);
  color: #fff;
  border-color: var(--inst-color, #8a623f);
}

.btn.toggle .icon {
  pointer-events: none;
  font-family: monospace;
  font-size: 18px;
  line-height: 1;
}

/* ==========================
   Botão Medidas (toggle)
   ========================== */
.btn.measures-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  margin: 6px 0;
  min-width: 140px; /* largura mínima */
}

.btn.measures-toggle .icon {
  font-size: 1.2rem;
  line-height: 1;
}

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

.btn.measures-toggle.active {
  background: var(--inst-color, #8a623f);
  border-color: var(--inst-color, #8a623f);
  color: #fff;
}

.btn.measures-toggle.active .icon {
  font-size: 1.1rem;
}

/* ==========================
   Toolbar (desktop padrão)
   ========================== */
header.app .toolbar {
  display: flex;
  flex-wrap: wrap;         /* permite quebrar em mais linhas */
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

header.app .toolbar .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;                /* espaço entre ícone e legenda */
  padding: 8px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  min-width: 120px;        /* largura mínima p/ não deformar */
  height: 40px;            /* altura uniforme */
  background: #fff;
  transition: all 0.2s ease;
}

header.app .toolbar .btn .icon {
  font-size: 1.1rem;
}

/* Hover/active */
header.app .toolbar .btn:hover {
  background: #f6f2ec;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Botão principal */
header.app .toolbar .btn.primary {
  background: var(--inst-color, #8a623f);
  border-color: var(--inst-color, #8a623f);
  color: #fff;
}
header.app .toolbar .btn.primary:hover {
  background: #7a5637;
}

/* Modal (mantido) */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 20px;
}

.modal[aria-hidden="false"] {
  display: flex;
}

.modal-dialog {
  background: #fff;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  text-align: left;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-dialog h2 {
  margin-top: 0;
  font-size: 1.3rem;
  color: var(--inst-color, #8a623f);
}

.btn-close {
  display: inline-block;
  margin-top: 15px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: var(--inst-color, #8a623f);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.btn-close:hover {
  background: #6d4d31;
}

/* ==========================
   Import/Export compact dropdowns
   ========================== */

/* container of the two dropdowns */
.br-group {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  position: relative;
}

/* use the same button style, but summary needs reset */
.br-dropdown {
  position: relative;
}

/* summary behave like a button */
.br-dropdown > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
}

/* hide default triangle in browsers that show it */
.br-dropdown > summary::-webkit-details-marker { display:none; }

/* menu */
.br-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid #ddd;
  padding: 8px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
  min-width: 220px;
  z-index: 1200;
  display: none; /* visual control via details[open] */
}

/* show menu when details open */
.br-dropdown[open] .br-menu {
  display: block;
}

/* menu buttons re-use .btn but look flat */
.br-menu .btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: 6px;
  color: #222;
  font-weight: 500;
}

/* hover inside menu */
.br-menu .btn:hover {
  background: #f5f5f5;
}

/* small hint under import buttons */
.br-menu .hint {
  display: block;
  margin-top: 8px;
  color: #666;
  font-size: 12px;
}

/* planHint visibility helpers */
#planHint.plan-hint-hidden {
  display: none !important;
  opacity: 0;
  transition: opacity .22s ease;
}
#planHint.plan-hint-visible {
  display: inline-block !important;
  opacity: .9;
  transition: opacity .22s ease;
  color: #6b3f1f;
  background: rgba(138,98,63,0.06);
  padding: 6px 8px;
  border-radius: 6px;
  margin-left: 8px;
  font-size: 0.95rem;
}

/* botão PWA install (mover deste style inline) */
#btnInstall {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: #8a623f;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 1em;
  font-weight: 500;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: background 0.25s ease, transform 0.15s ease;
  z-index: 9999;
}

#btnInstall:hover { background: #5c3b1e; transform: scale(1.04); }
#btnInstall:active { transform: scale(0.98); }
#btnInstall[hidden] { display: none !important; } /* reforça hidden */



/* compact behaviour for small screens: menus go full width under button */
@media (max-width: 480px) {
  .br-menu {
    position: static;
    box-shadow: none;
    border: 1px solid #eee;
    min-width: 160px;
    margin-top: 8px;
    width: 100%;
  }
  .br-group { width: 100%; justify-content: center; }
  header.app .toolbar { justify-content: center; gap: 8px; }
}

/* ==========================
   Responsividade geral
   ========================== */
@media (max-width: 768px) {
  .btn.measures-toggle {
    flex: 1 1 45%;
    max-width: 220px;
  }

  header.app .toolbar {
    justify-content: center;
    gap: 8px;
  }

  header.app .toolbar .btn {
    flex: 1 1 45%;
    min-width: unset;
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .btn.measures-toggle {
    flex: 1 1 100%;
    max-width: none;
  }

  header.app .toolbar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
  }

  header.app .toolbar .btn {
    flex: unset;
    width: 100%;
    max-width: none;
  }
}
