/* Modern Feed App CSS - Solo stili specifici del Feed */
/* HEADER CUSTOM RIMOSSO - USA QUELLO GLOBALE. */

/* Main Content Specifico del Feed - aggiusta margin per header globale */
.main-content,
.container {
  margin-top: 20px; /* Ridotto perché header globale è sticky */
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 30px 20px 120px;
}

/* Filters Section */
.filters-section {
  background: var(--surface);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.filters-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.filter-select, .filter-input {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: var(--surface);
}

.filter-select:focus, .filter-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.distance-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.distance-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border-light);
  outline: none;
  -webkit-appearance: none;
}

.distance-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gradient);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.distance-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gradient);
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow);
}

.distance-label {
  font-weight: 600;
  color: var(--primary-color);
  min-width: 60px;
  text-align: center;
  background: rgba(14, 165, 233, 0.1);
  padding: 4px 8px;
  border-radius: 8px;
}

/* Location Section - Specifico del Feed */
.location-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.location-search {
  display: flex;
  gap: 8px;
  width: 100%;
}

.location-input {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  min-width: 0; /* Previene overflow */
}

.location-status {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 8px;
  background: var(--surface-dark);
  border-radius: 8px;
  margin-top: 12px;
}

/* Map Container */
.map-container {
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

#map {
  height: 300px;
  width: 100%;
}

/* Feed Section */
.feed-section {
  display: grid;
  gap: 20px;
}

.post {
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  max-width: 600px; /* Limita la larghezza massima */
  margin: 0 auto; /* Centra i post */
}

.post:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.post-header {
  padding: 20px 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.username {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.animal-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lost-animal {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.found-animal {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.normal-animal {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.post-image {
  margin: 16px 0;
  padding: 0 20px;
}

.post-image img {
  width: 100%;
  aspect-ratio: 1 / 1; /* Forza proporzioni quadrate */
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.post-content {
  padding: 0 20px 20px;
}

.post-content p {
  margin-bottom: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.post-content strong {
  color: var(--text-primary);
}

.location {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.distance-tag {
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary-color);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.post-actions {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border-light);
  margin-top: 16px;
  padding-top: 16px;
}

.contact-user-btn {
  width: 100%;
  padding: 14px;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow);
}

.contact-user-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

/* Error and No Results */
.error-message,
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  margin: 20px 0;
}

.error-message {
  color: var(--danger-color);
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.2);
}

/* Map Popup Styles */
.marker-popup {
  font-size: 0.9rem;
  line-height: 1.4;
}

.popup-chat-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 8px;
}

/* Touch Info */
.touch-info {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  transition: opacity 0.3s ease;
}

/* Responsive Design - Solo override specifici del Feed */
@media (min-width: 768px) {
  .feed-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
  }
  
  .post {
    max-width: 500px;
    justify-self: center;
  }
  
  .filters-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 0 16px;
  }
  
  .filters-grid {
    grid-template-columns: 1fr;
  }
  
  .location-section {
    flex-direction: column;
    gap: 12px;
  }
  
  .post-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Animations */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post {
  animation: slideUp 0.3s ease;
}

/* Leaflet overrides for modern look */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow) !important;
}

.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text-primary) !important;
  font-size: 1.2rem !important;
  border-radius: 8px !important;
  margin: 2px !important;
  transition: all 0.2s ease !important;
}

.leaflet-control-zoom a:hover {
  background: var(--surface-dark) !important;
  transform: scale(1.05) !important;
}
/* Chat Badge - Contatore chat non lette */
.chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #16a34a;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    border: 2px solid white;
    z-index: 10;
}

/* Nascondi badge quando 0 */
.chat-badge.hidden {
    display: none;
}

/* Container per posizionamento relativo */
.nav-links li {
    position: relative;
}
