/* Estilos personalizados para o UDI Patinhas */
:root {
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --primary-500: #10b981;
  --primary-600: #059669;
  --primary-700: #047857;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* Glassmorphism */
.glass {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.glass-dark {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Animações sutis */
@keyframes pulseSlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.03); }
}

.animate-pulse-slow {
  animation: pulseSlow 3s infinite ease-in-out;
}

/* Indicador HTMX */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: flex;
}

/* Marcadores customizados do Leaflet */
.pet-pin-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.pet-pin {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: transform 0.2s ease;
}

.pet-pin:hover {
  transform: scale(1.15);
}

.pet-pin-rua { background: linear-gradient(135deg, #f59e0b, #d97706); }
.pet-pin-perdido { background: linear-gradient(135deg, #f43f5e, #e11d48); animation: pulseSlow 2s infinite ease-in-out; }
.pet-pin-adocao { background: linear-gradient(135deg, #10b981, #059669); }
.pet-pin-resgatado { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.pet-pin-encontrado { background: linear-gradient(135deg, #10b981, #059669); }
.pet-pin-adotado { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }

/* Cluster customizado */
.custom-cluster {
  background: rgba(16, 185, 129, 0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-cluster div {
  width: 36px;
  height: 36px;
  background: #059669;
  color: white;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Padronização de Imagens dos Cards */
.card-img-wrapper {
  position: relative;
  width: 100%;
  height: 210px;
  overflow: hidden;
  background-color: #f1f5f9;
  flex-shrink: 0;
}

.card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.4s ease;
}

.card-img-wrapper:hover img {
  transform: scale(1.05);
}

/* Padronização de Textos e Descrições dos Cards */
.card-desc-box {
  min-height: 4.5rem;
  max-height: 4.5rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-height: 1.45;
  text-overflow: ellipsis;
  word-break: break-word;
}

/* Tom Select (Caixa de busca em selects) */
.ts-wrapper {
  width: 100% !important;
}
.ts-wrapper.single .ts-control {
  border-radius: 0.75rem !important;
  border: 1px solid #e2e8f0 !important;
  background-color: #f8fafc !important;
  padding: 0.5rem 0.75rem !important;
  font-size: 0.775rem !important;
  line-height: 1.25rem !important;
  color: #1e293b !important;
  font-weight: 500 !important;
  box-shadow: none !important;
  transition: all 0.2s ease !important;
  min-height: 38px !important;
  display: flex !important;
  align-items: center !important;
}
.ts-wrapper.single .ts-control:after {
  border-color: #64748b transparent transparent transparent !important;
  border-width: 5px 4px 0 4px !important;
  margin-top: -2px !important;
  right: 12px !important;
}
.ts-wrapper.single.dropdown-active .ts-control:after {
  border-color: transparent transparent #059669 transparent !important;
  border-width: 0 4px 5px 4px !important;
}
.ts-wrapper.focus .ts-control {
  background-color: #ffffff !important;
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}
.ts-dropdown {
  border-radius: 0.875rem !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0,0,0,0.03) !important;
  background: #ffffff !important;
  padding: 6px !important;
  z-index: 999999 !important;
  font-size: 0.775rem !important;
  margin-top: 4px !important;
  max-height: 280px !important;
}

/* Caixa de Busca no Topo do Dropdown (plugin dropdown_input) */
.ts-dropdown .dropdown-input-wrap {
  padding: 4px 4px 8px 4px !important;
  position: sticky !important;
  top: 0 !important;
  background: #ffffff !important;
  z-index: 20 !important;
  border-bottom: 1px solid #f1f5f9 !important;
  margin-bottom: 4px !important;
}
.ts-dropdown .dropdown-input {
  width: 100% !important;
  padding: 7px 10px 7px 28px !important;
  font-size: 0.75rem !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 0.625rem !important;
  background-color: #f8fafc !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: 8px center !important;
  background-size: 14px 14px !important;
  color: #0f172a !important;
  outline: none !important;
  transition: all 0.2s ease !important;
}
.ts-dropdown .dropdown-input:focus {
  background-color: #ffffff !important;
  border-color: #059669 !important;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15) !important;
}

.ts-dropdown .option {
  padding: 7px 10px !important;
  border-radius: 0.5rem !important;
  color: #334155 !important;
  font-weight: 500 !important;
  cursor: pointer !important;
}
.ts-dropdown .option.active, .ts-dropdown .option:hover {
  background-color: #ecfdf5 !important;
  color: #065f46 !important;
  font-weight: 600 !important;
}
.ts-dropdown .optgroup-header {
  font-size: 0.65rem !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: #94a3b8 !important;
  padding: 6px 10px 2px !important;
}
.ts-dropdown .no-results {
  padding: 10px !important;
  color: #94a3b8 !important;
  font-style: italic !important;
  text-align: center !important;
}

/* Autocomplete de Endereços estilo Google Maps */
.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 99999;
  background: #ffffff;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
  max-height: 280px;
  overflow-y: auto;
  margin-top: 4px;
}
.autocomplete-item {
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-bottom: 1px solid #f8fafc;
  transition: background-color 0.15s ease;
}
.autocomplete-item:last-child {
  border-bottom: none;
}
.autocomplete-item:hover, .autocomplete-item.selected {
  background-color: #f0fdf4;
}
.autocomplete-item i {
  color: #059669;
  font-size: 13px;
  flex-shrink: 0;
}
.autocomplete-item-text {
  flex: 1;
  min-width: 0;
}
.autocomplete-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.autocomplete-subtitle {
  font-size: 0.7rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Correção Global de Hiperlinks & Leaflet Popups
   ========================================================================== */

/* Garante que links estilizados como botões ou com texto branco nunca fiquem azuis */
a.text-white,
a.text-white:visited,
a.text-white:hover,
a.text-white:focus,
a.text-white:active {
  color: #ffffff !important;
}

/* Garante que links em botões com fundos coloridos mantenham texto branco */
a.bg-brand-600,
a.bg-brand-700,
a.bg-emerald-500,
a.bg-emerald-600,
a.bg-emerald-700,
a.bg-green-600,
a.bg-rose-600,
a.bg-rose-700,
a.bg-blue-600,
a.bg-blue-700,
a.bg-purple-600,
a.bg-slate-900 {
  color: #ffffff !important;
  text-decoration: none !important;
}

a.bg-brand-600:hover,
a.bg-brand-700:hover,
a.bg-emerald-500:hover,
a.bg-emerald-600:hover,
a.bg-emerald-700:hover,
a.bg-green-600:hover,
a.bg-rose-600:hover,
a.bg-rose-700:hover,
a.bg-blue-600:hover,
a.bg-blue-700:hover,
a.bg-purple-600:hover,
a.bg-slate-900:hover {
  color: #ffffff !important;
}

/* Sobrescreve as regras de link do Leaflet (.leaflet-container a { color: #0078A8; }) */
.leaflet-container a,
.leaflet-popup-content a {
  color: inherit;
  text-decoration: none;
}

.leaflet-popup-content a.text-white,
.leaflet-popup-content a[class*="text-white"],
.leaflet-popup-content a.bg-brand-600,
.leaflet-popup-content a[class*="bg-"] {
  color: #ffffff !important;
  text-decoration: none !important;
}

.leaflet-popup-content a.text-white:hover,
.leaflet-popup-content a[class*="text-white"]:hover,
.leaflet-popup-content a[class*="bg-"]:hover {
  color: #ffffff !important;
}

