// ========================================
// 🎯 LOADING STYLES - Data Table
// Loading states, overlays e mensagens
// ========================================

// ✨ NOVO: Loading States
.data-table-container.loading-state {
  pointer-events: none;
  opacity: 0.7;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(var(--surface-rgb), 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--text-secondary);
  text-align: center;
}

.loading-content p {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--divider);
  border-top: 4px solid var(--idt-primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

// ✨ LOADING ESPECÍFICO PARA BUSCA NO BACKEND
.loading-overlay.backend-search {
  background: rgba(var(--surface-rgb), 0.95);
  backdrop-filter: blur(3px);
  z-index: 105; /* ✅ MAIOR: Z-index maior que o loading geral */
  border: 2px solid #FFC82E;
  border-radius: 12px;
  margin: 20px;
  
  .loading-content {
    gap: 12px;
    padding: 20px;
    background: linear-gradient(135deg, 
      rgba(255, 200, 46, 0.1) 0%, 
      rgba(255, 200, 46, 0.05) 100%
    );
    border-radius: 8px;
    border: 1px solid rgba(255, 200, 46, 0.3);
    box-shadow: 0 4px 12px rgba(255, 200, 46, 0.2);
  }
  
  .backend-message {
    font-size: 16px;
    font-weight: 600;
    color: #000000;
    margin: 0;
    text-align: center;
  }
  
  .backend-hint {
    font-size: 12px;
    color: #666666;
    text-align: center;
    opacity: 0.8;
    font-style: italic;
  }
}

.spinner-backend {
  width: 45px;
  height: 45px;
  border: 4px solid rgba(255, 200, 46, 0.3);
  border-top: 4px solid #FFC82E;
  border-radius: 50%;
  animation: spin-backend 0.8s linear infinite;
  box-shadow: 0 2px 8px rgba(255, 200, 46, 0.3);
}

@keyframes spin-backend {
  0% { 
    transform: rotate(0deg);
    box-shadow: 0 2px 8px rgba(255, 200, 46, 0.3);
  }
  50% { 
    transform: rotate(180deg);
    box-shadow: 0 4px 12px rgba(255, 200, 46, 0.4);
  }
  100% { 
    transform: rotate(360deg);
    box-shadow: 0 2px 8px rgba(255, 200, 46, 0.3);
  }
}

// ✨ NOVO: Mensagem de "Nenhum Resultado Encontrado"
.no-results-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(var(--surface-rgb), 0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  backdrop-filter: blur(1px);
  border-radius: 8px;
}

.no-results-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 500px;
  padding: 40px 30px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--divider);
}

.no-results-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, 
    rgba(108, 117, 125, 0.1) 0%, 
    rgba(108, 117, 125, 0.05) 100%
  );
  border-radius: 50%;
  border: 2px solid rgba(108, 117, 125, 0.2);
  
  i {
    font-size: 36px;
    color: #6c757d;
    opacity: 0.7;
  }
}

.no-results-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

.no-results-message {
  margin: 0;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
  text-align: center;
}

.search-terms-display {
  padding: 16px 20px;
  background: linear-gradient(135deg, 
    rgba(255, 200, 46, 0.08) 0%, 
    rgba(255, 200, 46, 0.04) 100%
  );
  border: 1px solid rgba(255, 200, 46, 0.2);
  border-radius: 8px;
  width: 100%;
  
  .search-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
  }
  
  .search-terms {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #000000;
    background: rgba(255, 200, 46, 0.15);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 200, 46, 0.3);
    word-break: break-word;
    font-family: 'Courier New', monospace;
  }
}

