/* ============================================================
   GLOBAL RESET & BASE
   ============================================================ */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: system-ui, -apple-system, Arial, sans-serif;
}

/* Layout flessibile: header in alto, mappa che riempie lo spazio, footer in basso */
body {
    display: flex;
    flex-direction: column;
    background: #fafafa;
}

/* Header e footer non si comprimono */
header,
footer {
    flex-shrink: 0;
}

/* La mappa riempie tutto lo spazio libero, senza finire sotto il footer */
#map {
    flex: 1 1 auto;
    width: 100%;
    min-height: 280px;
    height: auto !important;
}

/* ============================================================
   HEADER con un solo logo (Pro Loco) e titolo centrato
   ============================================================ */
.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 10px 12px;
  gap: 8px;
}

#logo-left {
  width: 100px;
  height: auto;
}

.title-box {
  text-align: center;
  min-width: 200px;
}

#title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: #0b6e4f;
}

#subtitle {
  font-size: 0.9rem;
  color: #444;
  margin: 4px 0 0;
  font-weight: 400;
}

/* Versione mobile */
@media (max-width: 600px) {
  .header-content {
    flex-direction: column;
  }

  #logo-left {
    width: 90px;
    margin: 6px 0;
  }

  #title {
    font-size: 1.4rem;
  }

  #subtitle {
    font-size: 0.85rem;
  }

  .leaflet-popup-content {
        max-height: 55vh;
    }

  #toast {
        top: 40px;
        font-size: 14px;
        padding: 10px 16px;
    }
}

/* ============================================================
   FOOTER – nuovo layout
   ============================================================ */
footer {
    position: static !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: #f0f0f0;
    border-top: 1px solid #ddd;
    font-size: 14px;
    flex-wrap: wrap;
}

.footer-links {
    display: flex;
    gap: 16px;
    font-size: 14px;
}

footer a {
    text-decoration: underline;
    font-weight: 500;
    color: #0b6e4f;
}

#logo-footer {
    width: 60px;
    height: auto;
}

@media (max-width: 600px) {
  footer {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }

  #logo-footer {
    margin-top: 8px;
  }
}

/* ============================================================
   POPUP FORM (Leaflet)
   ============================================================ */

.leaflet-popup-content-wrapper {
    background: #ffffff !important;
    border-radius: 12px !important;
    border: 1px solid #999 !important;
    box-shadow: 0 4px 18px rgba(0,0,0,0.25) !important;
}

.leaflet-popup-tip {
    background: #ffffff !important;
    border: 1px solid #999 !important;
}

/* Limita l'altezza del contenuto del popup e abilita lo scroll interno */
.leaflet-popup-content {
    margin: 0 !important;
    padding: 16px 18px !important;
    font-size: 15px;
    line-height: 1.4;
    max-height: 60vh;
    overflow-y: auto;
}

/* Titolo del form */
#visitor-form::before {
    content: "Inserisci i tuoi dati";
    display: block;
    font-size: 17px;
    font-weight: 700;
    color: #0b6e4f;
    margin-bottom: 12px;
}

/* Label */
#visitor-form label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

/* Input */
#visitor-form input[type="text"],
#visitor-form input[type="email"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccd;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}

#visitor-form input:focus {
    border-color: #0b6e4f;
    box-shadow: 0 0 0 3px rgba(11,110,79,0.25);
}

/* Invalid state elegante */
#visitor-form input:invalid {
    border-color: #cc3333;
}

#visitor-form input:invalid:focus {
    border-color: #cc3333;
    box-shadow: 0 0 0 3px rgba(204,51,51,0.30);
}

/* Messaggio */
.leaflet-popup-content textarea[name="message"] {
  width: 100%;
  padding: 8px 10px;
  font-size: 15px;
  border: 1px solid #bbb;
  border-radius: 6px;
  resize: vertical;
  min-height: 90px;
  box-sizing: border-box;
}

.popup-info .popup-msg {
  margin: 8px 0 0;
  color: #333;
}

/* Submit button */
#visitor-form button {
    background: linear-gradient(135deg, #0b6e4f, #0c7a54);
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s, background-color .25s;
    margin-top: 8px;
}

#visitor-form button:hover {
    background: linear-gradient(135deg, #0a5a3b, #0c6c4f);
}

#visitor-form button:active {
    transform: scale(0.97);
}

/* ============================================================
   POPUP INFO (Marker)
   ============================================================ */
.popup-info {
    width: 100%;
    padding: 8px 4px;
}

.popup-info strong {
    font-size: 1.1rem;
    color: #000;
    display: block;
    margin-bottom: 6px;
}

.popup-info span {
    font-size: 0.95rem;
    color: #444;
}

.popup-info small {
    font-size: 0.85rem;
    color: #666;
}

.popup-info .remove-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 14px;
    color: #b22222;
    font-weight: 600;
    text-decoration: none;
}

.popup-info .remove-link:hover {
    text-decoration: underline;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: #0b6e4f;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 3px 12px rgba(0,0,0,0.25);
    transition: opacity .35s, transform .35s;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#toast.error { background: #cc3333; }
#toast.warning { background: #d88c00; }

/* ============================================================
   MODALE: CODICE DI CANCELLAZIONE
   ============================================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 22px;
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 0 20px rgba(0,0,0,0.30);
    position: relative;
    text-align: center;
    animation: fadeSlide .25s ease-out;
}

@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-close {
    position: absolute;
    right: 12px;
    top: 8px;
    font-size: 22px;
    cursor: pointer;
    opacity: 0.7;
}

.modal-close:hover { opacity: 1; }

#code-box {
    margin: 15px 0;
    padding: 12px;
    background: #f1f1f1;
    border-radius: 6px;
    font-size: 1.3rem;
    font-weight: bold;
    letter-spacing: 1px;
}

/* Pulsanti modale */
.modal-content button {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    border: none;
    margin-top: 6px;
    cursor: pointer;
    font-size: 15px;
}

.modal-content button.primary {
    background: #0078ff;
    color: white;
}

.modal-content button.outline {
    background: #e5e5e5;
    color: #333;
}


/* ============================================================
   INPUT MODALE CANCELLAZIONE (email + codice)
   ============================================================ */

#unsub-email,
#unsub-code {
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-top: 8px;
    box-sizing: border-box;
    height: 44px; /* più alto, più armonioso */
    transition: border-color .2s, box-shadow .2s;
}

#unsub-email:focus,
#unsub-code:focus {
    border-color: #0b6e4f;
    box-shadow: 0 0 0 3px rgba(11,110,79,0.25);
    outline: none;
}

/* ============================================================
   TABS PER LA MODALE DI RIMOZIONE
   ============================================================ */

.tabs {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.tab-btn {
    flex: 1;
    padding: 10px 12px;
    background: #ddd;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.25s;
}

.tab-btn.active {
    background: #0078ff;
    color: white;
}

.tab {
    display: none;
    text-align: left;
}

.tab.active {
    display: block;
    margin-top: 10px;
}


/* ===========================
   ANIMAZIONE RIMOZIONE MARKER
=========================== */
.marker-removing {
    animation: markerFadeOut 0.45s ease-out forwards;
}

@keyframes markerFadeOut {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.4); }
}
