/* ================================
   1. FONTE GLOBAL & RESET
   (Força Inter em tudo, inclusive inputs e modal)
================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

#catalogo-empresas-root,
#catalogo-empresas-root *,
.ce-modal,
.ce-modal * {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  box-sizing: border-box;
}

/* ================================
   2. CONTAINER PRINCIPAL
================================ */
#catalogo-empresas-root {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: block;
}

.ce-main {
  padding: 2rem 1rem 3rem;
  margin: 0 auto;
  max-width: 1400px;
}

/* ================================
   3. BARRA DE PESQUISA (BLINDADA)
   (Usa !important para não quebrar no seu tema)
================================ */
.ce-search-area {
  text-align: center;
  margin-bottom: 3rem;
  padding: 0 1rem;
  display: flex;
  justify-content: center;
}

#catalogo-empresas-root input.ce-search-input {
  width: 100%;
  max-width: 600px;
  height: 55px !important;
  padding: 0 30px !important;
  font-size: 1.1rem !important;
  background-color: #ffffff !important;
  color: #333 !important;
  border: 2px solid rgba(186, 141, 28, 0.5) !important;
  border-radius: 50px !important;
  box-shadow: 0 5px 15px rgba(0,0,0,0.05) !important;
  outline: none !important;
  transition: all 0.3s ease;
}

#catalogo-empresas-root input.ce-search-input:focus {
  border-color: #BA8D1C !important;
  box-shadow: 0 8px 25px rgba(186, 141, 28, 0.25) !important;
  transform: scale(1.02);
}

#catalogo-empresas-root input.ce-search-input::placeholder {
  color: #999 !important;
}

/* ================================
   4. GRID (ALINHAMENTO PERFEITO)
================================ */
.ce-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: stretch; /* Garante que todos cards tenham mesma altura */
}

@media (min-width: 600px) { .ce-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .ce-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .ce-grid { grid-template-columns: repeat(4, 1fr); } }

/* ================================
   5. CARD ESTILIZADO
================================ */
.ce-card {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid rgba(186, 141, 28, 0.3);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(186, 141, 28, 0.05);
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%; 
}

.ce-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 15px 35px rgba(186, 141, 28, 0.25);
  border-color: #BA8D1C;
}

/* -- ÁREA SUPERIOR DO CARD -- */
.ce-card-logo-area {
  background: linear-gradient(180deg, #CA961E 0%, #FCE292 100%);
  padding: 2rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* -- A LOGO (QUADRADO PADRÃO) -- */
.ce-card-logo {
  /* TAMANHO FIXO PARA TODAS */
  width: 110px;  
  height: 110px;
  
  /* Ajuste da imagem dentro do quadrado */
  object-fit: contain; 
  
  /* Estilo da Caixa (Igual ao Fallback) */
  background: white;
  border: 2px solid #F97316; /* Borda Laranja */
  border-radius: 14px;
  padding: 8px; /* Espaço para a logo não colar na borda */
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* -- FALLBACK (QUANDO NÃO TEM LOGO) -- */
.ce-card-logo-fallback {
  width: 110px;
  height: 110px;
  background: #FBC39C;
  border: 2px solid #F97316;
  color: #7C2D12;
  font-size: 2.2rem;
  font-weight: 700;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* -- CORPO DO CARD -- */
.ce-card-body {
  background: #fff;
  padding: 1.5rem;
  text-align: center;
  flex-grow: 1; /* Faz ocupar o espaço restante */
  display: flex;
  align-items: center;
  justify-content: center;
}

.ce-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #EA580C;
  margin: 0;
  line-height: 1.3;
}

/* ================================
   6. MODAL
================================ */
.ce-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  z-index: 999999;
}

.ce-modal-content {
  width: 100%;
  max-width: 550px;
  background: #FFFFFF;
  border-radius: 20px;
  padding: 2.5rem 2rem;
  position: relative;
  text-align: center;
  border: 2px solid #BA8D1C;
  box-shadow: 0px 10px 30px rgba(186, 141, 28, 0.3);
  max-height: 90vh;
  overflow-y: auto;
}

.ce-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 36px;
  height: 36px;
  background: #f0f0f0;
  color: #555;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  transition: .2s;
}
.ce-close-btn:hover { background: #e0e0e0; color: #000; }

/* Logo no Modal */
.ce-modal-logo {
  position: relative;
  width: 100%;
  text-align: center;
  margin-bottom: 2rem;
}
/* Garante que a logo do modal também fique bonita */
.ce-modal-logo img {
  display: block;
  margin: 0 auto;
  width: 140px;
  height: 140px;
  object-fit: contain;
  background: white;
  border-radius: 14px;
  padding: 5px;
}
.ce-modal-logo .ce-card-logo-fallback { margin: 0 auto; }

/* Linha Dourada */
.ce-modal-logo::after {
  content: "";
  display: block;
  width: 80px;
  height: 4px;
  background: #CA961E;
  border-radius: 2px;
  margin: 1.5rem auto 0 auto;
  opacity: 0.8;
}

/* Tipografia Modal */
.ce-modal-title {
  color: #D97706;
  font-size: 1.6rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.ce-cat {
  font-size: 0.85rem;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1.5rem;
  font-weight: 600;
}
.ce-desc {
  color: #4B5563;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Botões */
.ce-modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ce-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: 0.2s;
  background: #BA8D1C;
  color: white;
  box-shadow: 0 4px 10px rgba(186, 141, 28, 0.3);
}
.ce-btn:hover {
  background: #a67c15;
  transform: translateY(-2px);
}
.ce-btn-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

/* Loading */
.ce-loading { text-align: center; padding: 4rem; }
.ce-spinner {
  display: inline-block;
  width: 3rem;
  height: 3rem;
  border: 4px solid #eee;
  border-top-color: #BA8D1C;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }