
.post-image {
  width: 100%;
  overflow: hidden;
  position: relative;
  margin: 15px 0;
}

.post img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  border-radius: var(--border-radius);
  border: 10px solid var(--white);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
}
/* Colori principali */
:root {
  --primary-color: #3498db;
  --primary-dark: #2980b9;
  --accent-color: #e74c3c;
  --text-color: #2c3e50;
  --light-bg: #ecf0f1;
  --white: #ffffff;
  --border-radius: 12px;
  --box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
  --lost-color: #e74c3c;
  --lost-light: #ffebee;
  --found-color: #4caf50;
  --found-light: #e8f5e9;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 20px;
  background-color: var(--light-bg);
  color: var(--text-color);
  line-height: 1.6;
}

h2 {
  text-align: center;
  color: var(--primary-dark);
  margin-bottom: 25px;
  font-size: 2.2rem;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

/* Stili per la navigazione */
nav {
  background-color: var(--white);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

.logo h1 {
  margin: 0;
  color: var(--primary-color);
  font-size: 1.8rem;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 15px;
  margin: 0;
  padding: 0;
}

.nav-links li {
  margin: 0;
}

.nav-links a {
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: var(--white);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: inline-block;
}

.nav-links a:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.nav-links a.active {
  background-color: var(--primary-dark);
  font-weight: bold;
}

/* Stili per i form */
form {
  background: var(--white);
  padding: 30px;
  border-radius: var(--border-radius);
  max-width: 600px;
  margin: 0 auto 40px auto;
  box-shadow: var(--box-shadow);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

input[type="text"],
input[type="password"],
input[type="file"],
input[type="email"],
input[type="tel"],
input[type="date"],
select,
textarea {
  width: 100%;
  margin-bottom: 15px;
  padding: 12px;
  border-radius: 8px;
  border: 2px solid #ddd;
  font-size: 16px;
  transition: border 0.3s ease;
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

textarea {
  height: 120px;
  resize: vertical;
}

button, .btn {
  padding: 12px 20px;
  background-color: var(--primary-color);
  color: var(--white);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  display: inline-block;
}

button:hover, .btn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

/* Stili per il feed */
#feed {
  max-width: 700px;
  margin: 0 auto;
}

.post {
  background: var(--white);
  margin-bottom: 30px;
  padding: 25px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
}

/* Username stilizzato */
.post .username {
  background-color: var(--accent-color);
  color: var(--white);
  padding: 8px 15px;
  border-radius: 25px;
  display: inline-block;
  margin-bottom: 20px;
  font-weight: bold;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
  letter-spacing: 0.5px;
}

/* Immagini nel post */
.post-image {
  width: 100%;
  position: relative;
  margin: 15px 0;
  overflow: hidden;
}



.post img:hover {
  transform: scale(1.02);
}

/* Descrizione del post */
.post p {
  background-color: rgba(236, 240, 241, 0.5);
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  margin: 15px 0;
}

/* Stili per le mappe */
#map, #createMap {
  height: 350px;
  margin-bottom: 30px;
  border: 10px solid var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* Stili per il footer */
footer {
  text-align: center;
  margin: 40px 0 20px 0;
}

footer button {
  padding: 12px 25px;
  font-size: 18px;
  min-width: 180px;
}

/* Messaggi e status */
.error-message {
  color: var(--accent-color);
  font-size: 0.9rem;
  background-color: var(--lost-light);
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  text-align: center;
}

.no-results {
  text-align: center;
  padding: 30px;
  background-color: var(--white);
  border-radius: var(--border-radius);
  margin: 30px 0;
  box-shadow: var(--box-shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
  color: #666;
}

/* Suggerimenti per la località */
.suggestions {
  background-color: var(--white);
  border: 2px solid #ddd;
  position: absolute;
  z-index: 10;
  width: calc(100% - 40px);
  max-height: 200px;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.suggestions div {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  transition: background-color 0.2s ease;
}

.suggestions div:hover {
  background-color: rgba(52, 152, 219, 0.1);
}

/* Stili per il ritaglio dell'immagine */
.image-container {
  max-width: 100%;
  margin-bottom: 20px;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.crop-controls {
  margin: 20px 0;
  text-align: center;
}

/* Anteprima dell'immagine ritagliata */
#previewContainer {
  text-align: center;
  background-color: rgba(236, 240, 241, 0.7);
  padding: 20px;
  border-radius: var(--border-radius);
  margin: 20px 0;
  border: 1px solid #ddd;
}

#previewContainer p {
  margin-top: 0;
  font-weight: bold;
  margin-bottom: 15px;
  color: var(--primary-dark);
}

#croppedPreview {
  border: 8px solid var(--white);
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  max-width: 300px;
  height: auto;
}

/* Stili per form di autenticazione */
.auth-container {
  background: var(--white);
  padding: 25px;
  border-radius: var(--border-radius);
  max-width: 500px;
  margin: 30px auto;
  box-shadow: var(--box-shadow);
}

.auth-container h2 {
  text-align: center;
  margin-bottom: 25px;
  color: var(--text-color);
}

.auth-form {
  display: flex;
  flex-direction: column;
}





.auth-form button:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  color: #666;
}

.auth-switch a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: bold;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* Stili per form di registrazione */
.form-row {
  display: flex;
  gap: 15px;
  margin-bottom: 0;
}

.form-col {
  flex: 1;
  position: relative;
}

.optional-field {
  color: #888;
  font-size: 0.8rem;
  margin-top: -10px;
  margin-bottom: 15px;
  display: block;
}

.auth-form label {
  display: block;
  margin-bottom: 5px;
  color: #555;
  font-size: 0.9rem;
}

/* Stili per la pagina del profilo */
.profile-header {
  background-color: var(--white);
  padding: 30px;
  border-radius: var(--border-radius);
  margin-bottom: 30px;
  box-shadow: var(--box-shadow);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.profile-header h2 {
  margin-top: 0;
  color: var(--primary-dark);
  text-align: center;
}

.profile-tabs {
  margin-bottom: 30px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

.profile-tabs a {
  padding: 12px 20px;
  background-color: var(--light-bg);
  color: var(--text-color);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.profile-tabs a:hover {
  background-color: var(--primary-color);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.profile-tabs a.active {
  background-color: var(--primary-color);
  color: var(--white);
  font-weight: bold;
}

.user-posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 25px;
  margin-bottom: 40px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.post-card {
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  background-color: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15);
}

.post-card.lost-animal {
  border-top: 4px solid var(--lost-color);
}

.post-card.found-animal {
  border-top: 4px solid var(--found-color);
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background-color: var(--light-bg);
}

.animal-status {
  font-weight: bold;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.animal-status.lost-animal {
  background-color: var(--lost-light);
  color: var(--lost-color);
}

.animal-status.found-animal {
  background-color: var(--found-light);
  color: var(--found-color);
}

.post-date {
  font-size: 0.8rem;
  color: #666;
}





.post-image img:hover {
  transform: scale(1.05);
}

.post-info {
  padding: 15px;
}

.post-info h4 {
  margin: 0 0 10px 0;
  font-size: 1.2rem;
  color: var(--text-color);
}

.location {
  font-size: 0.9rem;
  color: #666;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
  background-color: var(--white);
  margin: 5% auto;
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
  width: 80%;
  max-width: 800px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.close {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close:hover {
  color: var(--text-color);
}

.modal-header {
  padding: 15px 20px;
  margin: -30px -30px 20px -30px;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-header.lost-animal {
  background-color: var(--lost-light);
}

.modal-header.found-animal {
  background-color: var(--found-light);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--text-color);
}

.modal-image {
  text-align: center;
  margin-bottom: 25px;
  position: relative;
  overflow: hidden;
}

.modal-image img {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.modal-details p {
  margin: 12px 0;
  line-height: 1.6;
}

/* Stili per i filtri */
.filters-container {
  background-color: var(--white);
  padding: 20px;
  border-radius: var(--border-radius);
  margin-bottom: 25px;
  box-shadow: var(--box-shadow);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.filters-main-row {
  display: flex;
  gap: 20px;
}

.filters-col {
  flex: 3;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
}

.filter-group {
  flex: 1;
  min-width: 150px;
}

.filter-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-color);
}

/* Slider della distanza */
.distance-slider {
  flex: 1;
  min-width: 150px;
  max-width: 250px;
  margin-left: auto;
  border-left: 1px solid #eee;
  padding-left: 20px;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

#distanceFilter {
  flex: 1; 
}

#distanceLabel {
  min-width: 50px;
  text-align: right;
  font-weight: 500;
}

/* Ricerca località */
.location-controls {
  align-items: flex-end;
}

.location-search {
  flex: 2;
  width: 100%;
  margin-top: 10px;
}

.search-container {
  display: flex;
  margin-top: 5px;
}

#locationSearch {
  flex: 1;
  border-radius: 8px 0 0 8px;
  margin-bottom: 0;
}

#searchLocationBtn {
  padding: 12px 15px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 0;
}

/* Bottone "Usa la mia posizione" */
.my-location {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.location-btn {
  padding: 12px 15px;
  white-space: nowrap;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.location-btn:hover {
  background-color: var(--primary-dark);
}

#locationStatus {
  margin-top: 5px;
  font-size: 13px;
  color: #666;
  font-style: italic;
  display: block;
}

/* Aggiunta informazione di distanza nei post */
.distance-tag {
  display: inline-block;
  background-color: var(--primary-color);
  color: var(--white);
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.8rem;
  margin-top: 5px;
  font-weight: bold;
}

/* Stile per cerchio di raggio sulla mappa */
.radius-circle {
  stroke: var(--primary-color);
  stroke-opacity: 0.7;
  fill: var(--primary-color);
  fill-opacity: 0.1;
}

/* Stili per contrassegnare animale come trovato */
.found-sticker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  background-color: rgba(76, 175, 80, 0.8);
  color: white;
  font-weight: bold;
  padding: 10px 20px;
  z-index: 2;
}

.button-group {
  display: flex;
  margin-top: 15px;
}

.trovato-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  width: 80%;
  max-width: 200px;
  z-index: 10;
  opacity: 0.9;
}

.found-btn {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 10px 15px;
  margin-right: 10px;
  cursor: pointer;
}

/* Messaggio per il controllo touch sulla mappa */
.touch-info {
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  margin: 10px;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.user-location-marker {
  z-index: 1000;
}

/* Rendering per dispositivi mobili */
@media (max-width: 768px) {
  body {
    padding: 15px;
  }

  form, .profile-header {
    padding: 20px;
  }

  h2 {
    font-size: 1.8rem;
  }

  .post {
    padding: 18px;
  }

  #map, #createMap {
    height: 280px;
  }

  .user-posts {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
  }

  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 20px;
  }

  .modal-header {
    margin: -20px -20px 15px -20px;
  }

  nav {
    flex-direction: column;
    padding: 15px;
  }

  .logo {
    margin-bottom: 15px;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
  }

  .filters-container {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }

  .filters-row {
    flex-direction: column;
    gap: 10px;
  }

  .filter-group {
    width: 100%;
  }

  .filters-main-row {
    flex-direction: column;
  }

  .location-controls {
    flex-direction: column;
  }

  .my-location {
    margin-top: 10px;
  }
}

@media (max-width: 480px) {
  .user-posts {
    grid-template-columns: 1fr;
  }

  .profile-tabs {
    flex-direction: column;
    gap: 10px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

/* Immagini più piccole e quadrate nella pagina profilo */
.user-posts .post-image {
  aspect-ratio: 1 / 1;
  height: auto;
  max-width: 180px;
  margin: 0 auto 15px auto;
  overflow: hidden;
}

.user-posts .post-image img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
/* Stili per la selezione degli animali smarriti */
.selection-instruction {
  width: 100%;
  text-align: center;
  font-weight: bold;
  margin-bottom: 20px;
  font-size: 18px;
  color: #e74c3c; /* Colore rosso per attirare l'attenzione */
}

.pet-selection-card {
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.pet-selection-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.pet-selection-card.selected {
  border-color: #e74c3c; /* Rosso per la card selezionata */
  background-color: rgba(231, 76, 60, 0.1); /* Sfondo rosso chiaro */
}

.pet-selection-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 10px;
}

.pet-selection-card h4 {
  margin: 5px 0;
}

.pet-selection-card p {
  color: #666;
  margin-bottom: 12px;
}

.lost-pet-btn {
  background-color: #e74c3c;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
  width: 100%;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

.lost-pet-btn:hover {
  background-color: #c0392b;
}

/* Stile per il container del form che appare dopo la selezione */
#lostPetForm {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #ddd;
}
/* Stile per il modal di selezione animale */
.pets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.select-pet-card {
  cursor: pointer;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background-color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.select-pet-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border-color: #4CAF50;
}

.select-pet-card .pet-image {
  width: 100%;
  height: 180px;
  overflow: hidden;
}

.select-pet-card .pet-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.select-pet-card .pet-info {
  padding: 15px;
}

.select-pet-card h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: #333;
}

.select-pet-card p {
  margin: 0;
  font-size: 14px;
  color: #666;
}

.no-pets-message {
  text-align: center;
  padding: 20px;
}

.no-pets-message p {
  margin-bottom: 20px;
  font-size: 16px;
  color: #555;
}

/* Aggiustamenti per il modal */
#selectPetModal .modal-content {
  max-width: 800px;
  width: 90%;
}

#selectPetModal h3 {
  text-align: center;
  margin-bottom: 20px;
  color: #4CAF50;
}

/* Stile per il bottone "Animale trovato" */
.select-pet-close {
  cursor: pointer;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
}

.select-pet-close:hover {
  color: #333;
}
