:host {
  display: block;
  font-family: var(--font-primary, "Segoe UI", sans-serif);
}

.checkbox-grouped {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

// ========================================
// 🎯 ESTILOS DO GRUPO
// ========================================
.checkbox-group {
  border: 1px solid var(--divider);
  border-radius: 0.75rem;
  background-color: var(--surface);
  overflow: hidden;
  transition: all 0.3s ease;

  &:hover {
    border-color: var(--divider-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  &.expanded {
    .expand-icon {
      transform: rotate(180deg);
    }
  }
}

// ========================================
// 🎯 CABEÇALHO DO GRUPO
// ========================================
.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: var(--surface-variant);
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  transition: background-color 0.2s ease;
  
  &:hover {
    background-color: var(--hover-bg);
  }
}

.group-header-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.group-icon {
  font-size: 1rem;
  color: var(--idt-primary-color);
  width: 20px;
  display: flex;
  justify-content: center;
}

.group-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.group-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.expand-icon {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  transition: transform 0.3s ease;
  
  &.rotated {
    transform: rotate(180deg);
  }
}

// ========================================
// 🎯 CONTEÚDO DO GRUPO (CHECKBOXES)
// ========================================
.group-content {
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  background-color: var(--surface);
}

.checkbox-item {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: background-color 0.2s ease;

  &:hover {
    background-color: var(--surface-variant-subtle);
  }

  label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    width: 100%;
    
    input[type="checkbox"] {
      width: 18px;
      height: 18px;
      cursor: pointer;
      accent-color: var(--idt-primary-color);
      
      &:focus {
        outline: 2px solid var(--idt-primary-color);
        outline-offset: 2px;
      }
    }
    
    .checkbox-label {
      font-size: 0.9rem;
      color: var(--text-primary);
      line-height: 1.4;
      flex: 1;
    }
  }
}

// ========================================
// 🎯 RESPONSIVIDADE
// ========================================
@media (max-width: 768px) {
  .group-content {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.75rem;
  }
  
  .checkbox-item {
    padding: 0.4rem;
  }
  
  .group-header {
    padding: 0.6rem 0.75rem;
  }
  
  .group-label {
    font-size: 0.85rem;
  }
}

// ========================================
// 🎯 ESTADOS ESPECIAIS
// ========================================

// Estado desabilitado
:host(.disabled) {
  pointer-events: none;
  opacity: 0.6;
}

// Animações suaves
.checkbox-group {
  .group-content {
    transition: max-height 0.3s ease-in-out;
  }
  
  &:not(.expanded) .group-content {
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
  }
  
  &.expanded .group-content {
    max-height: 1000px; // Suficiente para a maioria dos casos
  }
}

// ========================================
// 🎯 ACESSIBILIDADE
// ========================================

// Melhor contraste para usuários com baixa visão
@media (prefers-contrast: high) {
  .checkbox-group {
    border-width: 2px;
  }
  
  .group-header {
    border-bottom-width: 2px;
  }
  
  input[type="checkbox"] {
    &:focus {
      outline-width: 3px;
    }
  }
}

// Reduzir movimento para usuários sensíveis
@media (prefers-reduced-motion: reduce) {
  .checkbox-group,
  .group-header,
  .checkbox-item,
  .expand-icon {
    transition: none;
  }
} 