/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

/* RESET BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'DM Sans', Arial, sans-serif;
  color: #222;
  background: rgb(255, 249, 239);
  font-size: 1.1rem;
}

ul, ol {
  list-style: none;
}

/* Rimuovi blu su link */
a, button {
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

a:focus, button:focus {
  outline: none;
}

a:active, button:active {
  opacity: 0.8;
}

/* HEADER - Rimosso (usa WordPress header) */
/*
.site-header {
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 0.8rem 2rem;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav .logo {
  font-size: 1.6rem;
  font-weight: bold;
  text-decoration: none;
  color: #111;
}
.nav .menu {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}
.nav .menu a {
  text-decoration: none;
  color: #222;
  font-weight: 500;
}
.nav .menu a:hover {
  color: #AE5434;
}
*/

/* HERO */
.hero-listings {
  text-align: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
  height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-listings::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('sfondo_annunci.jpeg') center/cover no-repeat;
  filter: sepia(0.6) ;
  z-index: 0;
}
.hero-listings::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
}
.hero-listings h1 {
  font-family: 'Fraunces', Georgia, "Times New Roman", serif;
  font-size: 80px;
  color: #FFFFFF !important;
  line-height: 1.3em;
  margin-bottom: .4rem;
  font-weight: bold;
}
.hero-listings p {
  color: #FFFFFF;
  font-family: 'DM Sans', sans-serif;
  font-size: 2rem;
  font-weight: bold;
}

/* GRIGLIA ANNUNCI */
.listings-container {
  display: grid;
  gap: 1.8rem;
  padding: 2rem;
  grid-template-columns: repeat(3, 1fr);
  background: rgb(255, 249, 239);
}

/* Responsive: 2 colonne su tablet, 1 su mobile */
@media (max-width: 992px) {
  .listings-container {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .listings-container {
    grid-template-columns: 1fr;
  }
}

/* CARD IMMOBILE */
.listing-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow .2s ease;
  display: flex;
  flex-direction: column;
}
.listing-card:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.listing-image img {
  width: 100%;
  height: 190px;
  object-fit: cover;
}

.listing-info {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}
.listing-title {
  font-size: 1.4rem;
  margin-bottom: .5rem;
  font-weight: bold;
}
.listing-price {
  color: #AE5434;
  font-weight: bold;
  margin-bottom: 0.6rem;
  font-size: 1.7rem;
}
.listing-details {
  list-style: none;
  margin-bottom: 1rem;
  color: #555;
  position: relative;
  z-index: 1;
}
.listing-details li {
  font-size: 1.05rem;
  margin-bottom: .3rem;
}
.btn-details {
  display: block;
  width: 100%;
  margin: 0 auto;
  padding: .6rem 1rem;
  background: #AE5434;
  color: #fff;
  text-decoration: none;
  border-radius: 16px;
  font-size: 1.05rem;
  text-align: center;
}
.btn-details:hover {
  background: rgba(80, 52, 0, 0.9);
}

/* FOOTER - Rimosso (usa WordPress footer) */
/*
.site-footer {
  text-align: center;
  padding: 1rem;
  border-top: 1px solid #ddd;
  font-size: .9rem;
  color: #555;
}
*/

/* LOADING & ERROR */
.loading, .error, .no-results {
  text-align: center;
  padding: 3rem 2rem;
  font-size: 1.3rem;
  color: #555;
  grid-column: 1 / -1;
}

.loading {
  color: #AE5434;
}

.loading::after {
  content: '...';
  display: inline-block;
  animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

.error {
  color: #cc0000;
  background: #ffe6e6;
  border: 1px solid #cc0000;
  border-radius: 8px;
  margin: 2rem;
}

.no-results {
  color: #888;
}

/* BADGE CONTRATTO */
.listing-image {
  position: relative;
}

.listing-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(80, 52, 0, 0.9);
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: bold;
  text-transform: uppercase;
  z-index: 3;
}

/* EXCERPT */
.listing-excerpt {
  color: #666;
  font-size: 1rem;
  margin: 0.8rem 0;
  line-height: 1.4;
}

/* DETAILS GRID */
.details-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 12px;
  margin-top: 1rem;
}
.details-grid-key {
  color: #444;
  font-weight: 600;
}
.details-grid-val {
  color: #222;
}

/* DETAIL PAGE */
.detail-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  background: rgb(255, 249, 239);
}
.detail-card {
  background: transparent;
}
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #AE5434 !important;
  border: none;
  border-radius: 16px !important;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: white !important;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(174, 84, 52, 0.3);
}
.btn-back:hover {
  background: #AE5434 !important;
  transform: translateY(-2px);
  box-shadow: none;
}
.detail-card .listing-image {
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}
.detail-card .carousel-item img {
  height: 500px;
  object-fit: cover;
}
.detail-card .listing-info {
  padding: 2rem;
}
.detail-card h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #AE5434;
  padding-bottom: 0.5rem;
}