.no-results-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  
  @media (max-width: 480px) {
    flex-direction: column;
    width: 100%;
  }
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  text-decoration: none;
  
  &.secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border-color: var(--divider);
    
    &:hover {
      background: var(--hover-bg);
      color: var(--text-primary);
      border-color: var(--text-secondary);
      transform: translateY(-1px);
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
  }
  
  &.primary {
    background: linear-gradient(135deg, #FFC82E 0%, #FFD700 100%);
    color: #000000;
    border-color: #FFC82E;
    font-weight: 600;
    
    &:hover {
      background: linear-gradient(135deg, #FFD700 0%, #FFED4E 100%);
      transform: translateY(-2px);
      box-shadow: 0 6px 16px rgba(255, 200, 46, 0.3);
    }
  }
  
  &:active {
    transform: translateY(0);
  }
  
  i {
    font-size: 0.875rem;
  }
  
  @media (max-width: 480px) {
    justify-content: center;
    padding: 14px 20px;
  }
}

// ========================================
// 🌙 TEMA ESCURO - LOADING E OVERLAYS
// ========================================

/* ✅ TEMA ESCURO: Loading de busca no backend */
:host-context(.dark-theme) .loading-overlay.backend-search {
  background: rgba(0, 0, 0, 0.85);
  border-color: #FFD700;
  
  .loading-content {
    background: linear-gradient(135deg, 
      rgba(255, 215, 0, 0.15) 0%, 
      rgba(255, 215, 0, 0.08) 100%
    );
    border-color: rgba(255, 215, 0, 0.4);
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.3);
  }
  
  .backend-message {
    color: #FFD700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  }
  
  .backend-hint {
    color: #CCCCCC;
  }
}

:host-context(.dark-theme) .spinner-backend {
  border: 4px solid rgba(255, 215, 0, 0.3);
  border-top: 4px solid #FFD700;
  box-shadow: 0 2px 12px rgba(255, 215, 0, 0.4);
}

/* ✅ TEMA ESCURO: Mensagem de "nenhum resultado" */
:host-context(.dark-theme) .no-results-overlay {
  background: rgba(0, 0, 0, 0.92);
}

:host-context(.dark-theme) .no-results-content {
  background: var(--surface);
  border-color: var(--divider);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

:host-context(.dark-theme) .no-results-icon {
  background: linear-gradient(135deg, 
    rgba(255, 200, 46, 0.15) 0%, 
    rgba(255, 200, 46, 0.08) 100%
  );
  border-color: rgba(255, 200, 46, 0.3);
  
  i {
    color: #FFD700;
    opacity: 0.8;
  }
}

:host-context(.dark-theme) .no-results-title {
  color: var(--text-primary);
}

:host-context(.dark-theme) .no-results-message {
  color: var(--text-secondary);
}

:host-context(.dark-theme) .search-terms-display {
  background: linear-gradient(135deg, 
    rgba(255, 200, 46, 0.12) 0%, 
    rgba(255, 200, 46, 0.06) 100%
  );
  border-color: rgba(255, 200, 46, 0.3);
  
  .search-label {
    color: #CCCCCC;
  }
  
  .search-terms {
    color: #FFD700;
    background: rgba(255, 200, 46, 0.2);
    border-color: rgba(255, 200, 46, 0.4);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

:host-context(.dark-theme) .action-btn {
  &.secondary {
    background: var(--surface);
    color: #CCCCCC;
    border-color: var(--divider);
    
    &:hover {
      background: var(--hover-bg);
      color: #FFFFFF;
      border-color: #FFD700;
      box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
    }
  }
  
  &.primary {
    background: linear-gradient(135deg, #FFC82E 0%, #FFD700 100%);
    color: #000000;
    
    &:hover {
      background: linear-gradient(135deg, #FFD700 0%, #FFED4E 100%);
      box-shadow: 0 6px 20px rgba(255, 200, 46, 0.4);
    }
  }
}

// ========================================
// 📱 RESPONSIVIDADE - LOADING E MENSAGENS
// ========================================

/* ✅ RESPONSIVIDADE: Mensagem de "nenhum resultado" */
@media (max-width: 768px) {
  .no-results-content {
    max-width: 90vw;
    padding: 30px 20px;
    gap: 16px;
  }
  
  .no-results-icon {
    width: 60px;
    height: 60px;
    
    i {
      font-size: 28px;
    }
  }
  
  .no-results-title {
    font-size: 1.25rem;
  }
  
  .no-results-message {
    font-size: 0.925rem;
  }
  
  .search-terms-display {
    padding: 12px 16px;
    
    .search-label {
      font-size: 0.8rem;
      margin-bottom: 6px;
    }
    
    .search-terms {
      font-size: 0.9rem;
      padding: 6px 10px;
    }
  }
}

@media (max-width: 480px) {
  .no-results-content {
    max-width: 95vw;
    padding: 24px 16px;
    gap: 12px;
  }
  
  .no-results-icon {
    width: 50px;
    height: 50px;
    
    i {
      font-size: 24px;
    }
  }
  
  .no-results-title {
    font-size: 1.125rem;
  }
  
  .no-results-message {
    font-size: 0.875rem;
  }
  
  .search-terms-display {
    padding: 10px 12px;
    
    .search-terms {
      font-size: 0.8rem;
      padding: 5px 8px;
    }
  }
}

// ========================================
// 🎯 OUTROS OVERLAYS
// ========================================

.loading-overlay {
  background: rgba(var(--background), 0.7);
}

.empty-message {
  color: var(--text-secondary);
}

.sort-icon {
  color: var(--text-secondary);
}

.active-sort {
  color: var(--primary);
} 