/**
 * Simple Locator WooCommerce Filter - Estilos CSS
 * Autor: David William da Costa
 * Versão: 0.1.0
 */

/* ========================================
   ESTILOS GERAIS DO PLUGIN
   ======================================== */

.simple-locator-products-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ========================================
   GRID DE PRODUTOS
   ======================================== */

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 100%;
}

/* Responsividade */
@media (max-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ========================================
   CARDS DE PRODUTOS
   ======================================== */

.product-item {
  border: 1px solid #ddd;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: #fff;
}

.product-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* ========================================
   IMAGENS DOS PRODUTOS
   ======================================== */

.product-image-square {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  margin-bottom: 15px;
  border-radius: 5px;
  transition: transform 0.3s ease;
}

.product-image-square:hover {
  transform: scale(1.02);
}

/* Fallback para navegadores que não suportam aspect-ratio */
@supports not (aspect-ratio: 1/1) {
  .product-image-square {
    height: 0;
    padding-bottom: 100%;
    position: relative;
  }

  .product-image-square img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* ========================================
   TÍTULOS E TEXTO
   ======================================== */

.product-item h4 {
  margin: 0 0 10px 0;
  font-size: 16px;
  line-height: 1.4;
}

.product-item h4 a {
  text-decoration: none;
  color: #333;
  transition: color 0.3s ease;
}

.product-item h4 a:hover {
  color: #fb7203;
}

.product-item .price {
  font-weight: bold;
  color: #353535;
  margin: 8px 0;
  font-size: 15px;
}

.product-item .address {
  color: #666;
  font-size: 14px;
  margin: 8px 0;
  line-height: 1.4;
}

/* ========================================
   BOTÕES
   ======================================== */

.product-item button {
  background: #fb7203;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  width: 100%;
  font-size: 14px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.product-item button:hover {
  background: #e66500;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(251, 114, 3, 0.3);
}

.product-item button:active {
  transform: translateY(0);
}

/* ========================================
   MAPA
   ======================================== */

.simple-locator-map {
  width: 100%;
  border: 1px solid #ccc;
  margin-bottom: 30px;
  border-radius: 8px;
  overflow: hidden;
}

/* ========================================
   POPUP DO MAPA
   ======================================== */

.map-popup-image {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1/1;
  object-fit: cover;
  margin-bottom: 10px;
  border-radius: 5px;
}

.map-popup-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
}

.map-popup-title a {
  color: #333;
  text-decoration: none;
}

.map-popup-title a:hover {
  color: #fb7203;
}

.map-popup-address {
  margin: 8px 0;
  font-size: 14px;
  color: #666;
}

.map-popup-button {
  background: #fb7203;
  color: white;
  padding: 8px 15px;
  text-decoration: none;
  border-radius: 3px;
  display: inline-block;
  margin-top: 5px;
  font-size: 14px;
  transition: background 0.3s ease;
}

.map-popup-button:hover {
  background: #e66500;
  color: white;
}

/* ========================================
   ESTADOS DE CARREGAMENTO
   ======================================== */

.simple-locator-loading {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.simple-locator-loading::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #fb7203;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ========================================
   MENSAGENS DE ERRO
   ======================================== */

.simple-locator-error {
  background: #f8d7da;
  color: #721c24;
  padding: 15px;
  border: 1px solid #f5c6cb;
  border-radius: 5px;
  margin: 10px 0;
}

.simple-locator-success {
  background: #d4edda;
  color: #155724;
  padding: 15px;
  border: 1px solid #c3e6cb;
  border-radius: 5px;
  margin: 10px 0;
}

/* ========================================
   DEBUG (quando ativado)
   ======================================== */

.simple-locator-debug {
  background: #f9f9f9;
  padding: 15px;
  margin: 10px 0;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.4;
}

.simple-locator-debug strong {
  color: #333;
}

/* ========================================
   OTIMIZAÇÕES PARA PERFORMANCE
   ======================================== */

/* Prevenir layout shift */
.product-item {
  contain: layout style paint;
}

/* Otimizar animações */
.product-item,
.product-image-square,
.product-item button {
  will-change: transform;
}

/* ========================================
   ACESSIBILIDADE
   ======================================== */

/* Foco visível para navegação por teclado */
.product-item button:focus,
.product-item h4 a:focus {
  outline: 2px solid #fb7203;
  outline-offset: 2px;
}

/* Contraste melhorado para leitores de tela */
@media (prefers-reduced-motion: reduce) {
  .product-item,
  .product-image-square,
  .product-item button {
    transition: none;
  }

  .simple-locator-loading::before {
    animation: none;
  }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  .product-item button,
  .map-popup-button {
    display: none;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .simple-locator-map {
    display: none;
  }
}
