/* Estilos para Integração CMS */

/* Loading Placeholders */
.loading-placeholder {
  padding: 2rem;
  text-align: center;
  color: #666;
  font-style: italic;
  background: linear-gradient(90deg, #f5f5f5 25%, #eee 50%, #f5f5f5 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
  border-radius: 8px;
  margin: 1rem 0;
}

@keyframes loading-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Status de Sincronização */
.sync-status {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  z-index: 1000;
  transition: all 0.3s ease;
  pointer-events: none;
}

.sync-status.connected {
  background: #22c55e;
  color: white;
}

.sync-status.syncing {
  background: #f59e0b;
  color: white;
}

.sync-status.offline {
  background: #ef4444;
  color: white;
}

.sync-status.hidden {
  opacity: 0;
  transform: translateY(-20px);
}

/* Animação de carregamento para itens */
.cms-item-loading {
  opacity: 0;
  transform: translateY(20px);
  animation: item-fade-in 0.5s ease forwards;
}

@keyframes item-fade-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Estilos para conteúdo dinâmico */
[data-cms-content] {
  min-height: 40px;
  transition: all 0.3s ease;
}

[data-cms-content].loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Estilos específicos para seções dinâmicas */
.services-grid[data-cms-content] .loading-placeholder,
.portfolio-grid[data-cms-content] .loading-placeholder,
.faq-list[data-cms-content] .loading-placeholder {
  grid-column: 1 / -1; /* Ocupa toda a largura da grid */
}

/* Erro de conexão */
.cms-error {
  padding: 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  text-align: center;
  margin: 1rem 0;
}

.cms-error .retry-button {
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.cms-error .retry-button:hover {
  background: #b91c1c;
}

/* Indicador de cache */
.cache-indicator {
  position: relative;
}

.cache-indicator::after {
  content: '📦';
  position: absolute;
  top: -5px;
  right: -5px;
  font-size: 12px;
  opacity: 0.5;
  background: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Responsividade */
@media (max-width: 768px) {
  .sync-status {
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    font-size: 11px;
  }
  
  .loading-placeholder {
    padding: 1rem;
    font-size: 14px;
  }
}

/* Debug mode (habilitado apenas quando necessário) */
.cms-debug {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 10px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 12px;
  max-width: 300px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1001;
  display: none;
}

.cms-debug.active {
  display: block;
}

.cms-debug .debug-title {
  font-weight: bold;
  border-bottom: 1px solid #555;
  padding-bottom: 5px;
  margin-bottom: 5px;
}

.cms-debug .debug-line {
  margin: 2px 0;
  padding: 2px 0;
}

.cms-debug .debug-error {
  color: #ff6b6b;
}

.cms-debug .debug-success {
  color: #4ecdc4;
}

.cms-debug .debug-warning {
  color: #ffe066;
}

/* Suavizar transições de conteúdo */
.cms-content-transition {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.cms-content-transition.updating {
  opacity: 0.7;
  transform: scale(0.98);
}
