/* Ensure full viewport height for canvas-based overlays */
/* MilkyGrid — Brand font (self-hosted): Quicksand */
@font-face {
  font-family: "Quicksand";
  src: url("../assets/fonts/Quicksand/Quicksand-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Quicksand";
  src: url("../assets/fonts/Quicksand/Quicksand-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Quicksand";
  src: url("../assets/fonts/Quicksand/Quicksand-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Quicksand";
  src: url("../assets/fonts/Quicksand/Quicksand-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --mf-font-primary: "Quicksand", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  /* Bootstrap font override */
  --bs-body-font-family: var(--mf-font-primary);
  --bs-heading-font-family: var(--mf-font-primary);
}
html, body {
  width: 100%;
  height: 100%;
  font-family: var(--mf-font-primary);
}

/* Global header layout (from index.html) */
header:not(.navbar) {
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 10px 24px;
}

/* Global header theme for Bootstrap navbars (used by injected header.html) */
nav.navbar {
  background: rgba(0, 0, 0, 0.75) !important;
}

nav.navbar .navbar-brand {
  font-size: 1.66em;
  font-weight: normal;
  font-family: var(--mf-font-primary);
  color: rgba(255, 255, 255, 0.8) !important;
}

nav.navbar .navbar-nav .nav-link,
nav.navbar .navbar-nav .dropdown-toggle {
  color: rgba(255, 255, 255, 0.8) !important;
  font-weight: normal;
}

nav.navbar .navbar-nav .nav-link:hover,
nav.navbar .navbar-nav .dropdown-toggle:hover {
  color: #ffcc00 !important;
}

nav.navbar .dropdown-menu {
  background: rgba(0, 0, 0, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

nav.navbar .dropdown-menu .dropdown-item {
  color: #fff;
  font-weight: normal;
}

nav.navbar .dropdown-menu .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #ffcc00;
}

nav.navbar .dropdown-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

header:not(.navbar) div {
  font-size: 1.66em;
  font-weight: normal;
  font-family: var(--mf-font-primary);
  color: rgba(255, 255, 255, 0.8);
}

header:not(.navbar) nav {
  display: flex;
  flex: 1;
  justify-content: center;
}

header:not(.navbar) nav a {
  color: white;
  margin-left: 20px;
  text-decoration: none;
}

header:not(.navbar) nav a:hover {
  color: #ffcc00;
}

header:not(.navbar) div:nth-child(3) {
  margin-left: auto;
}

header:not(.navbar) select {
  margin-left: 20px;
  padding: 4px 8px;
  font-size: 0.9em;
}

/* Responsive header from index.html */
@media (max-width: 768px) {
  header:not(.navbar) {
    flex-direction: column;
    align-items: flex-start;
  }

  header:not(.navbar) nav {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  nav.navbar {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  nav.navbar .navbar-brand {
    font-size: 1.36em;
  }
}

/* Bootstrap navbar (hamburger) — improve mobile tap target and avoid overlays stealing taps */
.navbar .navbar-toggler {
  padding: 10px 12px;
  border: 0;
  outline: none;
  box-shadow: none;
  position: relative;
  z-index: 3000;
  pointer-events: auto;
}

.navbar .navbar-toggler-icon {
  width: 1.6em;
  height: 1.6em;
}

.dropdown-select {
  padding: 6px;
  border-radius: 8px !important;
  border: 1px solid #ccc;
  font-size: 14px;
  background-color: rgba(255, 255, 255, 0.7) !important;
  width: 100%;
  max-width: 128px;
  height: 36px;
  line-height: 36px;
  color: black;
  cursor: pointer;
}
.nutri-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px; /* vertical gap reduced from 14px */
  align-items: flex-start;
  margin-bottom: 14px; /* reduced from 20px */
  margin-left: 24px; /* Substitui padding-left para alinhamento consistente */
}

.nutri-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 120px;
  max-width: 128px;
  margin-bottom: 6px; /* reduced from 12px */
}

.form-section {
  margin-left: 24px; /* Substitui padding-left para alinhamento consistente */
  margin-bottom: 12px; /* add if not present, to control spacing between sections */
}

.nutri-input {
  padding: 6px;
  border-radius: 8px !important;
  border: 1px solid #ccc;
  font-size: 14px;
  transition: background-color 0.3s ease;
  width: 100%;
  max-width: 96px; /* Alterado de 120px para 96px */
}

.nutri-input.desabilitado {
  background-color: rgba(180, 180, 180, 0.7) !important;
}

.nutri-input:not(.desabilitado) {
  background-color: rgba(255, 255, 255, 0.7) !important;
  color: black !important;
}

/* Producer and date in light mode */
.producer-name,
.date-added {
  color: black !important;
}

.checkbox-label {
  margin-left: 10px;
  font-size: 14px;
}

.nutri-section-header {
  width: 100%;
  font-weight: bold;
  font-size: 14px;
  margin: 4px 0 4px 0;
  padding-left: 2px;
  text-align: left;
  line-height: 1.4;
  letter-spacing: 0.3px;
}

.nutri-divider {
  border: none;
  border-top: 1px solid #999;
  margin: 5px 0 5px 0;
  width: 100%;
}

.food-name-input {
  padding: 6px;
  border-radius: 8px !important;
  border: 1px solid #ccc !important;
  font-size: 14px !important;
  background-color: rgba(255, 255, 255, 0.7) !important;
  width: 100% !important;
  height: 36px !important;
  max-width: 420px !important;
  color: black !important;
  line-height: 36px !important;
  box-sizing: border-box !important;
}

.category-select {
  padding: 6px;
  border-radius: 8px !important;
  border: 1px solid #ccc;
  font-size: 14px;
  transition: background-color 0.3s ease;
  background-color: rgba(255, 255, 255, 0.7) !important;
  width: 100%;
  max-width: 220px;
  height: 40px;
  line-height: 40px;
  color: white !important;
}

@media (prefers-color-scheme: dark) {
  .dropdown-select {
    background-color: rgba(0, 0, 0, 0.5) !important;
    color: white !important;
    border-color: #ccc !important;
  }
  .category-select {
    background-color: rgba(0, 0, 0, 0.5) !important;
    color: white !important;
    border-color: #ccc !important;
    height: 40px;
    line-height: 40px;
  }
  select.category-select option {
    background-color: rgba(0, 0, 0, 0.9);
    color: white !important;
  }
  .nutri-input:not(.desabilitado) {
    background-color: rgba(0, 0, 0, 0.5) !important;
    color: white !important;
  }

  .food-name-input {
    background-color: rgba(0, 0, 0, 0.5) !important;
    color: white !important;
    border-color: #ccc !important;
  }

  .nutri-field label,
  .checkbox-label,
  .nutri-section-header,
  .food-name-label,
  .nutri-field label:first-of-type {
    color: white !important;
  }

  /* Producer and date in dark mode */
  .producer-name,
  .date-added {
    color: white !important;
  }

  :root {
    --nutri-header-color: #eee5e5;
  }

  .mf-footer {
    background: transparent;
    color: #fff;
  }
}

.food-name-label {
  display: flex;
  align-items: center;
  font-size: 16px;
  margin-right: 12px;
  margin-left: 24px; /* Alinhamento com a margem dos campos */
}

.nutri-field label:first-of-type {
  font-size: 0.85em !important;
  font-weight: normal !important;
}

:root {
  --nutri-header-color: #444;
}

/* Remove setas dos inputs numéricos */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  appearance: textfield;
  -moz-appearance: textfield;
}

/* Estilo base para botões da lista */
.listButtons {
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0.7;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

/* Botão de apagar (vermelho escuro) */
button.listButtons.delete-button {
  background-color: #8B0000 !important;
  color: white !important;
}

/* Botão de editar (cinza claro) */
button.listButtons.edit-button {
  background-color: #d3d3d3 !important;
  color: black !important;
}

/* Adaptação para modo escuro */
@media (prefers-color-scheme: dark) {
  button.listButtons.delete-button {
    background-color: #aa2e2e !important;
    color: white !important;
  }

  button.listButtons.edit-button {
    background-color: #666 !important;
    color: white !important;
  }
}
/* Garantir que o contêiner do mapa Leaflet herde altura e largura corretamente */
.leaflet-container {
  width: 100% !important;
  height: 100% !important;
  z-index: 0;
}

.autocomplete-list {
  list-style: none;
  margin: 0;
  padding: 4px;
  border: 1px solid #ccc;
  background: white;
  position: absolute;
  z-index: 999;
  max-height: 150px;
  overflow-y: auto;
  width: 100%;
  font-size: 0.9em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  border-radius: 4px;
}

.autocomplete-list li {
  padding: 6px 10px;
  cursor: pointer;
}

.autocomplete-list li:hover {
  background-color: #f0f0f0;
}

/* Remove o ícone automático de preenchimento de contato (ícone do "boneco") nos inputs de endereço no Safari/Chrome */
input::-webkit-contacts-auto-fill-button {
  display: none !important;
}
/* Classe reutilizável para unificar inputs e selects dos formulários */
.form-field-input {
  padding: 6px;
  border-radius: 8px !important;
  border: 1px solid #ccc !important;
  font-size: 14px !important;
  background-color: rgba(255, 255, 255, 0.7) !important;
  width: 100% !important;
  height: 36px !important;
  max-width: 220px !important;
  color: black !important;
  line-height: 36px !important;
  box-sizing: border-box !important;
}

@media (prefers-color-scheme: dark) {
  .form-field-input {
    background-color: rgba(0, 0, 0, 0.5) !important;
    color: white !important;
    border-color: #ccc !important;
  }
}
/* Estilo para o contêiner do mapa de revendedores */
.dealer-map-container {
  width: 100%;
  max-width: 420px;
  height: auto;
  min-height: 420px;
  aspect-ratio: 1 / 1;
  margin-top: 32px;
  margin-left: 16px;
  border-radius: 8px;
  border: 1px solid #ccc;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  position: relative;
}

@media (prefers-color-scheme: dark) {
  .dealer-map-container {
    border-color: #666;
  }
}

.vertical-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Global footer style */
.mf-footer {
  position: fixed; /* iOS Safari landscape: more stable than absolute */
  left: 0;
  right: 0;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  padding: 4px 0;
  background: transparent;
  color: #fff;
  text-align: center;
  margin-top: 0;
  z-index: 1500; /* above background, below navbar toggler (3000) */
  pointer-events: none; /* evita interferir com cliques no conteúdo; o texto reabilita abaixo */
  transform: translateZ(0); /* reduce iOS reflow jitter */
}

.mf-footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 12px;
}

.mf-footer-text {
  font-size: 0.8rem; /* ~30% menor que 0.85rem */
  opacity: 0.9;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
  margin: 0;
  display: inline-block;
  pointer-events: auto; /* permite seleção/cópia do texto, se necessário */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  .mf-footer {
    background: transparent;
    color: #fff;
  }
}

/* MilkyGrid — Responsive background helpers (reusable across pages) */
.mf-hero-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative; /* allow overlay stacking contexts on hero pages */
  isolation: isolate; /* keep blend effects contained and predictable */
}

/* Hero Grid Overlay (canvas) — subtle white semi-transparent grid */
#gridOverlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1; /* above background, below all UI */
  mix-blend-mode: lighten;
  opacity: 0.95;          /* increased global visibility */
  filter: blur(0.05px) drop-shadow(0 0 1px rgba(0,0,0,0.35));
  transform: translateZ(0);
}

/* Ensure foreground content stays above the grid overlay */
.overlay,
.mf-hero-foreground {
  position: relative;
  z-index: 2;
}

/* Accessibility: honor reduced motion */
@media (prefers-reduced-motion: reduce) {
  #gridOverlay {
    opacity: 0.35;
  }
}

/* Holandesa */
.mf-hero-bg--holandesa {
  background-image: url('../assets/Holandesa.png');
}

@media (orientation: portrait) {
  .mf-hero-bg--holandesa {
    background-image: url('../assets/Holandesa-mobile.png');
  }
}

/* Pardo Suíço (optional parity with index.html pattern) */
.mf-hero-bg--pardo {
  background-image: url('../assets/PardoSuico.png');
}

@media (orientation: portrait) {
  .mf-hero-bg--pardo {
    background-image: url('../assets/PardoSuico-Mobile.png');
  }
}
/* Light mode override for header menu colors */
@media (prefers-color-scheme: light) {
  nav.navbar .navbar-nav .nav-link,
  nav.navbar .navbar-nav .dropdown-toggle {
    color: rgba(0, 0, 0, 0.8) !important;
  }

  nav.navbar .navbar-nav .nav-link:hover,
  nav.navbar .navbar-nav .dropdown-toggle:hover {
    color: #ffcc00 !important;
  }
}