/* CAROUSEL */
.carousel {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid #eee;
}
.carousel-track {
  display: flex;
  transition: transform .3s ease;
  will-change: transform;
}
.carousel-item {
  min-width: 100%;
}
.carousel-item img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
}
.carousel-item img:hover {
  opacity: 0.9;
}
.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.carousel-nav.prev { left: 10px; }
.carousel-nav.next { right: 10px; }
.carousel-nav:disabled { opacity: .4; cursor: default; }
.carousel-indicator {
  position: absolute;
  bottom: 8px;
  right: 10px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 2px 8px;
  font-size: .9rem;
  border-radius: 10px;
}

/* FILTRI */
.filters-section {
  padding: 2rem;
  background: rgba(240, 230, 215, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid #ddd;
  position: relative;
  z-index: 10;
}
.filters-container {
  max-width: 1200px;
  margin: 0 auto;
}
.filters-container h2 {
  margin-bottom: 1.5rem;
  font-size: 2rem;
  color: #333;
}
.filters-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.filter-group {
  display: flex;
  flex-direction: column;
  position: relative;
}
.filter-group label {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #555;
}
.filter-group input,
.filter-group select {
  padding: 0.6rem;
  font-size: 1.1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}
.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: #AE5434;
}
.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 1rem;
  justify-content: flex-start;
  margin-top: 0.5rem;
}
.btn-primary, .btn-secondary {
  padding: 0.7rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s;
}
.btn-primary {
  background: #AE5434;
  color: #fff;
}
.btn-primary:hover {
  background: rgba(80, 52, 0, 0.9);
}
.btn-secondary {
  background: #ddd;
  color: #333;
}
.btn-secondary:hover {
  background: #ccc;
}

/* AUTOCOMPLETE */
.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-top: none;
  max-height: 250px;
  overflow-y: auto;
  z-index: 2000;
  display: none;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.autocomplete-results.show {
  display: block;
}
.autocomplete-item {
  padding: 0.7rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.autocomplete-item:hover,
.autocomplete-item.selected {
  background: #f5f5f5;
}
.autocomplete-item:last-child {
  border-bottom: none;
}
.autocomplete-item strong {
  color: #AE5434;
}

/* PAGINAZIONE */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  grid-column: 1 / -1;
}
.pagination button {
  padding: 0.6rem 1.2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border: 1px solid #AE5434;
  background: #fff;
  color: #AE5434;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s;
}
.pagination button:hover:not(:disabled) {
  background: #AE5434;
  color: #fff;
}
.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: #ccc;
  color: #999;
}
.pagination-info {
  font-size: 1.05rem;
  color: #555;
  font-weight: 500;
}
/* ============================================
   RESPONSIVE DESIGN - MOBILE
   ============================================ */

/* Tablet e schermi medi (max 992px) */
@media (max-width: 992px) {
  .hero-listings h1 {
    font-size: 60px;
  }
  
  .hero-listings p {
    font-size: 1.5rem;
  }
  
  .detail-container {
    padding: 1rem;
  }
  
  .detail-card .listing-info {
    padding: 1.5rem;
  }
  
  .detail-card .carousel-item img {
    height: 350px;
  }
}

/* Mobile (max 768px) */
@media (max-width: 768px) {
  body {
    font-size: 1rem;
  }
  
  .hero-listings {
    height: 30vh;
    padding: 1rem;
  }
  
  .hero-listings h1 {
    font-size: 40px;
  }
  
  .hero-listings p {
    font-size: 1.2rem;
  }
  
  /* Dettaglio immobile - riduce padding e font */
  .detail-container {
    padding: 0.5rem;
    max-width: 100%;
  }
  
  .detail-card .listing-info {
    padding: 1rem;
  }
  
  .detail-card .carousel-item img {
    height: 250px;
  }
  
  /* Titoli più piccoli */
  .detail-card h3,
  .listing-info h3 {
    font-size: 1.1rem !important;
    margin-top: 1.5rem !important;
  }
  
  /* Font size ridotto nelle card */
  .listing-info div[style*="font-size: 1.8em"] {
    font-size: 1.4em !important;
  }
  
  .listing-info div[style*="font-size: 1.3rem"] {
    font-size: 1.1rem !important;
  }
  
  .listing-info div[style*="font-size: 1.2rem"] {
    font-size: 1rem !important;
  }
  
  .listing-info div[style*="font-size: 1.3em"] {
    font-size: 1.1em !important;
  }
  
  /* Padding ridotto nelle card */
  .listing-info div[style*="padding: 2rem"] {
    padding: 1rem !important;
  }
  
  /* Grid responsive */
  .listing-info div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  
  /* Descrizione */
  .listing-info div[style*="line-height: 1.8"] {
    font-size: 1rem !important;
    line-height: 1.6 !important;
  }
  
  /* Accessori più compatti */
  .listing-info span[style*="padding: 6px 12px"] {
    font-size: 0.85rem !important;
    padding: 4px 8px !important;
  }
  
  /* Carosello nav più piccoli */
  .carousel-nav {
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
  }
  
  .carousel-indicator {
    font-size: 0.8rem;
    padding: 2px 6px;
  }
  
  /* Filtri responsive */
  .filters-section {
    padding: 1rem;
  }
  
  .filters-container h2 {
    font-size: 1.5rem;
  }
  
  .filters-form {
    grid-template-columns: 1fr;
  }
  
  .filter-group input,
  .filter-group select {
    font-size: 1rem;
  }
  
  .btn-primary,
  .btn-secondary {
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
  }
  
  /* Listing card */
  .listing-title {
    font-size: 1.2rem;
  }
  
  .listing-price {
    font-size: 1.4rem;
  }
  
  .listing-details li {
    font-size: 0.95rem;
  }
  
  /* Paginazione */
  .pagination {
    padding: 1rem;
    gap: 0.5rem;
  }
  
  .pagination button {
    padding: 0.5rem 1rem;
    font-size: 1rem;
  }
  
  .pagination-info {
    font-size: 0.95rem;
  }
}

/* Mobile piccolo (max 480px) */
@media (max-width: 480px) {
  body {
    font-size: 0.95rem;
  }
  
  .hero-listings h1 {
    font-size: 32px;
  }
  
  .hero-listings p {
    font-size: 1rem;
  }
  
  .detail-container {
    padding: 0;
  }
  
  .detail-card .listing-info {
    padding: 0.75rem;
  }
  
  .detail-card .carousel-item img {
    height: 200px;
  }
  
  .detail-card h3,
  .listing-info h3 {
    font-size: 1rem !important;
    margin-top: 1rem !important;
  }
  
  /* Font ancora più piccoli */
  .listing-info div[style*="font-size: 1.8em"] {
    font-size: 1.2em !important;
  }
  
  .listing-info div[style*="padding: 2rem"] {
    padding: 0.75rem !important;
  }
  
  .listing-info div[style*="gap: 1.5rem"] {
    gap: 0.75rem !important;
  }
  
  /* Icone più piccole */
  .listing-info div[style*="width: 3rem"] {
    width: 2.5rem !important;
  }
  
  .listing-title {
    font-size: 1.1rem;
  }
  
  .listing-price {
    font-size: 1.2rem;
  }
  
  .carousel-nav {
    width: 24px;
    height: 24px;
    font-size: 1rem;
  }
}
/* ==================== LIGHTBOX ==================== */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.lightbox.active {
  display: flex;
}

.lightbox-image {
  max-width: 90%;
  max-height: 90vh;
  object-fit: contain;
  user-select: none;
  touch-action: none;
  transition: transform 0.3s ease-out;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  background: transparent;
  border: none;
  color: white;
  font-size: 50px;
  font-weight: 300;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: transform 0.2s;
  z-index: 10001;
}

.lightbox-close:hover {
  transform: scale(1.2);
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: white;
  font-size: 60px;
  font-weight: 300;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  z-index: 10001;
}

.lightbox-prev {
  left: 30px;
}

.lightbox-next {
  right: 30px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev:disabled,
.lightbox-next:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.lightbox-counter {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 1rem;
  z-index: 10001;
}

.lightbox-counter::after {
  content: '';
  display: none;
}

@media (max-width: 768px) {
  .lightbox-counter::after {
    content: ' • Pizzica per zoomare';
    display: inline;
    opacity: 0.7;
    font-size: 0.85rem;
  }
}

/* Responsive lightbox */
@media (max-width: 768px) {
  .lightbox-image {
    max-width: 95%;
    max-height: 80vh;
  }
  
  .lightbox-close {
    top: 10px;
    right: 15px;
    font-size: 40px;
  }
  
  .lightbox-prev,
  .lightbox-next {
    width: 45px;
    height: 45px;
    font-size: 40px;
  }
  
  .lightbox-prev {
    left: 10px;
  }
  
  .lightbox-next {
    right: 10px;
  }
  
  .lightbox-counter {
    bottom: 15px;
    font-size: 0.9rem;
    padding: 8px 15px;
  }
}
